From: Karel Zak Date: Thu, 9 Jun 2022 11:01:52 +0000 (+0200) Subject: include/mount-api-utils: add new syscalls X-Git-Tag: v2.39-rc1~332 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0120be6f938800f6cafed27c64069c730f563cb9;p=thirdparty%2Futil-linux.git include/mount-api-utils: add new syscalls Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index 8a6363f6ad..2e73ea462c 100644 --- a/configure.ac +++ b/configure.ac @@ -499,6 +499,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]) AC_CHECK_TYPES([struct mount_attr], [], [], [[#include ]]) +AC_CHECK_TYPES([enum fsconfig_command], [], [], [[#include ]]) AC_CHECK_MEMBERS([struct termios.c_line],,, [[#include ]]) @@ -544,6 +545,10 @@ AC_CHECK_FUNCS([ \ __fpending \ __fpurge \ fpurge \ + fsconfig \ + fsmount \ + fsopen \ + fspick \ fsync \ getdomainname \ getdtablesize \ @@ -622,9 +627,14 @@ UL_CHECK_SYSCALL([pidfd_open]) UL_CHECK_SYSCALL([pidfd_send_signal]) UL_CHECK_SYSCALL([close_range]) -UL_CHECK_SYSCALL([open_tree]) -UL_CHECK_SYSCALL([move_mount]) +UL_CHECK_SYSCALL([fsconfig]) +UL_CHECK_SYSCALL([fsmount]) +UL_CHECK_SYSCALL([fsopen]) +UL_CHECK_SYSCALL([fspick]) UL_CHECK_SYSCALL([mount_setattr]) +UL_CHECK_SYSCALL([move_mount]) +UL_CHECK_SYSCALL([open_tree]) + AC_CHECK_FUNCS([isnan], [], [AC_CHECK_LIB([m], [isnan], [MATH_LIBS="-lm"])] diff --git a/include/mount-api-utils.h b/include/mount-api-utils.h index 09ea9eefac..98d9233ff1 100644 --- a/include/mount-api-utils.h +++ b/include/mount-api-utils.h @@ -116,6 +116,72 @@ static inline int mount_setattr(int dfd, const char *path, unsigned int flags, } #endif +#ifndef HAVE_ENUM_FSCONFIG_COMMAND +enum fsconfig_command { + FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ + FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ + FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ + FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ + FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ + FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ + FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ + FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ +}; +#endif + +#if !defined(HAVE_FSCONFIG) && defined(SYS_fsconfig) +static inline int fsconfig(int fd, unsigned int cmd, const char *key, + const void *value, int aux) +{ + return syscall(SYS_fsconfig, fd, cmd, key, value, aux); +} +#endif + +#ifndef FSOPEN_CLOEXEC +# define FSOPEN_CLOEXEC 0x00000001 +#endif + +#if !defined(HAVE_FSOPEN) && defined(SYS_fsopen) +static inline int fsopen(const char *fsname, unsigned int flags) +{ + return syscall(SYS_fsopen, fsname, flags); +} +#endif + +#ifndef FSMOUNT_CLOEXEC +# define FSMOUNT_CLOEXEC 0x00000001 +#endif + +#if !defined(HAVE_FSMOUNT) && defined(SYS_fsmount) +static inline int fsmount(int fd, unsigned int flags, unsigned int mount_attrs) +{ + return syscall(SYS_fsmount, fd, flags, mount_attrs); +} +#endif + +#ifndef FSPICK_CLOEXEC +# define FSPICK_CLOEXEC 0x00000001 +#endif + +#ifndef FSPICK_SYMLINK_NOFOLLOW +# define FSPICK_SYMLINK_NOFOLLOW 0x00000002 +#endif + +#ifndef FSPICK_NO_AUTOMOUNT +# define FSPICK_NO_AUTOMOUNT 0x00000004 +#endif + +#ifdef FSPICK_EMPTY_PATH +# define FSPICK_EMPTY_PATH 0x00000008 +#endif + +#if !defined(HAVE_FSPICK) && defined(SYS_fspick) +static inline int fspick(int dfd, const char *pathname, unsigned int flags) +{ + return syscall(SYS_fspick, dfd, pathname, flags); +} +#endif + /* * UL_HAVE_MOUNT_API is used by applications to check that all new mount API is @@ -123,7 +189,11 @@ static inline int mount_setattr(int dfd, const char *path, unsigned int flags, */ #if defined(SYS_open_tree) && \ defined(SYS_mount_setattr) && \ - defined(SYS_move_mount) + defined(SYS_move_mount) && \ + defined(SYS_fsconfig) && \ + defined(SYS_fsopen) && \ + defined(SYS_fsmount) && \ + defined(SYS_fspick) # define UL_HAVE_MOUNT_API 1 #endif diff --git a/meson.build b/meson.build index a145dbeb27..694f6f3814 100644 --- a/meson.build +++ b/meson.build @@ -481,6 +481,10 @@ funcs = ''' explicit_bzero fmemopen fseeko + fsconfig + fsmount + fsopen + fspick fsync utimensat getdomainname @@ -588,6 +592,9 @@ conf.set('HAVE_TM_GMTOFF', have ? 1 : false) have = cc.sizeof('struct mount_attr', prefix : '#include ') > 0 conf.set('HAVE_STRUCT_MOUNT_ATTR', have ? 1 : false) +have = cc.sizeof('enum fsconfig_command', prefix : '#include ') > 0 +conf.set('HAVE_ENUM_FSCONFIG_COMMANS', have ? 1 : false) + have = cc.has_member('struct termios', 'c_line', prefix : '#include ') conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)