]> git.proxmox.com Git - mirror_zfs.git/blobdiff - lib/libzfs/libzfs_mount.c
cstyle: Resolve C style issues
[mirror_zfs.git] / lib / libzfs / libzfs_mount.c
index 6758f6a0946e5d60a199ddfd2fe09b401cc141a6..3cd6406b26c04a5f61a24037a1b5c80c1c2035e6 100644 (file)
@@ -279,7 +279,7 @@ do_mount(const char *src, const char *mntpt, char *opts)
            "-t", MNTTYPE_ZFS,
            "-o", opts,
            (char *)src,
-            (char *)mntpt,
+           (char *)mntpt,
            (char *)NULL };
        int rc;
 
@@ -287,20 +287,22 @@ do_mount(const char *src, const char *mntpt, char *opts)
        rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE);
        if (rc) {
                if (rc & MOUNT_FILEIO)
-                       return EIO;
+                       return (EIO);
                if (rc & MOUNT_USER)
-                       return EINTR;
+                       return (EINTR);
                if (rc & MOUNT_SOFTWARE)
-                       return EPIPE;
+                       return (EPIPE);
+               if (rc & MOUNT_BUSY)
+                       return (EBUSY);
                if (rc & MOUNT_SYSERR)
-                       return EAGAIN;
+                       return (EAGAIN);
                if (rc & MOUNT_USAGE)
-                       return EINVAL;
+                       return (EINVAL);
 
-               return ENXIO; /* Generic error */
+               return (ENXIO); /* Generic error */
        }
 
-       return 0;
+       return (0);
 }
 
 static int
@@ -440,9 +442,11 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
 
        /*
         * Determine if the mountpoint is empty.  If so, refuse to perform the
-        * mount.  We don't perform this check if 'remount' is specified.
+        * mount.  We don't perform this check if 'remount' is
+        * specified or if overlay option(-O) is given
         */
-       if (!remount && !dir_is_empty(mountpoint)) {
+       if ((flags & MS_OVERLAY) == 0 && !remount &&
+           !dir_is_empty(mountpoint)) {
                zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
                    "directory is not empty"));
                return (zfs_error_fmt(hdl, EZFS_MOUNTFAILED,
@@ -710,7 +714,7 @@ zfs_parse_options(char *options, zfs_share_proto_t proto)
 /*
  * Share the given filesystem according to the options in the specified
  * protocol specific properties (sharenfs, sharesmb).  We rely
- * on "libshare" to the dirty work for us.
+ * on "libshare" to do the dirty work for us.
  */
 static int
 zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
@@ -875,7 +879,6 @@ zfs_unshare_proto(zfs_handle_t *zhp, const char *mountpoint,
        char *mntpt = NULL;
 
        /* check to see if need to unmount the filesystem */
-       rewind(zhp->zfs_hdl->libzfs_mnttab);
        if (mountpoint != NULL)
                mountpoint = mntpt = zfs_strdup(hdl, mountpoint);
 
@@ -891,7 +894,7 @@ zfs_unshare_proto(zfs_handle_t *zhp, const char *mountpoint,
 
                        if (is_shared(hdl, mntpt, *curr_proto) &&
                            unshare_one(hdl, zhp->zfs_name,
-                           mntpt, *curr_proto) != 0) {
+                                       mntpt, *curr_proto) != 0) {
                                if (mntpt != NULL)
                                        free(mntpt);
                                return (-1);