1e262e32dSDavid Howells #ifndef _UAPI_LINUX_MOUNT_H 2e262e32dSDavid Howells #define _UAPI_LINUX_MOUNT_H 3e262e32dSDavid Howells 42a186721SChristian Brauner #include <linux/types.h> 52a186721SChristian Brauner 6e262e32dSDavid Howells /* 7e262e32dSDavid Howells * These are the fs-independent mount-flags: up to 32 flags are supported 8e262e32dSDavid Howells * 9e262e32dSDavid Howells * Usage of these is restricted within the kernel to core mount(2) code and 10e262e32dSDavid Howells * callers of sys_mount() only. Filesystems should be using the SB_* 11e262e32dSDavid Howells * equivalent instead. 12e262e32dSDavid Howells */ 13e262e32dSDavid Howells #define MS_RDONLY 1 /* Mount read-only */ 14e262e32dSDavid Howells #define MS_NOSUID 2 /* Ignore suid and sgid bits */ 15e262e32dSDavid Howells #define MS_NODEV 4 /* Disallow access to device special files */ 16e262e32dSDavid Howells #define MS_NOEXEC 8 /* Disallow program execution */ 17e262e32dSDavid Howells #define MS_SYNCHRONOUS 16 /* Writes are synced at once */ 18e262e32dSDavid Howells #define MS_REMOUNT 32 /* Alter flags of a mounted FS */ 19e262e32dSDavid Howells #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ 20e262e32dSDavid Howells #define MS_DIRSYNC 128 /* Directory modifications are synchronous */ 21dab741e0SMattias Nissler #define MS_NOSYMFOLLOW 256 /* Do not follow symlinks */ 22e262e32dSDavid Howells #define MS_NOATIME 1024 /* Do not update access times. */ 23e262e32dSDavid Howells #define MS_NODIRATIME 2048 /* Do not update directory access times */ 24e262e32dSDavid Howells #define MS_BIND 4096 25e262e32dSDavid Howells #define MS_MOVE 8192 26e262e32dSDavid Howells #define MS_REC 16384 27e262e32dSDavid Howells #define MS_VERBOSE 32768 /* War is peace. Verbosity is silence. 28e262e32dSDavid Howells MS_VERBOSE is deprecated. */ 29e262e32dSDavid Howells #define MS_SILENT 32768 30e262e32dSDavid Howells #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ 31e262e32dSDavid Howells #define MS_UNBINDABLE (1<<17) /* change to unbindable */ 32e262e32dSDavid Howells #define MS_PRIVATE (1<<18) /* change to private */ 33e262e32dSDavid Howells #define MS_SLAVE (1<<19) /* change to slave */ 34e262e32dSDavid Howells #define MS_SHARED (1<<20) /* change to shared */ 35e262e32dSDavid Howells #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ 36e262e32dSDavid Howells #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 37e262e32dSDavid Howells #define MS_I_VERSION (1<<23) /* Update inode I_version field */ 38e262e32dSDavid Howells #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 39e262e32dSDavid Howells #define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ 40e262e32dSDavid Howells 41e262e32dSDavid Howells /* These sb flags are internal to the kernel */ 42e262e32dSDavid Howells #define MS_SUBMOUNT (1<<26) 43e262e32dSDavid Howells #define MS_NOREMOTELOCK (1<<27) 44e262e32dSDavid Howells #define MS_NOSEC (1<<28) 45e262e32dSDavid Howells #define MS_BORN (1<<29) 46e262e32dSDavid Howells #define MS_ACTIVE (1<<30) 47e262e32dSDavid Howells #define MS_NOUSER (1<<31) 48e262e32dSDavid Howells 49e262e32dSDavid Howells /* 50e262e32dSDavid Howells * Superblock flags that can be altered by MS_REMOUNT 51e262e32dSDavid Howells */ 52e262e32dSDavid Howells #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\ 53e262e32dSDavid Howells MS_LAZYTIME) 54e262e32dSDavid Howells 55e262e32dSDavid Howells /* 56e262e32dSDavid Howells * Old magic mount flag and mask 57e262e32dSDavid Howells */ 58e262e32dSDavid Howells #define MS_MGC_VAL 0xC0ED0000 59e262e32dSDavid Howells #define MS_MGC_MSK 0xffff0000 60e262e32dSDavid Howells 61a07b2000SAl Viro /* 62a07b2000SAl Viro * open_tree() flags. 63a07b2000SAl Viro */ 64a07b2000SAl Viro #define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ 65a07b2000SAl Viro #define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ 66a07b2000SAl Viro 672db154b3SDavid Howells /* 682db154b3SDavid Howells * move_mount() flags. 692db154b3SDavid Howells */ 702db154b3SDavid Howells #define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */ 712db154b3SDavid Howells #define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */ 722db154b3SDavid Howells #define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */ 732db154b3SDavid Howells #define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */ 742db154b3SDavid Howells #define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */ 752db154b3SDavid Howells #define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */ 769ffb14efSPavel Tikhomirov #define MOVE_MOUNT_SET_GROUP 0x00000100 /* Set sharing group instead */ 776ac39281SChristian Brauner #define MOVE_MOUNT_BENEATH 0x00000200 /* Mount beneath top mount */ 786ac39281SChristian Brauner #define MOVE_MOUNT__MASK 0x00000377 792db154b3SDavid Howells 8024dcb3d9SDavid Howells /* 8124dcb3d9SDavid Howells * fsopen() flags. 8224dcb3d9SDavid Howells */ 8324dcb3d9SDavid Howells #define FSOPEN_CLOEXEC 0x00000001 8424dcb3d9SDavid Howells 85ecdab150SDavid Howells /* 86cf3cba4aSDavid Howells * fspick() flags. 87cf3cba4aSDavid Howells */ 88cf3cba4aSDavid Howells #define FSPICK_CLOEXEC 0x00000001 89cf3cba4aSDavid Howells #define FSPICK_SYMLINK_NOFOLLOW 0x00000002 90cf3cba4aSDavid Howells #define FSPICK_NO_AUTOMOUNT 0x00000004 91cf3cba4aSDavid Howells #define FSPICK_EMPTY_PATH 0x00000008 92cf3cba4aSDavid Howells 93cf3cba4aSDavid Howells /* 94ecdab150SDavid Howells * The type of fsconfig() call made. 95ecdab150SDavid Howells */ 96ecdab150SDavid Howells enum fsconfig_command { 97ecdab150SDavid Howells FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ 98ecdab150SDavid Howells FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ 99ecdab150SDavid Howells FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ 100ecdab150SDavid Howells FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ 101ecdab150SDavid Howells FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ 102ecdab150SDavid Howells FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ 10322ed7ecdSChristian Brauner FSCONFIG_CMD_CREATE = 6, /* Create new or reuse existing superblock */ 104ecdab150SDavid Howells FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ 10522ed7ecdSChristian Brauner FSCONFIG_CMD_CREATE_EXCL = 8, /* Create new superblock, fail if reusing existing superblock */ 106ecdab150SDavid Howells }; 107ecdab150SDavid Howells 10893766fbdSDavid Howells /* 10993766fbdSDavid Howells * fsmount() flags. 11093766fbdSDavid Howells */ 11193766fbdSDavid Howells #define FSMOUNT_CLOEXEC 0x00000001 11293766fbdSDavid Howells 11393766fbdSDavid Howells /* 11493766fbdSDavid Howells * Mount attributes. 11593766fbdSDavid Howells */ 11693766fbdSDavid Howells #define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */ 11793766fbdSDavid Howells #define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */ 11893766fbdSDavid Howells #define MOUNT_ATTR_NODEV 0x00000004 /* Disallow access to device special files */ 11993766fbdSDavid Howells #define MOUNT_ATTR_NOEXEC 0x00000008 /* Disallow program execution */ 12093766fbdSDavid Howells #define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */ 12193766fbdSDavid Howells #define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */ 12293766fbdSDavid Howells #define MOUNT_ATTR_NOATIME 0x00000010 /* - Do not update access times. */ 12393766fbdSDavid Howells #define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */ 12493766fbdSDavid Howells #define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */ 1259caccd41SChristian Brauner #define MOUNT_ATTR_IDMAP 0x00100000 /* Idmap mount to @userns_fd in struct mount_attr. */ 126dd8b477fSChristian Brauner #define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks */ 12793766fbdSDavid Howells 1282a186721SChristian Brauner /* 1292a186721SChristian Brauner * mount_setattr() 1302a186721SChristian Brauner */ 1312a186721SChristian Brauner struct mount_attr { 1322a186721SChristian Brauner __u64 attr_set; 1332a186721SChristian Brauner __u64 attr_clr; 1342a186721SChristian Brauner __u64 propagation; 1352a186721SChristian Brauner __u64 userns_fd; 1362a186721SChristian Brauner }; 1372a186721SChristian Brauner 1382a186721SChristian Brauner /* List of all mount_attr versions. */ 1392a186721SChristian Brauner #define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */ 1402a186721SChristian Brauner 14146eae99eSMiklos Szeredi 14246eae99eSMiklos Szeredi /* 14346eae99eSMiklos Szeredi * Structure for getting mount/superblock/filesystem info with statmount(2). 14446eae99eSMiklos Szeredi * 14546eae99eSMiklos Szeredi * The interface is similar to statx(2): individual fields or groups can be 14646eae99eSMiklos Szeredi * selected with the @mask argument of statmount(). Kernel will set the @mask 14746eae99eSMiklos Szeredi * field according to the supported fields. 14846eae99eSMiklos Szeredi * 14946eae99eSMiklos Szeredi * If string fields are selected, then the caller needs to pass a buffer that 15046eae99eSMiklos Szeredi * has space after the fixed part of the structure. Nul terminated strings are 15146eae99eSMiklos Szeredi * copied there and offsets relative to @str are stored in the relevant fields. 15246eae99eSMiklos Szeredi * If the buffer is too small, then EOVERFLOW is returned. The actually used 15346eae99eSMiklos Szeredi * size is returned in @size. 15446eae99eSMiklos Szeredi */ 15546eae99eSMiklos Szeredi struct statmount { 15646eae99eSMiklos Szeredi __u32 size; /* Total size, including strings */ 1572f4d4503SMiklos Szeredi __u32 mnt_opts; /* [str] Options (comma separated, escaped) */ 15846eae99eSMiklos Szeredi __u64 mask; /* What results were written */ 15946eae99eSMiklos Szeredi __u32 sb_dev_major; /* Device ID */ 16046eae99eSMiklos Szeredi __u32 sb_dev_minor; 16146eae99eSMiklos Szeredi __u64 sb_magic; /* ..._SUPER_MAGIC */ 16246eae99eSMiklos Szeredi __u32 sb_flags; /* SB_{RDONLY,SYNCHRONOUS,DIRSYNC,LAZYTIME} */ 16346eae99eSMiklos Szeredi __u32 fs_type; /* [str] Filesystem type */ 16446eae99eSMiklos Szeredi __u64 mnt_id; /* Unique ID of mount */ 16546eae99eSMiklos Szeredi __u64 mnt_parent_id; /* Unique ID of parent (for root == mnt_id) */ 16646eae99eSMiklos Szeredi __u32 mnt_id_old; /* Reused IDs used in proc/.../mountinfo */ 16746eae99eSMiklos Szeredi __u32 mnt_parent_id_old; 16846eae99eSMiklos Szeredi __u64 mnt_attr; /* MOUNT_ATTR_... */ 16946eae99eSMiklos Szeredi __u64 mnt_propagation; /* MS_{SHARED,SLAVE,PRIVATE,UNBINDABLE} */ 17046eae99eSMiklos Szeredi __u64 mnt_peer_group; /* ID of shared peer group */ 17146eae99eSMiklos Szeredi __u64 mnt_master; /* Mount receives propagation from this ID */ 17246eae99eSMiklos Szeredi __u64 propagate_from; /* Propagation from in current namespace */ 17346eae99eSMiklos Szeredi __u32 mnt_root; /* [str] Root of mount relative to root of fs */ 17446eae99eSMiklos Szeredi __u32 mnt_point; /* [str] Mountpoint relative to current root */ 17509b31295SJosef Bacik __u64 mnt_ns_id; /* ID of the mount namespace */ 176ed9d95f6SJeff Layton __u32 fs_subtype; /* [str] Subtype of fs_type (if any) */ 17744010543SJeff Layton __u32 sb_source; /* [str] Source string of the mount */ 1782f4d4503SMiklos Szeredi __u32 opt_num; /* Number of fs options */ 1792f4d4503SMiklos Szeredi __u32 opt_array; /* [str] Array of nul terminated fs options */ 180aefff51eSChristian Brauner __u32 opt_sec_num; /* Number of security options */ 181aefff51eSChristian Brauner __u32 opt_sec_array; /* [str] Array of nul terminated security options */ 182*8f6116b5SJeff Layton __u64 supported_mask; /* Mask flags that this kernel supports */ 183*8f6116b5SJeff Layton __u32 mnt_uidmap_num; /* Number of uid mappings */ 18446eae99eSMiklos Szeredi __u32 mnt_uidmap; /* [str] Array of uid mappings (as seen from callers namespace) */ 18546eae99eSMiklos Szeredi __u32 mnt_gidmap_num; /* Number of gid mappings */ 18646eae99eSMiklos Szeredi __u32 mnt_gidmap; /* [str] Array of gid mappings (as seen from callers namespace) */ 187b4c2bea8SMiklos Szeredi __u64 __spare2[43]; 188b4c2bea8SMiklos Szeredi char str[]; /* Variable size part containing strings */ 189b4c2bea8SMiklos Szeredi }; 190b4c2bea8SMiklos Szeredi 191b4c2bea8SMiklos Szeredi /* 192b4c2bea8SMiklos Szeredi * Structure for passing mount ID and miscellaneous parameters to statmount(2) 193b4c2bea8SMiklos Szeredi * and listmount(2). 19446eae99eSMiklos Szeredi * 19535e27a57SChristian Brauner * For statmount(2) @param represents the request mask. 19635e27a57SChristian Brauner * For listmount(2) @param represents the last listed mount id (or zero). 19746eae99eSMiklos Szeredi */ 198b4c2bea8SMiklos Szeredi struct mnt_id_req { 1990a3deb11SChristian Brauner __u32 size; 20046eae99eSMiklos Szeredi __u32 spare; 20146eae99eSMiklos Szeredi __u64 mnt_id; 20235e27a57SChristian Brauner __u64 param; 20335e27a57SChristian Brauner __u64 mnt_ns_id; 2040a3deb11SChristian Brauner }; 20535e27a57SChristian Brauner 20646eae99eSMiklos Szeredi /* List of all mnt_id_req versions. */ 20746eae99eSMiklos Szeredi #define MNT_ID_REQ_SIZE_VER0 24 /* sizeof first published struct */ 20846eae99eSMiklos Szeredi #define MNT_ID_REQ_SIZE_VER1 32 /* sizeof second published struct */ 20946eae99eSMiklos Szeredi 21046eae99eSMiklos Szeredi /* 21146eae99eSMiklos Szeredi * @mask bits for statmount(2) 21246eae99eSMiklos Szeredi */ 21346eae99eSMiklos Szeredi #define STATMOUNT_SB_BASIC 0x00000001U /* Want/got sb_... */ 21446eae99eSMiklos Szeredi #define STATMOUNT_MNT_BASIC 0x00000002U /* Want/got mnt_... */ 21509b31295SJosef Bacik #define STATMOUNT_PROPAGATE_FROM 0x00000004U /* Want/got propagate_from */ 216f9af549dSJosef Bacik #define STATMOUNT_MNT_ROOT 0x00000008U /* Want/got mnt_root */ 217ed9d95f6SJeff Layton #define STATMOUNT_MNT_POINT 0x00000010U /* Want/got mnt_point */ 21844010543SJeff Layton #define STATMOUNT_FS_TYPE 0x00000020U /* Want/got fs_type */ 2192f4d4503SMiklos Szeredi #define STATMOUNT_MNT_NS_ID 0x00000040U /* Want/got mnt_ns_id */ 220aefff51eSChristian Brauner #define STATMOUNT_MNT_OPTS 0x00000080U /* Want/got mnt_opts */ 221*8f6116b5SJeff Layton #define STATMOUNT_FS_SUBTYPE 0x00000100U /* Want/got fs_subtype */ 22246eae99eSMiklos Szeredi #define STATMOUNT_SB_SOURCE 0x00000200U /* Want/got sb_source */ 223b4c2bea8SMiklos Szeredi #define STATMOUNT_OPT_ARRAY 0x00000400U /* Want/got opt_... */ 224b4c2bea8SMiklos Szeredi #define STATMOUNT_OPT_SEC_ARRAY 0x00000800U /* Want/got opt_sec... */ 225b4c2bea8SMiklos Szeredi #define STATMOUNT_SUPPORTED_MASK 0x00001000U /* Want/got supported mask flags */ 226b4c2bea8SMiklos Szeredi #define STATMOUNT_MNT_UIDMAP 0x00002000U /* Want/got uidmap... */ 227d04bccd8SChristian Brauner #define STATMOUNT_MNT_GIDMAP 0x00004000U /* Want/got gidmap... */ 228b4c2bea8SMiklos Szeredi 229e262e32dSDavid Howells /* 230 * Special @mnt_id values that can be passed to listmount 231 */ 232 #define LSMT_ROOT 0xffffffffffffffff /* root mount */ 233 #define LISTMOUNT_REVERSE (1 << 0) /* List later mounts first */ 234 235 #endif /* _UAPI_LINUX_MOUNT_H */ 236