]> git.ipfire.org Git - thirdparty/linux.git/commit
add statmount(2) syscall
authorMiklos Szeredi <mszeredi@redhat.com>
Wed, 25 Oct 2023 14:02:02 +0000 (16:02 +0200)
committerChristian Brauner <brauner@kernel.org>
Mon, 11 Dec 2023 18:11:02 +0000 (19:11 +0100)
commit46eae99ef73302f9fb3dddcd67c374b3dffe8fd6
tree03dd787e3f3f2e9341a3471097e66cb195643fdf
parent56c94c626785001dbb683312725b7d87c6ec6a91
add statmount(2) syscall

Add a way to query attributes of a single mount instead of having to parse
the complete /proc/$PID/mountinfo, which might be huge.

Lookup the mount the new 64bit mount ID.  If a mount needs to be queried
based on path, then statx(2) can be used to first query the mount ID
belonging to the path.

Design is based on a suggestion by Linus:

  "So I'd suggest something that is very much like "statfsat()", which gets
   a buffer and a length, and returns an extended "struct statfs" *AND*
   just a string description at the end."

The interface closely mimics that of statx.

Handle ASCII attributes by appending after the end of the structure (as per
above suggestion).  Pointers to strings are stored in u64 members to make
the structure the same regardless of pointer size.  Strings are nul
terminated.

Link: https://lore.kernel.org/all/CAHk-=wh5YifP7hzKSbwJj94+DZ2czjrZsczy6GBimiogZws=rg@mail.gmail.com/
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Link: https://lore.kernel.org/r/20231025140205.3586473-5-mszeredi@redhat.com
Reviewed-by: Ian Kent <raven@themaw.net>
[Christian Brauner <brauner@kernel.org>: various minor changes]
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/namespace.c
include/linux/syscalls.h
include/uapi/linux/mount.h