Unverified Commit be7efb2d authored by Andrey Albershteyn's avatar Andrey Albershteyn Committed by Christian Brauner
Browse files

fs: introduce file_getattr and file_setattr syscalls



Introduce file_getattr() and file_setattr() syscalls to manipulate inode
extended attributes. The syscalls takes pair of file descriptor and
pathname. Then it operates on inode opened accroding to openat()
semantics. The struct file_attr is passed to obtain/change extended
attributes.

This is an alternative to FS_IOC_FSSETXATTR ioctl with a difference
that file don't need to be open as we can reference it with a path
instead of fd. By having this we can manipulated inode extended
attributes not only on regular files but also on special ones. This
is not possible with FS_IOC_FSSETXATTR ioctl as with special files
we can not call ioctl() directly on the filesystem inode using fd.

This patch adds two new syscalls which allows userspace to get/set
extended inode attributes on special files by using parent directory
and a path - *at() like syscall.

CC: linux-api@vger.kernel.org
CC: linux-fsdevel@vger.kernel.org
CC: linux-xfs@vger.kernel.org
Signed-off-by: default avatarAndrey Albershteyn <aalbersh@kernel.org>
Link: https://lore.kernel.org/20250630-xattrat-syscall-v6-6-c4e3bc35227b@kernel.org


Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 276e136b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -507,3 +507,5 @@
575	common	listxattrat			sys_listxattrat
576	common	removexattrat			sys_removexattrat
577	common	open_tree_attr			sys_open_tree_attr
578	common	file_getattr			sys_file_getattr
579	common	file_setattr			sys_file_setattr
+2 −0
Original line number Diff line number Diff line
@@ -482,3 +482,5 @@
465	common	listxattrat			sys_listxattrat
466	common	removexattrat			sys_removexattrat
467	common	open_tree_attr			sys_open_tree_attr
468	common	file_getattr			sys_file_getattr
469	common	file_setattr			sys_file_setattr
+2 −0
Original line number Diff line number Diff line
@@ -479,3 +479,5 @@
465	common	listxattrat			sys_listxattrat
466	common	removexattrat			sys_removexattrat
467	common	open_tree_attr			sys_open_tree_attr
468	common	file_getattr			sys_file_getattr
469	common	file_setattr			sys_file_setattr
+2 −0
Original line number Diff line number Diff line
@@ -467,3 +467,5 @@
465	common	listxattrat			sys_listxattrat
466	common	removexattrat			sys_removexattrat
467	common	open_tree_attr			sys_open_tree_attr
468	common	file_getattr			sys_file_getattr
469	common	file_setattr			sys_file_setattr
+2 −0
Original line number Diff line number Diff line
@@ -473,3 +473,5 @@
465	common	listxattrat			sys_listxattrat
466	common	removexattrat			sys_removexattrat
467	common	open_tree_attr			sys_open_tree_attr
468	common	file_getattr			sys_file_getattr
469	common	file_setattr			sys_file_setattr
Loading