summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shlibs/mount/src/context.c4
-rw-r--r--shlibs/mount/src/fs.c4
-rw-r--r--shlibs/mount/src/libmount.h.in2
-rw-r--r--shlibs/mount/src/mountP.h8
-rw-r--r--shlibs/mount/src/tab_parse.c4
-rw-r--r--shlibs/mount/src/tab_update.c6
-rw-r--r--shlibs/mount/src/utils.c16
7 files changed, 28 insertions, 16 deletions
diff --git a/shlibs/mount/src/context.c b/shlibs/mount/src/context.c
index f24e90ebb..eedb82345 100644
--- a/shlibs/mount/src/context.c
+++ b/shlibs/mount/src/context.c
@@ -71,7 +71,7 @@ struct libmnt_context *mnt_new_context(void)
mnt_has_regular_mtab(&cxt->mtab_path, &cxt->mtab_writable);
if (!cxt->mtab_writable)
- /* use /dev/.mount/utab if /etc/mtab is useless */
+ /* use /run/mount/utab if /etc/mtab is useless */
mnt_has_regular_utab(&cxt->utab_path, &cxt->utab_writable);
return cxt;
@@ -1228,7 +1228,7 @@ int mnt_context_merge_mflags(struct libmnt_context *cxt)
}
/*
- * Prepare /etc/mtab or /dev/.mount/utab
+ * Prepare /etc/mtab or /run/mount/utab
*/
int mnt_context_prepare_update(struct libmnt_context *cxt)
{
diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c
index 75ec4b476..c7a4fce02 100644
--- a/shlibs/mount/src/fs.c
+++ b/shlibs/mount/src/fs.c
@@ -796,7 +796,7 @@ const char *mnt_fs_get_attributes(struct libmnt_fs *fs)
*
* Sets mount attributes. The attributes are mount(2) and mount(8) independent
* options, these options are not send to kernel and are not interpreted by
- * libmount. The attributes are stored in /dev/.mount/utab only.
+ * libmount. The attributes are stored in /run/mount/utab only.
*
* The atrtributes are managed by libmount in userspace only. It's possible
* that information stored in userspace will not be available for libmount
@@ -952,7 +952,7 @@ int mnt_fs_set_root(struct libmnt_fs *fs, const char *root)
/**
* mnt_fs_get_bindsrc:
- * @fs: /dev/.mount/utab entry
+ * @fs: /run/mount/utab entry
*
* Returns: full path that was used for mount(2) on MS_BIND
*/
diff --git a/shlibs/mount/src/libmount.h.in b/shlibs/mount/src/libmount.h.in
index 613822468..173872699 100644
--- a/shlibs/mount/src/libmount.h.in
+++ b/shlibs/mount/src/libmount.h.in
@@ -91,7 +91,7 @@ struct libmnt_table;
/**
* libmnt_update
*
- * /etc/mtab or /dev/.mount/utab update description
+ * /etc/mtab or utab update description
*/
struct libmnt_update;
diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h
index 00ca8875f..a72c2560d 100644
--- a/shlibs/mount/src/mountP.h
+++ b/shlibs/mount/src/mountP.h
@@ -92,7 +92,11 @@ mnt_debug_h(void *handler, const char *mesg, ...)
#define MNT_MNTTABDIR_EXT ".fstab"
/* library private paths */
-#define MNT_PATH_UTAB "/dev/.mount/utab"
+#define MNT_RUNTIME_TOPDIR "/run"
+#define MNT_RUNTIME_TOPDIR_OLD "/dev"
+
+#define MNT_PATH_UTAB MNT_RUNTIME_TOPDIR "/mount/utab"
+#define MNT_PATH_UTAB_OLD MNT_RUNTIME_TOPDIR_OLD "/.mount/utab"
#define MNT_UTAB_HEADER "# libmount utab file\n"
@@ -196,7 +200,7 @@ struct libmnt_fs {
#define MNT_FS_NET (1 << 2) /* network filesystem */
#define MNT_FS_SWAP (1 << 3) /* swap device */
#define MNT_FS_KERNEL (1 << 4) /* data from /proc/{mounts,self/mountinfo} */
-#define MNT_FS_MERGED (1 << 5) /* already merged data from /dev/.mount/utab */
+#define MNT_FS_MERGED (1 << 5) /* already merged data from /run/mount/utab */
extern int __mnt_fs_get_flags(struct libmnt_fs *fs);
extern int __mnt_fs_set_flags(struct libmnt_fs *fs, int flags);
diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c
index 43a2bf192..1bf88db56 100644
--- a/shlibs/mount/src/tab_parse.c
+++ b/shlibs/mount/src/tab_parse.c
@@ -673,7 +673,7 @@ static struct libmnt_fs *mnt_table_merge_user_fs(struct libmnt_table *tb, struct
* @filename: overwrites default (/etc/mtab or $LIBMOUNT_MTAB) or NULL
*
* This function parses /etc/mtab or /proc/self/mountinfo +
- * /dev/.mount/utabs or /proc/mounts.
+ * /run/mount/utabs or /proc/mounts.
*
* See also mnt_table_set_parser_errcb().
*
@@ -707,7 +707,7 @@ int mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename)
}
/*
- * try to read user specific information from /dev/.mount/utabs
+ * try to read user specific information from /run/mount/utabs
*/
utab = mnt_get_utab_path();
if (utab) {
diff --git a/shlibs/mount/src/tab_update.c b/shlibs/mount/src/tab_update.c
index 71988f8a8..409568f91 100644
--- a/shlibs/mount/src/tab_update.c
+++ b/shlibs/mount/src/tab_update.c
@@ -13,7 +13,7 @@
* The struct libmnt_update provides abstraction to manage mount options in userspace independently on
* system configuration. This low-level API works on system with and without /etc/mtab. On
* systems without the regular /etc/mtab file are userspace mount options (e.g. user=)
- * stored to the /dev/.mount/utab file.
+ * stored to the /run/mount/utab file.
*
* It's recommended to use high-level struct libmnt_context API.
*/
@@ -107,7 +107,7 @@ int mnt_update_set_filename(struct libmnt_update *upd, const char *filename,
if (upd->filename)
return 0;
- /* detect tab filename -- /etc/mtab or /dev/.mount/utab
+ /* detect tab filename -- /etc/mtab or /run/mount/utab
*/
mnt_has_regular_mtab(&path, &rw);
if (!rw) {
@@ -784,7 +784,7 @@ static int update_modify_options(struct libmnt_update *upd, struct libmnt_lock *
* @upd: update
* @lc: lock or NULL
*
- * High-level API to update /etc/mtab (or private /dev/.mount/utab file).
+ * High-level API to update /etc/mtab (or private /run/mount/utab file).
*
* The @lc lock is optional and will be created if necessary. Note that
* the automatically created lock blocks all signals.
diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c
index 27832b36a..8f0e49c9b 100644
--- a/shlibs/mount/src/utils.c
+++ b/shlibs/mount/src/utils.c
@@ -600,9 +600,9 @@ done:
* Don't export this to libmount API -- utab is private library stuff.
*
* If the file does not exist and @writable argument is not NULL then it will
- * try to create the directory (e.g. /dev/.mount) and the file.
+ * try to create the directory (e.g. /run/mount) and the file.
*
- * Returns: 1 if /dev/.mount/utab is a regular file, and 0 in case of
+ * Returns: 1 if utab is a regular file, and 0 in case of
* error (check errno for more details).
*/
int mnt_has_regular_utab(const char **utab, int *writable)
@@ -682,12 +682,20 @@ const char *mnt_get_mtab_path(void)
/*
* Don't export this to libmount API -- utab is private library stuff.
*
- * Returns: path to /dev/.mount/utab or $LIBMOUNT_UTAB.
+ * Returns: path to /run/mount/utab (or /dev/.mount/utab) or $LIBMOUNT_UTAB.
*/
const char *mnt_get_utab_path(void)
{
+ struct stat st;
const char *p = safe_getenv("LIBMOUNT_UTAB");
- return p ? : MNT_PATH_UTAB;
+
+ if (p)
+ return p;
+
+ if (stat(MNT_RUNTIME_TOPDIR, &st) == 0)
+ return MNT_PATH_UTAB;
+
+ return MNT_PATH_UTAB_OLD;
}