[AC_MSG_ERROR([systemd expected but libsystemd not found])],
[*:yes],
AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Define if libsystemd is available])
- AC_DEFINE([HAVE_SYSTEMD], [1], [Define if systemd should be supported])
)
])
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$have_systemd" = xyes])
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;
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;
/* 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)
#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)
{ "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 */
(unless overridden by subsequent options, as in the option line
.BR users,exec,dev,suid ).
.TP
-.B x-*
-All options prefixed with "x-" are interpreted as comments or as userspace
+.B X-*
+All options prefixed with "X-" are interpreted as comments or as userspace
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.
+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
+.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).
-
-Note that x-systemd mount options are maintained as X-* options, the rename is
-unnecessary to keep existing fstab settings backwardly compatible.
+that maintain mount options in user space is tricky, because it's necessary use
+libmount based tools and there is no guarantee that the options will be always
+available (for example after a move mount operation or in unshared namespace).
+Note that before util-linux v2.30 the x-* options have not been maintained by
+libmount and stored in user space (functionality was the same as have X-* now),
+but due to growing number of use-cases (in initrd, systemd etc.) the
+functionality have been extended to keep existing fstab configurations usable
+without a change.
.TP
-.BR x-mount.mkdir [ = \fImode\fR ]
+.BR X-mount.mkdir [ = \fImode\fR ]
Allow to make a target directory (mountpoint). The optional argument
.I mode
specifies the filesystem access mode used for
.BR mkdir (2)
in octal notation. The default mode is 0755. This functionality is supported
-only for root users.
+only for root users. The option is also supported as x-mount.mkdir, this notation
+is deprecated for mount.mkdir since v2.30.
.SH "FILESYSTEM-SPECIFIC MOUNT OPTIONS"
The following options apply only to certain filesystems.
UUID=$($TS_CMD_UUIDGEN)
MOUNTPOINT="$TS_MOUNTPOINT"
-TS_NOEXIST="$TS_OUTDIR/${TS_TESTNAME}-${TS_SUBNAME}-noex"
-[ -d $TS_NOEXIST ] && rmdir $TS_NOEXIST
-
[ -x $TESTPROG ] || ts_skip "test not compiled"
ts_log "Init device"
ts_finalize_subtest
+# deprecated
ts_init_subtest "x-mount.mkdir"
+TS_NOEXIST="$TS_OUTDIR/${TS_TESTNAME}-${TS_SUBNAME}-noex"
+[ -d $TS_NOEXIST ] && rmdir $TS_NOEXIST
+
$TS_CMD_MOUNT -o x-mount.mkdir --bind $MOUNTPOINT $TS_NOEXIST >> $TS_OUTPUT 2>&1 &&
echo "successfully mounted" >> $TS_OUTPUT
ts_finalize_subtest
$TS_CMD_UMOUNT $TS_NOEXIST
rmdir $TS_NOEXIST
+
+ts_init_subtest "X-mount.mkdir"
+TS_NOEXIST="$TS_OUTDIR/${TS_TESTNAME}-${TS_SUBNAME}-noex"
+[ -d $TS_NOEXIST ] && rmdir $TS_NOEXIST
+
+$TS_CMD_MOUNT -o X-mount.mkdir --bind $MOUNTPOINT $TS_NOEXIST >> $TS_OUTPUT 2>&1 &&
+ echo "successfully mounted" >> $TS_OUTPUT
+ts_finalize_subtest
+
+$TS_CMD_UMOUNT $TS_NOEXIST
+rmdir $TS_NOEXIST
+
ts_log "...done."
ts_finalize