Thread (52 messages) flat view 52 messages, 8 authors, 2025-10-07

Re: [PATCH v6 6/6] fs: introduce file_getattr and file_setattr syscalls

From: Amir Goldstein <amir73il@gmail.com>
Date: 2025-07-02 09:14:01
Also in: linux-fsdevel, linux-xfs, lkml, selinux

quoted
+/*
+ * Variable size structure for file_[sg]et_attr().
+ *
+ * Note. This is alternative to the structure 'struct fileattr'/'struct fsxattr'.
+ * As this structure is passed to/from userspace with its size, this can
+ * be versioned based on the size.
+ */
+struct fsx_fileattr {
+     __u32   fsx_xflags;     /* xflags field value (get/set) */
+     __u32   fsx_extsize;    /* extsize field value (get/set)*/
+     __u32   fsx_nextents;   /* nextents field value (get)   */
+     __u32   fsx_projid;     /* project identifier (get/set) */
+     __u32   fsx_cowextsize; /* CoW extsize field value (get/set) */
This misses a:

__u32 __spare;

so there's no holes in the struct. :)
Adding __spare and not verifying that it is zeroed gets us to the
point that we are not able to replace __spare with a real field later.

I suggest to resolve this hole as Darrick and Pali suggested by making it
__u64 fsx_xflags

w.r.t Darrick's comment, I kind of like it that the name for the UAPI
struct (fsxattr)
differs from the name of the kernel internal representation (fileattr), but
I agree that fsx_fileattr does not give a good hint on what it is.

I think that renaming struct fsx_fileattr to struct fsxattr64 along
with changing the
width of fsx_xflags will help reduce the confusion of users.

What do you guys think?

Thanks,
Amir.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help