From 68e9d35c5ee534d0834d13e38cbd85fbb59b7828 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 19 Jan 2011 17:22:28 +0100 Subject: libmount: add mnt_context_is_* functions Signed-off-by: Karel Zak --- shlibs/mount/src/context.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 'shlibs/mount/src/context.c') diff --git a/shlibs/mount/src/context.c b/shlibs/mount/src/context.c index 13c5596f8..d71cbb63c 100644 --- a/shlibs/mount/src/context.c +++ b/shlibs/mount/src/context.c @@ -203,6 +203,18 @@ int mnt_context_set_optsmode(mnt_context *cxt, int mode) return 0; } +/** + * mnt_context_get_optsmode + * @cxt: mount context + * + * Returns: MNT_OMASK_* mask or zero. + */ + +int mnt_context_get_optsmode(mnt_context *cxt) +{ + return cxt ? cxt->optsmode : 0; +} + /** * mnt_context_disable_canonicalize: * @cxt: mount context @@ -237,6 +249,18 @@ int mnt_context_enable_lazy(mnt_context *cxt, int enable) return set_flag(cxt, MNT_FL_LAZY, enable); } +/** + * mnt_context_is_lazy: + * @cxt: mount context + * + * Returns: 1 if lazy umount is enabled or 0 + */ +int mnt_context_is_lazy(mnt_context *cxt) +{ + return cxt && (cxt->flags & MNT_FL_LAZY) ? 1 : 0; +} + + /** * mnt_context_enable_rdonly_umount: * @cxt: mount context @@ -252,6 +276,20 @@ int mnt_context_enable_rdonly_umount(mnt_context *cxt, int enable) return set_flag(cxt, MNT_FL_RDONLY_UMOUNT, enable); } +/** + * mnt_context_is_rdonly_umount + * @cxt: mount context + * + * See also mnt_context_enable_rdonly_umount() and see umount(8) man page, + * option -r. + * + * Returns: 1 if read-only remount failed umount(2) is enables or 0 + */ +int mnt_context_is_rdonly_umount(mnt_context *cxt) +{ + return cxt && (cxt->flags & MNT_FL_RDONLY_UMOUNT) ? 1 : 0; +} + /** * mnt_context_disable_helpers: * @cxt: mount context @@ -280,6 +318,17 @@ int mnt_context_enable_sloppy(mnt_context *cxt, int enable) return set_flag(cxt, MNT_FL_SLOPPY, enable); } +/** + * mnt_context_is_sloppy: + * @cxt: mount context + * + * Returns: 1 if sloppy flag is enabled or 0 + */ +int mnt_context_is_sloppy(mnt_context *cxt) +{ + return cxt && (cxt->flags & MNT_FL_SLOPPY) ? 1 : 0; +} + /** * mnt_context_enable_fake: * @cxt: mount context @@ -294,6 +343,17 @@ int mnt_context_enable_fake(mnt_context *cxt, int enable) return set_flag(cxt, MNT_FL_FAKE, enable); } +/** + * mnt_context_is_fake: + * @cxt: mount context + * + * Returns: 1 if fake flag is enabled or 0 + */ +int mnt_context_is_fake(mnt_context *cxt) +{ + return cxt && (cxt->flags & MNT_FL_FAKE) ? 1 : 0; +} + /** * mnt_context_disable_mtab: * @cxt: mount context @@ -308,6 +368,17 @@ int mnt_context_disable_mtab(mnt_context *cxt, int disable) return set_flag(cxt, MNT_FL_NOMTAB, disable); } +/** + * mnt_context_is_nomtab + * @cxt: mount context + * + * Returns: 1 if no-mtab is enabled or 0 + */ +int mnt_context_is_nomtab(mnt_context *cxt) +{ + return cxt && (cxt->flags & MNT_FL_NOMTAB) ? 1 : 0; +} + /** * mnt_context_enable_force: * @cxt: mount context @@ -322,6 +393,17 @@ int mnt_context_enable_force(mnt_context *cxt, int enable) return set_flag(cxt, MNT_FL_FORCE, enable); } +/** + * mnt_context_is_force + * @cxt: mount context + * + * Returns: 1 if force umounting flag is enabled or 0 + */ +int mnt_context_is_force(mnt_context *cxt) +{ + return cxt && (cxt->flags & MNT_FL_FORCE) ? 1 : 0; +} + /** * mnt_context_enable_verbose: * @cxt: mount context @@ -336,6 +418,17 @@ int mnt_context_enable_verbose(mnt_context *cxt, int enable) return set_flag(cxt, MNT_FL_VERBOSE, enable); } +/** + * mnt_context_is_verbose + * @cxt: mount context + * + * Returns: 1 if verbose flag is enabled or 0 + */ +int mnt_context_is_verbose(mnt_context *cxt) +{ + return cxt && (cxt->flags & MNT_FL_VERBOSE) ? 1 : 0; +} + /** * mnt_context_enable_loopdel: * @cxt: mount context -- cgit v1.2.3-55-g7522