diff options
author | Karel Zak | 2016-12-08 14:55:02 +0100 |
---|---|---|
committer | Karel Zak | 2016-12-08 14:55:02 +0100 |
commit | 83601b1af924a666d86ad956d78e222ad222bea2 (patch) | |
tree | 72480e67259aa21f47eae6302f32323e072ec50e | |
parent | findmnt: add --tree to allow to enable tree output for --mtab (diff) | |
download | kernel-qcow2-util-linux-83601b1af924a666d86ad956d78e222ad222bea2.tar.gz kernel-qcow2-util-linux-83601b1af924a666d86ad956d78e222ad222bea2.tar.xz kernel-qcow2-util-linux-83601b1af924a666d86ad956d78e222ad222bea2.zip |
libmount: introduce X-* comments
x-* are fstab only and not stored in userspace (utab). In some cases
it's not optional solution because the option is also necessary for
umount or another operations. The X-* is exactly the same as x-*, but
stored to utab (or mtab on old systems).
It's usually bad idea to store mount options in userspace, but it's
better to provide any solution that force users to bypass mount(8)
(and friends) and implement 3rd-party incompatible solutions.
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | libmount/src/libmount.h.in | 1 | ||||
-rw-r--r-- | libmount/src/optmap.c | 4 | ||||
-rw-r--r-- | sys-utils/mount.8 | 13 |
3 files changed, 14 insertions, 4 deletions
diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in index 86ff150c1..cbd4f000e 100644 --- a/libmount/src/libmount.h.in +++ b/libmount/src/libmount.h.in @@ -774,6 +774,7 @@ extern int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status #define MNT_MS_OFFSET (1 << 14) #define MNT_MS_SIZELIMIT (1 << 15) #define MNT_MS_ENCRYPTION (1 << 16) +#define MNT_MS_XPERSIST (1 << 17) /* * mount(2) MS_* masks (MNT_MAP_LINUX map) diff --git a/libmount/src/optmap.c b/libmount/src/optmap.c index f827e04f5..6fdaa7a41 100644 --- a/libmount/src/optmap.c +++ b/libmount/src/optmap.c @@ -159,7 +159,9 @@ static const struct libmnt_optmap userspace_opts_map[] = { "_netdev", MNT_MS_NETDEV }, /* Device requires network */ { "comment=", MNT_MS_COMMENT, MNT_NOHLPS | MNT_NOMTAB },/* fstab comment only */ - { "x-", MNT_MS_XCOMMENT, MNT_NOHLPS | MNT_NOMTAB | MNT_PREFIX }, /* x- options */ + + { "X-", MNT_MS_XPERSIST, MNT_NOHLPS | MNT_PREFIX }, /* X- persistent comments (utab) */ + { "x-", MNT_MS_XCOMMENT, MNT_NOHLPS | MNT_NOMTAB | MNT_PREFIX }, /* x- fstab only comments */ { "loop[=]", MNT_MS_LOOP, MNT_NOHLPS }, /* use the loop device */ { "offset=", MNT_MS_OFFSET, MNT_NOHLPS | MNT_NOMTAB }, /* loop device offset */ diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 index 9f7dbde83..7f45ca7db 100644 --- a/sys-utils/mount.8 +++ b/sys-utils/mount.8 @@ -1142,11 +1142,18 @@ This option implies the options .TP .B x-* All options prefixed with "x-" are interpreted as comments or as userspace -application-specific options. These options are not stored in the mtab file, +application-specific options. These options are not stored in the user space (e.g. mtab file), nor sent to the mount.\fItype\fR helpers nor to the .BR mount (2) -system call. The suggested format is \fBx-\fIappname\fR.\fIoption\fR -(e.g.\& \fBx-systemd.automount\fR). +system call. The suggested format is \fBx-\fIappname\fR.\fIoption\fR. +.TP +.B X-* +The same as \fBx-*\fR options, but stored permanently in the user space. It +means the options are also available for umount or another operations. Note +that maintain mount options in user space is a bad idea, because it's necessary +to link all tools that use the options with libmount and there is no guarantee that the +options will be always available (for example after a move mount operation or in +unshared namespace). .TP .BR x-mount.mkdir [ = \fImode\fR ] Allow to make a target directory (mountpoint). The optional argument |