]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: introduce X-* comments
authorKarel Zak <kzak@redhat.com>
Thu, 8 Dec 2016 13:55:02 +0000 (14:55 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 8 Dec 2016 13:55:02 +0000 (14:55 +0100)
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>
libmount/src/libmount.h.in
libmount/src/optmap.c
sys-utils/mount.8

index 86ff150c1a715f3b0375db4af5fda42ac7c5db68..cbd4f000e4b12d99d2e0e427878db25fabe02753 100644 (file)
@@ -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)
index f827e04f5a838387b6005760f653adee9927bbe3..6fdaa7a414144d2bc38aa3c189b781080065b28d 100644 (file)
@@ -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 */
index 9f7dbde837f6406a257d073cdbc62cc2871ead01..7f45ca7db37f65d7d8c3c0bc6be41e32702b3139 100644 (file)
@@ -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