On Thu, Feb 15, 2024 at 07:44:21PM -0700, Thomas Bertschinger wrote:
> This is needed for building Rust bindings on big endian architectures
> like s390x. Currently this is only done in userspace, but it might
> happen in-kernel in the future. When creating a Rust binding for struct
> bkey, the "packed" attribute is needed to get a type with the correct
> member offsets in the big endian case. However, rustc does not allow
> types to have both a "packed" and "align" attribute. Thus, in order to
> get a Rust type compatible with the C type, we must omit the "aligned"
> attribute in C.
> 
> This does not affect the struct's size or member offsets, only its
> toplevel alignment, which should be an acceptable impact.
> 
> The little endian version can have the "align" attribute because the
> "packed" attr is redundant, and rust-bindgen will omit the "packed" attr
> when an "align" attr is present and it can do so without changing a
> type's layout
> 
> Signed-off-by: Thomas Bertschinger <[email protected]>

Thanks, applied

Reply via email to