Author: mm
Date: Mon Sep 10 21:24:41 2012
New Revision: 240326
URL: http://svn.freebsd.org/changeset/base/240326

Log:
  Update vendor/illumos/dist to illumos-gate 13810:4b38a0c01186
  (zfs changes, illumos issue #3098)

Modified:
  vendor/illumos/dist/cmd/zfs/zfs_main.c
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c

Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c
==============================================================================
--- vendor/illumos/dist/cmd/zfs/zfs_main.c      Mon Sep 10 18:49:49 2012        
(r240325)
+++ vendor/illumos/dist/cmd/zfs/zfs_main.c      Mon Sep 10 21:24:41 2012        
(r240326)
@@ -2288,10 +2288,8 @@ userspace_cb(void *arg, const char *doma
                        if (!cb->cb_sid2posix) {
                                e = directory_name_from_sid(NULL, sid, &name,
                                    &classes);
-                               if (e != NULL) {
+                               if (e != NULL)
                                        directory_error_free(e);
-                                       return (1);
-                               }
                                if (name == NULL)
                                        name = sid;
                        }
@@ -2534,7 +2532,7 @@ zfs_do_userspace(int argc, char **argv)
        boolean_t prtnum = B_FALSE;
        boolean_t parsable = B_FALSE;
        boolean_t sid2posix = B_FALSE;
-       int error = 0;
+       int ret = 0;
        int c;
        zfs_sort_column_t *sortcol = NULL;
        int types = USTYPE_PSX_USR | USTYPE_SMB_USR;
@@ -2679,18 +2677,19 @@ zfs_do_userspace(int argc, char **argv)
                    !(types & (USTYPE_PSX_GRP | USTYPE_SMB_GRP))))
                        continue;
                cb.cb_prop = p;
-               error = zfs_userspace(zhp, p, userspace_cb, &cb);
-               if (error)
-                       break;
+               if ((ret = zfs_userspace(zhp, p, userspace_cb, &cb)) != 0)
+                       return (ret);
        }
 
        /* Sort the list */
+       if ((node = uu_avl_first(avl_tree)) == NULL)
+               return (0);
+
        us_populated = B_TRUE;
+
        listpool = uu_list_pool_create("tmplist", sizeof (us_node_t),
            offsetof(us_node_t, usn_listnode), NULL, UU_DEFAULT);
        list = uu_list_create(listpool, NULL, UU_DEFAULT);
-
-       node = uu_avl_first(avl_tree);
        uu_list_node_init(node, &node->usn_listnode, listpool);
 
        while (node != NULL) {
@@ -2731,7 +2730,7 @@ zfs_do_userspace(int argc, char **argv)
        uu_avl_destroy(avl_tree);
        uu_avl_pool_destroy(avl_pool);
 
-       return (error);
+       return (ret);
 }
 
 /*

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
==============================================================================
--- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c      Mon Sep 10 
18:49:49 2012        (r240325)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c      Mon Sep 10 
21:24:41 2012        (r240326)
@@ -21,9 +21,9 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 2012 DEY Storage Systems, Inc.  All rights reserved.
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  */
 
 #include <ctype.h>
@@ -4023,35 +4023,40 @@ zfs_userspace(zfs_handle_t *zhp, zfs_use
     zfs_userspace_cb_t func, void *arg)
 {
        zfs_cmd_t zc = { 0 };
-       int error;
        zfs_useracct_t buf[100];
+       libzfs_handle_t *hdl = zhp->zfs_hdl;
+       int ret;
 
        (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
 
        zc.zc_objset_type = type;
        zc.zc_nvlist_dst = (uintptr_t)buf;
 
-       /* CONSTCOND */
-       while (1) {
+       for (;;) {
                zfs_useracct_t *zua = buf;
 
                zc.zc_nvlist_dst_size = sizeof (buf);
-               error = ioctl(zhp->zfs_hdl->libzfs_fd,
-                   ZFS_IOC_USERSPACE_MANY, &zc);
-               if (error || zc.zc_nvlist_dst_size == 0)
+               if (zfs_ioctl(hdl, ZFS_IOC_USERSPACE_MANY, &zc) != 0) {
+                       char errbuf[ZFS_MAXNAMELEN + 32];
+
+                       (void) snprintf(errbuf, sizeof (errbuf),
+                           dgettext(TEXT_DOMAIN,
+                           "cannot get used/quota for %s"), zc.zc_name);
+                       return (zfs_standard_error_fmt(hdl, errno, errbuf));
+               }
+               if (zc.zc_nvlist_dst_size == 0)
                        break;
 
                while (zc.zc_nvlist_dst_size > 0) {
-                       error = func(arg, zua->zu_domain, zua->zu_rid,
-                           zua->zu_space);
-                       if (error != 0)
-                               return (error);
+                       if ((ret = func(arg, zua->zu_domain, zua->zu_rid,
+                           zua->zu_space)) != 0)
+                               return (ret);
                        zua++;
                        zc.zc_nvlist_dst_size -= sizeof (zfs_useracct_t);
                }
        }
 
-       return (error);
+       return (0);
 }
 
 int
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to