summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src
diff options
context:
space:
mode:
authorKarel Zak2010-07-09 11:15:08 +0200
committerKarel Zak2011-01-03 12:28:39 +0100
commit0b3953a33d492336a6d9aa8f7ef200e6dc262281 (patch)
treece28b76c58a180af280eaecd72e36c53510f4a56 /shlibs/mount/src
parentfindmnt: add /etc/fstab.d support (diff)
downloadkernel-qcow2-util-linux-0b3953a33d492336a6d9aa8f7ef200e6dc262281.tar.gz
kernel-qcow2-util-linux-0b3953a33d492336a6d9aa8f7ef200e6dc262281.tar.xz
kernel-qcow2-util-linux-0b3953a33d492336a6d9aa8f7ef200e6dc262281.zip
libmount: add mnt_fs_get_root()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src')
-rw-r--r--shlibs/mount/src/fs.c16
-rw-r--r--shlibs/mount/src/mount.h.in2
-rw-r--r--shlibs/mount/src/mount.sym6
-rw-r--r--shlibs/mount/src/mountP.h2
-rw-r--r--shlibs/mount/src/tab_parse.c4
5 files changed, 24 insertions, 6 deletions
diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c
index 63da2f206..c8677c702 100644
--- a/shlibs/mount/src/fs.c
+++ b/shlibs/mount/src/fs.c
@@ -51,7 +51,7 @@ void mnt_free_fs(mnt_fs *fs)
free(fs->source);
free(fs->tagname);
free(fs->tagval);
- free(fs->mntroot);
+ free(fs->root);
free(fs->target);
free(fs->fstype);
free(fs->optstr);
@@ -448,6 +448,18 @@ int mnt_fs_set_passno(mnt_fs *fs, int passno)
}
/**
+ * mnt_fs_get_root:
+ * @fs: /proc/self/mountinfo entry
+ *
+ * Returns: root of the mount within the filesystem or NULL
+ */
+const char *mnt_fs_get_root(mnt_fs *fs)
+{
+ assert(fs);
+ return fs ? fs->root : NULL;
+}
+
+/**
* mnt_fs_get_id:
* @fs: /proc/self/mountinfo entry
*
@@ -475,7 +487,7 @@ int mnt_fs_get_parent_id(mnt_fs *fs)
/**
* mnt_fs_get_devno:
- * @fs: /proc/self/mountinfo
+ * @fs: /proc/self/mountinfo entry
*
* Returns: value of st_dev for files on filesystem or 0 in case of error.
*/
diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in
index 6e76ddb28..d42ab1d62 100644
--- a/shlibs/mount/src/mount.h.in
+++ b/shlibs/mount/src/mount.h.in
@@ -31,7 +31,6 @@ extern "C" {
#include <stdio.h>
-
#define LIBMOUNT_VERSION "@LIBMOUNT_VERSION@"
/**
@@ -236,6 +235,7 @@ extern int mnt_fs_get_freq(mnt_fs *ent);
extern int mnt_fs_set_freq(mnt_fs *ent, int freq);
extern int mnt_fs_get_passno(mnt_fs *ent);
extern int mnt_fs_set_passno(mnt_fs *ent, int passno);
+extern const char *mnt_fs_get_root(mnt_fs *fs);
extern int mnt_fs_get_id(mnt_fs *fs);
extern int mnt_fs_get_parent_id(mnt_fs *fs);
extern dev_t mnt_fs_get_devno(mnt_fs *fs);
diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym
index f3c10689a..c4aa8e4f9 100644
--- a/shlibs/mount/src/mount.sym
+++ b/shlibs/mount/src/mount.sym
@@ -133,3 +133,9 @@ global:
local:
*;
};
+
+
+MOUNT_2.19 {
+global:
+ mnt_fs_get_root;
+} MOUNT_2.18;
diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h
index d217e3da3..04084e5d1 100644
--- a/shlibs/mount/src/mountP.h
+++ b/shlibs/mount/src/mountP.h
@@ -133,7 +133,7 @@ struct _mnt_fs {
char *tagname; /* fstab[1]: tag name - "LABEL", "UUID", ..*/
char *tagval; /* tag value */
- char *mntroot; /* mountinfo[4]: root of the mount within the FS */
+ char *root; /* mountinfo[4]: root of the mount within the FS */
char *target; /* mountinfo[5], fstab[2]: mountpoint */
char *fstype; /* mountinfo[9], fstab[3]: filesystem type */
diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c
index e7cc7ef49..06bb64862 100644
--- a/shlibs/mount/src/tab_parse.c
+++ b/shlibs/mount/src/tab_parse.c
@@ -168,8 +168,8 @@ static int mnt_parse_mountinfo_line(mnt_fs *fs, char *s)
next_word_skip(&s);
/* MOUNTROOT */
- fs->mntroot = next_word(&s);
- if (!fs->mntroot)
+ fs->root = next_word(&s);
+ if (!fs->root)
return 1;
/* TARGET (mountpoit) */