Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

NFSD: Simplify struct knfsd_fh

Compilers are allowed to insert padding and reorder the
fields in a struct, so using a union of an array and a
struct in struct knfsd_fh is not reliable.

The position of elements in an array is more reliable.

Suggested-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

Chuck Lever 03963793 edf7b905

+6 -9
+6 -9
fs/nfsd/nfsfh.h
··· 49 49 * Points to the current size while 50 50 * building a new file handle. 51 51 */ 52 - union { 53 - char fh_raw[NFS4_FHSIZE]; 54 - struct { 55 - u8 fh_version; /* == 1 */ 56 - u8 fh_auth_type; /* deprecated */ 57 - u8 fh_fsid_type; 58 - u8 fh_fileid_type; 59 - }; 60 - }; 52 + u8 fh_raw[NFS4_FHSIZE]; 61 53 }; 54 + 55 + #define fh_version fh_raw[0] 56 + #define fh_auth_type fh_raw[1] 57 + #define fh_fsid_type fh_raw[2] 58 + #define fh_fileid_type fh_raw[3] 62 59 63 60 static inline u32 *fh_fsid(const struct knfsd_fh *fh) 64 61 {