summaryrefslogtreecommitdiffstats
path: root/libmount/src
diff options
context:
space:
mode:
authorKarel Zak2016-12-09 15:11:31 +0100
committerKarel Zak2016-12-09 15:36:14 +0100
commit0a14cc8bcc151e03c8979ed1ff4a3bee9672365b (patch)
tree5f72c2484435b556ddec93bd162e9e5f5dedbd9d /libmount/src
parentMerge branch doc_fixes (diff)
downloadkernel-qcow2-util-linux-0a14cc8bcc151e03c8979ed1ff4a3bee9672365b.tar.gz
kernel-qcow2-util-linux-0a14cc8bcc151e03c8979ed1ff4a3bee9672365b.tar.xz
kernel-qcow2-util-linux-0a14cc8bcc151e03c8979ed1ff4a3bee9672365b.zip
libmount: revert X-* and x-* meaning
Let's hope this is last change necessary to cleanup x-* usage: x-* persistent option, stored in utab, available for umount, etc. X-* fstab comment only mount(8) supports x-mount.mkdir= as well as newly recommended X-mount.mkdir= Advantages: * less invasive * does not require exception for x-systemd * does not require rename x-initrd to X-initrd The systemd and dracut users will get the new (=fixed) functionality without a change in fstab configuration. This is the primary goal. Disadvantages: * not 100% compatible libmount behavior, x-* options have not been previously stored in utab. The API is the same, options will be still available, but on x-* libmount will write to /run/mount/utab. For now it seems only systemd uses x-*, and they like this behavior, so... Addresses: https://github.com/systemd/systemd/pull/4515 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
-rw-r--r--libmount/src/context.c11
-rw-r--r--libmount/src/libmount.h.in2
-rw-r--r--libmount/src/optmap.c11
3 files changed, 11 insertions, 13 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c
index 87ccccfc6..44282c07b 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -1531,7 +1531,7 @@ int mnt_context_prepare_srcpath(struct libmnt_context *cxt)
return 0;
}
-/* create a mountpoint if x-mount.mkdir[=<mode>] specified */
+/* create a mountpoint if X-mount.mkdir[=<mode>] specified */
static int mkdir_target(const char *tgt, struct libmnt_fs *fs)
{
char *mstr = NULL;
@@ -1543,8 +1543,12 @@ static int mkdir_target(const char *tgt, struct libmnt_fs *fs)
assert(tgt);
assert(fs);
- if (mnt_optstr_get_option(fs->user_optstr, "x-mount.mkdir", &mstr, &mstr_sz) != 0)
+ if (mnt_optstr_get_option(fs->user_optstr, "X-mount.mkdir", &mstr, &mstr_sz) != 0 &&
+ mnt_optstr_get_option(fs->user_optstr, "x-mount.mkdir", &mstr, &mstr_sz) != 0) /* obsolete */
return 0;
+
+ DBG(CXT, ul_debug("mkdir %s (%s) wanted", tgt, mstr));
+
if (mnt_stat_mountpoint(tgt, &st) == 0)
return 0;
@@ -1591,7 +1595,8 @@ int mnt_context_prepare_target(struct libmnt_context *cxt)
/* mkdir target */
if (cxt->action == MNT_ACT_MOUNT
&& !mnt_context_is_restricted(cxt)
- && cxt->user_mountflags & MNT_MS_XCOMMENT) {
+ && (cxt->user_mountflags & MNT_MS_XCOMMENT ||
+ cxt->user_mountflags & MNT_MS_XFSTABCOMM)) {
rc = mkdir_target(tgt, cxt->fs);
if (rc)
diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in
index cbd4f000e..f191a52fe 100644
--- a/libmount/src/libmount.h.in
+++ b/libmount/src/libmount.h.in
@@ -774,7 +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)
+#define MNT_MS_XFSTABCOMM (1 << 17)
/*
* mount(2) MS_* masks (MNT_MAP_LINUX map)
diff --git a/libmount/src/optmap.c b/libmount/src/optmap.c
index 114eb994e..0aa285f93 100644
--- a/libmount/src/optmap.c
+++ b/libmount/src/optmap.c
@@ -160,15 +160,8 @@ static const struct libmnt_optmap userspace_opts_map[] =
{ "comment=", MNT_MS_COMMENT, MNT_NOHLPS | MNT_NOMTAB },/* fstab comment only */
- /*
- * systemd assumes that x-systemd options namespace is available for umount,
- * let's use the options as X-*
- */
-#ifdef HAVE_SYSTEMD
- { "x-systemd", MNT_MS_XPERSIST, MNT_NOHLPS | MNT_PREFIX }, /* like X-* */
-#endif
- { "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 */
+ { "x-", MNT_MS_XCOMMENT, MNT_NOHLPS | MNT_PREFIX }, /* persistent comments (utab) */
+ { "X-", MNT_MS_XFSTABCOMM, MNT_NOHLPS | MNT_NOMTAB | MNT_PREFIX }, /* fstab only comments */
{ "loop[=]", MNT_MS_LOOP, MNT_NOHLPS }, /* use the loop device */
{ "offset=", MNT_MS_OFFSET, MNT_NOHLPS | MNT_NOMTAB }, /* loop device offset */