From cfb9db309558ca45c670947e1bf391152c662f1e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 2 Feb 2011 21:19:14 +0100 Subject: libmount: cleanup high-level mount API Signed-off-by: Karel Zak --- shlibs/mount/src/context_mount.c | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'shlibs/mount/src/context_mount.c') diff --git a/shlibs/mount/src/context_mount.c b/shlibs/mount/src/context_mount.c index 8c764078d..7f6847277 100644 --- a/shlibs/mount/src/context_mount.c +++ b/shlibs/mount/src/context_mount.c @@ -496,7 +496,6 @@ int mnt_context_prepare_mount(struct libmnt_context *cxt) return -EINVAL; if (!mnt_fs_get_source(cxt->fs) && !mnt_fs_get_target(cxt->fs)) return -EINVAL; - if (cxt->flags & MNT_FL_PREPARED) return 0; @@ -546,6 +545,7 @@ int mnt_context_do_mount(struct libmnt_context *cxt) assert(cxt->syscall_status == 1); assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); assert((cxt->flags & MNT_FL_PREPARED)); + assert((cxt->action == MNT_ACT_MOUNT)); DBG(CXT, mnt_debug_h(cxt, "mount: do mount")); @@ -560,12 +560,36 @@ int mnt_context_do_mount(struct libmnt_context *cxt) } /** - * mnt_mount_context: + * mnt_context_finalize_mount: + * @cxt: context + * + * Mtab update, etc. Unnecessary for mnt_context_mount(), but should be called + * after mnt_context_do_mount(). See also mnt_context_set_syscall_status(). + * + * Returns: negative number on error, 0 on success. + */ +int mnt_context_finalize_mount(struct libmnt_context *cxt) +{ + int rc; + + assert(cxt); + assert(cxt->fs); + assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); + assert((cxt->flags & MNT_FL_PREPARED)); + + rc = mnt_context_prepare_update(cxt); + if (!rc) + rc = mnt_context_update_tabs(cxt);; + return rc; +} + +/** + * mnt_context_mount: * @cxt: mount context * - * Mount filesystem by mount(2) or fork()+exec(/sbin/mount.type). + * High-level, mounts filesystem by mount(2) or fork()+exec(/sbin/mount.type). * - * This is top-level function for FS mounting, similar to: + * This is similar to: * * mnt_context_prepare_mount(cxt); * mnt_context_do_mount(cxt); @@ -577,7 +601,7 @@ int mnt_context_do_mount(struct libmnt_context *cxt) * does not mean that mount(2) syscall or mount.type helper wasn't * sucessfully called. Check mnt_context_get_status() after error! */ -int mnt_mount_context(struct libmnt_context *cxt) +int mnt_context_mount(struct libmnt_context *cxt) { int rc; @@ -601,27 +625,3 @@ int mnt_mount_context(struct libmnt_context *cxt) return rc; } -/** - * mnt_context_finalize_mount: - * @cxt: context - * - * Mtab update, etc. Unnecessary for mnt_context_mount(), but should be called - * after mnt_context_do_mount(). See also mnt_context_set_syscall_status(). - * - * Returns: negative number on error, 0 on success. - */ -int mnt_context_finalize_mount(struct libmnt_context *cxt) -{ - int rc; - - assert(cxt); - assert(cxt->fs); - assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); - assert((cxt->flags & MNT_FL_PREPARED)); - - rc = mnt_context_prepare_update(cxt); - if (!rc) - rc = mnt_context_update_tabs(cxt);; - return rc; -} - -- cgit v1.2.3-55-g7522