diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-21 19:47:55 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-23 17:08:31 -0500 |
commit | c7014647976f799a5f22142d044376672cd7331d (patch) | |
tree | 3e6f7572eec26b0c5572a6167e0ba1abed430d2a | |
parent | 200e13131fe79ad690f63995627efd97f87fdb4d (diff) |
bcachefs: Fixes for rust bindgen
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>
-rw-r--r-- | fs/bcachefs/mean_and_variance.h | 5 | ||||
-rw-r--r-- | fs/bcachefs/subvolume_types.h | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/fs/bcachefs/mean_and_variance.h b/fs/bcachefs/mean_and_variance.h index 647505010b39..b2be565bb8f2 100644 --- a/fs/bcachefs/mean_and_variance.h +++ b/fs/bcachefs/mean_and_variance.h @@ -12,9 +12,12 @@ /* * 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; diff --git a/fs/bcachefs/subvolume_types.h b/fs/bcachefs/subvolume_types.h index 2d2e66a4e468..ae644adfc391 100644 --- a/fs/bcachefs/subvolume_types.h +++ b/fs/bcachefs/subvolume_types.h @@ -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 { |