]> 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>
Mon, 14 Mar 2011 13:33:53 +0000 (14:33 +0100)
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 0b1f70ef3bed8dda7924a6ac836eb6dc32d2f356..dba49430d07d051955cb8e743d192a515f7cbb39 100644 (file)
@@ -1459,7 +1459,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)
 {
@@ -1471,6 +1471,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 5b9c0b19559e49429756aa2ed95a601e7f7ef050..eaba33c051e56a473116b978174364b07af1f3a1 100644 (file)
@@ -404,7 +404,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;
@@ -533,7 +533,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)
 {
@@ -597,9 +604,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 3bf8fc45eea9bceef11af3f98535939392b2b038..eb1a338bb01f1aa288c936b023e60d8830dd3533 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)
 {