Linux-bcachefs Archive mirror
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet@linux.dev>
To: Thomas Bertschinger <tahbertschinger@gmail.com>
Cc: linux-bcachefs@vger.kernel.org, bfoster@redhat.com
Subject: Re: [PATCH v2] bcachefs: omit alignment attribute on big endian struct bkey
Date: Thu, 15 Feb 2024 21:54:27 -0500	[thread overview]
Message-ID: <c24r77xcz7yn3wezeudn2fhyhf2qrhiznswjszrah5hhekr2fe@i42ifngbp7oc> (raw)
In-Reply-To: <20240216024421.143152-1-tahbertschinger@gmail.com>

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 <tahbertschinger@gmail.com>

Thanks, applied

      reply	other threads:[~2024-02-16  2:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16  2:44 [PATCH v2] bcachefs: omit alignment attribute on big endian struct bkey Thomas Bertschinger
2024-02-16  2:54 ` Kent Overstreet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c24r77xcz7yn3wezeudn2fhyhf2qrhiznswjszrah5hhekr2fe@i42ifngbp7oc \
    --to=kent.overstreet@linux.dev \
    --cc=bfoster@redhat.com \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=tahbertschinger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).