Print this page
re #12585 rb4049 ZFS++ work port - refactoring to improve separation of open/closed code, bug fixes, performance improvements - open code
Bug 11205: add missing libzfs_closed_stubs.c to fix opensource-only build.
ZFS plus work: special vdevs, cos, cos/vdev properties
        
*** 19,28 ****
--- 19,29 ----
   * CDDL HEADER END
   */
  /*
   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
   * Use is subject to license terms.
+  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
   */
  
  #include <errno.h>
  #include <libgen.h>
  #include <libintl.h>
*** 81,86 ****
--- 82,112 ----
                      &is_log);
                  if (is_log)
                          nlogs++;
          }
          return (nlogs);
+ }
+ 
+ /*
+  * Return the number of special vdevs in supplied nvlist
+  */
+ uint_t
+ num_special(nvlist_t *nv)
+ {
+         uint_t nspecial = 0;
+         uint_t c, children;
+         nvlist_t **child;
+ 
+         if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
+             &child, &children) != 0)
+                 return (0);
+ 
+         for (c = 0; c < children; c++) {
+                 uint64_t is_special = B_FALSE;
+ 
+                 (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_SPECIAL,
+                     &is_special);
+                 if (is_special)
+                         nspecial++;
+         }
+         return (nspecial);
  }