]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: cleanup *_do_[u]mount() return codes and docs
authorKarel Zak <kzak@redhat.com>
Mon, 14 Mar 2011 13:33:53 +0000 (14:33 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 19 Apr 2011 11:09:52 +0000 (13:09 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/mount/src/context.c
shlibs/mount/src/context_mount.c
shlibs/mount/src/context_umount.c

index 487859a3f9664c28a2f4f530684c21a9a69d03de..61a2b9edd9e94bb797f8ad2e855e50abf7435ee4 100644 (file)
@@ -1481,7 +1481,7 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
  * mnt_context_get_status:
  * @cxt: mount context
  *
- * Returns: 0 if /sbin/mount.type or mount(2) syscall was successfull or -errno.
+ * Returns: 0 if /sbin/mount.type or mount(2) syscall was successfull.
  */
 int mnt_context_get_status(struct libmnt_context *cxt)
 {
@@ -1493,6 +1493,9 @@ int mnt_context_get_status(struct libmnt_context *cxt)
  * @cxt: mount context
  * @status: mount(2) return code
  *
+ * The @status should be 0 on succcess, or negative number on error (-1 or
+ * -errno).
+ *
  * This function should be used if [u]mount(2) syscall was NOT called by
  * libmount (by mnt_context_mount() or mnt_context_do_mount()) only.
  *
index 0c67546444bf413f8f0f0ed392c886f3124edcb5..d8da5a5f54afd8b897fe2f37ac3f56fbac8aaa57 100644 (file)
@@ -401,7 +401,7 @@ static int do_mount(struct libmnt_context *cxt, const char *try_type)
                        cxt->syscall_status = -errno;
                        DBG(CXT, mnt_debug_h(cxt, "mount(2) failed [errno=%d %m]",
                                                        -cxt->syscall_status));
-                       return cxt->syscall_status;
+                       return -cxt->syscall_status;
                }
                DBG(CXT, mnt_debug_h(cxt, "mount(2) success"));
                cxt->syscall_status = 0;
@@ -530,7 +530,14 @@ int mnt_context_prepare_mount(struct libmnt_context *cxt)
  *
  * Call mount(2) or mount.<type> helper. Unnecessary for mnt_context_mount().
  *
- * Returns: negative number on error, zero on success
+ * WARNING: non-zero return code does not mean that mount(2) syscall or
+ *          umount.type helper wasn't sucessfully called.
+ *
+ *          Check mnt_context_get_status() after error!
+*
+ * Returns: 0 on success;
+ *         >0 in case of mount(2) error (returns syscall errno),
+ *         <0 in case of other errors.
  */
 int mnt_context_do_mount(struct libmnt_context *cxt)
 {
@@ -594,9 +601,14 @@ int mnt_context_finalize_mount(struct libmnt_context *cxt)
  *
  * See also mnt_context_disable_helpers().
  *
- * Returns: 0 on success, and negative number in case of error. WARNING: error
- *          does not mean that mount(2) syscall or mount.type helper wasn't
- *          sucessfully called. Check mnt_context_get_status() after error!
+ * WARNING: non-zero return code does not mean that mount(2) syscall or
+ *          mount.type helper wasn't sucessfully called.
+ *
+ *          Check mnt_context_get_status() after error!
+*
+ * Returns: 0 on success;
+ *         >0 in case of mount(2) error (returns syscall errno),
+ *         <0 in case of other errors.
  */
 int mnt_context_mount(struct libmnt_context *cxt)
 {
index 1187a87cd71246d5d4f22df9f1ee05a4fb65ffea..69819e5c2db3e76b4eca2e7342e816f68a523b2b 100644 (file)
@@ -486,7 +486,7 @@ static int do_umount(struct libmnt_context *cxt)
                        DBG(CXT, mnt_debug_h(cxt, "read-only re-mount(2) failed "
                                        "[errno=%d]",
                                        -cxt->syscall_status));
-                       return cxt->syscall_status;
+                       return -cxt->syscall_status;
                }
                cxt->syscall_status = 0;
                DBG(CXT, mnt_debug_h(cxt, "read-only re-mount(2) success"));
@@ -562,7 +562,14 @@ int mnt_context_prepare_umount(struct libmnt_context *cxt)
  *
  * See also mnt_context_disable_helpers().
  *
- * Returns: 0 on success, and negative number in case of error.
+ * WARNING: non-zero return code does not mean that umount(2) syscall or
+ *          umount.type helper wasn't sucessfully called.
+ *
+ *          Check mnt_context_get_status() after error!
+*
+ * Returns: 0 on success;
+ *         >0 in case of umount(2) error (returns syscall errno),
+ *         <0 in case of other errors.
  */
 int mnt_context_do_umount(struct libmnt_context *cxt)
 {
@@ -650,9 +657,14 @@ int mnt_context_finalize_umount(struct libmnt_context *cxt)
  *
  * See also mnt_context_disable_helpers().
  *
- * Returns: 0 on success, and negative number in case of error. WARNING: error
- *          does not mean that umount(2) syscall or mount.type helper wasn't
- *          sucessfully called. Check mnt_context_get_status() after error!
+ * WARNING: non-zero return code does not mean that umount(2) syscall or
+ *          umount.type helper wasn't sucessfully called.
+ *
+ *          Check mnt_context_get_status() after error!
+ *
+ * Returns: 0 on success;
+ *         >0 in case of umount(2) error (returns syscall errno),
+ *         <0 in case of other errors.
  */
 int mnt_context_umount(struct libmnt_context *cxt)
 {