Re: [PATCH v2] NFSD: Rework encoding and decoding of nfsd4_deviceid
From: Christoph Hellwig
Date: Tue Jul 29 2025 - 03:48:17 EST
On Wed, Jul 23, 2025 at 10:35:29AM -0400, Chuck Lever wrote:
> > We could document it in the code with __no_randomize_layout after the
> > structure definition.
>
> We might also want __attribute__((packed)) or even
> __attribute__((packed, aligned(4))).
Absolute not. packed causes horrible code generation, and
__attribute__((packed, aligned(4))) will probably break things
that didn't properly pad (although they really should).
> That still leaves undocumented the fact that the fields in the structure
> are treated as both endian types. In most other XDR functions we have
> been careful to write source code that shows where endianness changes
> or, conversely, where endianness is not consequential.
I'm not arguing against doing XDR things in XDR code. But the rest of
the kernel works very different.