summaryrefslogtreecommitdiffstats
path: root/libmount
diff options
context:
space:
mode:
authorKarel Zak2012-04-17 11:36:32 +0200
committerKarel Zak2012-04-17 11:36:32 +0200
commite01c7319929879d91ab6366a145936eb73c6126e (patch)
tree2f1e2bc21b7a725bbf1ed1dcfc332fd647ae5e89 /libmount
parentwdctl: add watchdog status tool (diff)
downloadkernel-qcow2-util-linux-e01c7319929879d91ab6366a145936eb73c6126e.tar.gz
kernel-qcow2-util-linux-e01c7319929879d91ab6366a145936eb73c6126e.tar.xz
kernel-qcow2-util-linux-e01c7319929879d91ab6366a145936eb73c6126e.zip
libmount: add mnt_context_fstab_applied()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount')
-rw-r--r--libmount/docs/libmount-sections.txt1
-rw-r--r--libmount/src/context.c13
-rw-r--r--libmount/src/libmount.h.in2
-rw-r--r--libmount/src/libmount.sym1
4 files changed, 16 insertions, 1 deletions
diff --git a/libmount/docs/libmount-sections.txt b/libmount/docs/libmount-sections.txt
index c5173ccd1..7610be99d 100644
--- a/libmount/docs/libmount-sections.txt
+++ b/libmount/docs/libmount-sections.txt
@@ -21,6 +21,7 @@ mnt_new_context
mnt_reset_context
mnt_context_append_options
mnt_context_apply_fstab
+mnt_context_fstab_applied
mnt_context_disable_canonicalize
mnt_context_disable_helpers
mnt_context_disable_mtab
diff --git a/libmount/src/context.c b/libmount/src/context.c
index a9ff91091..fe5c3f4bb 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -1670,7 +1670,7 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
if (!cxt)
return -EINVAL;
- if (cxt->flags & MNT_FL_TAB_APPLIED)
+ if (mnt_context_fstab_applied(cxt))
return 0;
if (mnt_context_is_restricted(cxt)) {
@@ -1740,6 +1740,17 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
}
/**
+ * mnt_context_fstab_applied:
+ * @cxt: mount context
+ *
+ * Returns: 1 if fstab (or mtab) has been applied to the context, or 0.
+ */
+int mnt_context_fstab_applied(struct libmnt_context *cxt)
+{
+ return cxt && (cxt->flags & MNT_FL_TAB_APPLIED);
+}
+
+/**
* mnt_context_get_status:
* @cxt: mount context
*
diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in
index a3eaa9ea6..245431f27 100644
--- a/libmount/src/libmount.h.in
+++ b/libmount/src/libmount.h.in
@@ -511,6 +511,8 @@ extern int mnt_context_prepare_umount(struct libmnt_context *cxt);
extern int mnt_context_do_umount(struct libmnt_context *cxt);
extern int mnt_context_finalize_umount(struct libmnt_context *cxt);
+
+extern int mnt_context_fstab_applied(struct libmnt_context *cxt);
extern int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status);
/*
diff --git a/libmount/src/libmount.sym b/libmount/src/libmount.sym
index c09f6ce2a..c48b16248 100644
--- a/libmount/src/libmount.sym
+++ b/libmount/src/libmount.sym
@@ -230,6 +230,7 @@ MOUNT_2.22 {
global:
mnt_fs_streq_target;
mnt_fs_streq_srcpath;
+ mnt_context_fstab_applied;
mnt_context_is_loopdel;
mnt_context_is_nocanonicalize;
mnt_context_is_nohelpers;