2018-11-02 07:07:23 +08:00
|
|
|
#ifndef _UAPI_LINUX_MOUNT_H
|
|
|
|
#define _UAPI_LINUX_MOUNT_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These are the fs-independent mount-flags: up to 32 flags are supported
|
|
|
|
*
|
|
|
|
* Usage of these is restricted within the kernel to core mount(2) code and
|
|
|
|
* callers of sys_mount() only. Filesystems should be using the SB_*
|
|
|
|
* equivalent instead.
|
|
|
|
*/
|
|
|
|
#define MS_RDONLY 1 /* Mount read-only */
|
|
|
|
#define MS_NOSUID 2 /* Ignore suid and sgid bits */
|
|
|
|
#define MS_NODEV 4 /* Disallow access to device special files */
|
|
|
|
#define MS_NOEXEC 8 /* Disallow program execution */
|
|
|
|
#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
|
|
|
|
#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
|
|
|
|
#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
|
|
|
|
#define MS_DIRSYNC 128 /* Directory modifications are synchronous */
|
|
|
|
#define MS_NOATIME 1024 /* Do not update access times. */
|
|
|
|
#define MS_NODIRATIME 2048 /* Do not update directory access times */
|
|
|
|
#define MS_BIND 4096
|
|
|
|
#define MS_MOVE 8192
|
|
|
|
#define MS_REC 16384
|
|
|
|
#define MS_VERBOSE 32768 /* War is peace. Verbosity is silence.
|
|
|
|
MS_VERBOSE is deprecated. */
|
|
|
|
#define MS_SILENT 32768
|
|
|
|
#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
|
|
|
|
#define MS_UNBINDABLE (1<<17) /* change to unbindable */
|
|
|
|
#define MS_PRIVATE (1<<18) /* change to private */
|
|
|
|
#define MS_SLAVE (1<<19) /* change to slave */
|
|
|
|
#define MS_SHARED (1<<20) /* change to shared */
|
|
|
|
#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
|
|
|
|
#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
|
|
|
|
#define MS_I_VERSION (1<<23) /* Update inode I_version field */
|
|
|
|
#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
|
|
|
|
#define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */
|
|
|
|
|
|
|
|
/* These sb flags are internal to the kernel */
|
|
|
|
#define MS_SUBMOUNT (1<<26)
|
|
|
|
#define MS_NOREMOTELOCK (1<<27)
|
|
|
|
#define MS_NOSEC (1<<28)
|
|
|
|
#define MS_BORN (1<<29)
|
|
|
|
#define MS_ACTIVE (1<<30)
|
|
|
|
#define MS_NOUSER (1<<31)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Superblock flags that can be altered by MS_REMOUNT
|
|
|
|
*/
|
|
|
|
#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\
|
|
|
|
MS_LAZYTIME)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Old magic mount flag and mask
|
|
|
|
*/
|
|
|
|
#define MS_MGC_VAL 0xC0ED0000
|
|
|
|
#define MS_MGC_MSK 0xffff0000
|
|
|
|
|
2018-11-06 01:40:30 +08:00
|
|
|
/*
|
|
|
|
* open_tree() flags.
|
|
|
|
*/
|
|
|
|
#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
|
|
|
|
#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
|
|
|
|
|
2018-11-06 01:40:30 +08:00
|
|
|
/*
|
|
|
|
* move_mount() flags.
|
|
|
|
*/
|
|
|
|
#define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
|
|
|
|
#define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
|
|
|
|
#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
|
|
|
|
#define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */
|
|
|
|
#define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */
|
|
|
|
#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */
|
|
|
|
#define MOVE_MOUNT__MASK 0x00000077
|
|
|
|
|
vfs: syscall: Add fsopen() to prepare for superblock creation
Provide an fsopen() system call that starts the process of preparing to
create a superblock that will then be mountable, using an fd as a context
handle. fsopen() is given the name of the filesystem that will be used:
int mfd = fsopen(const char *fsname, unsigned int flags);
where flags can be 0 or FSOPEN_CLOEXEC.
For example:
sfd = fsopen("ext4", FSOPEN_CLOEXEC);
fsconfig(sfd, FSCONFIG_SET_PATH, "source", "/dev/sda1", AT_FDCWD);
fsconfig(sfd, FSCONFIG_SET_FLAG, "noatime", NULL, 0);
fsconfig(sfd, FSCONFIG_SET_FLAG, "acl", NULL, 0);
fsconfig(sfd, FSCONFIG_SET_FLAG, "user_xattr", NULL, 0);
fsconfig(sfd, FSCONFIG_SET_STRING, "sb", "1", 0);
fsconfig(sfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0);
fsinfo(sfd, NULL, ...); // query new superblock attributes
mfd = fsmount(sfd, FSMOUNT_CLOEXEC, MS_RELATIME);
move_mount(mfd, "", sfd, AT_FDCWD, "/mnt", MOVE_MOUNT_F_EMPTY_PATH);
sfd = fsopen("afs", -1);
fsconfig(fd, FSCONFIG_SET_STRING, "source",
"#grand.central.org:root.cell", 0);
fsconfig(fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0);
mfd = fsmount(sfd, 0, MS_NODEV);
move_mount(mfd, "", sfd, AT_FDCWD, "/mnt", MOVE_MOUNT_F_EMPTY_PATH);
If an error is reported at any step, an error message may be available to be
read() back (ENODATA will be reported if there isn't an error available) in
the form:
"e <subsys>:<problem>"
"e SELinux:Mount on mountpoint not permitted"
Once fsmount() has been called, further fsconfig() calls will incur EBUSY,
even if the fsmount() fails. read() is still possible to retrieve error
information.
The fsopen() syscall creates a mount context and hangs it of the fd that it
returns.
Netlink is not used because it is optional and would make the core VFS
dependent on the networking layer and also potentially add network
namespace issues.
Note that, for the moment, the caller must have SYS_CAP_ADMIN to use
fsopen().
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-api@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2018-11-02 07:33:31 +08:00
|
|
|
/*
|
|
|
|
* fsopen() flags.
|
|
|
|
*/
|
|
|
|
#define FSOPEN_CLOEXEC 0x00000001
|
|
|
|
|
2018-11-02 07:07:23 +08:00
|
|
|
#endif /* _UAPI_LINUX_MOUNT_H */
|