]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs: Fixes for rust bindgen
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 22 Dec 2023 00:47:55 +0000 (19:47 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Jan 2024 16:47:42 +0000 (11:47 -0500)
bindgen doesn't seem to like u128 or DECLARE_FLEX_ARRAY(), but we can
hack around them.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/mean_and_variance.h
fs/bcachefs/subvolume_types.h

index 647505010b3974b713823f96ddeab6a6aa8fe5df..b2be565bb8f214bc2ac4ebd6efac324ac20b7241 100644 (file)
 /*
  * u128_u: u128 user mode, because not all architectures support a real int128
  * type
+ *
+ * We don't use this version in userspace, because in userspace we link with
+ * Rust and rustc has issues with u128.
  */
 
-#ifdef __SIZEOF_INT128__
+#if defined(__SIZEOF_INT128__) && defined(__KERNEL__)
 
 typedef struct {
        unsigned __int128 v;
index 2d2e66a4e4681ee5ba6ba18666d135ab961a2cbf..ae644adfc391680d85b6fe53c25f08ae9337e037 100644 (file)
@@ -20,7 +20,11 @@ struct snapshot_t {
 };
 
 struct snapshot_table {
+#ifndef RUST_BINDGEN
        DECLARE_FLEX_ARRAY(struct snapshot_t, s);
+#else
+       struct snapshot_t       s[0];
+#endif
 };
 
 typedef struct {