From 0a14cc8bcc151e03c8979ed1ff4a3bee9672365b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 9 Dec 2016 15:11:31 +0100 Subject: 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 --- libmount/src/context.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libmount/src/context.c') 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[=] specified */ +/* create a mountpoint if X-mount.mkdir[=] 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) -- cgit v1.2.3-55-g7522