]> granicus.if.org Git - zfs/blobdiff - lib/libzfs/libzfs_pool.c
Illumos 5960, 5925
[zfs] / lib / libzfs / libzfs_pool.c
index b94974b83f2f9d5838fac5f30197bc59280f01c0..60213a6386dd4cc2e8bc3bd79b8adf6e9b7f3591 100644 (file)
@@ -710,6 +710,15 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
                                goto error;
                        }
                        break;
+               case ZPOOL_PROP_TNAME:
+                       if (!flags.create) {
+                               zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+                                   "property '%s' can only be set at "
+                                   "creation time"), propname);
+                               (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
+                               goto error;
+                       }
+                       break;
                }
        }
 
@@ -3369,7 +3378,7 @@ set_path(zpool_handle_t *zhp, nvlist_t *nv, const char *path)
  * forms: "-partX", "pX", or "X", where X is a string of digits.  The second
  * case only occurs when the suffix is preceded by a digit, i.e. "md0p0" The
  * third case only occurs when preceded by a string matching the regular
- * expression "^[hs]d[a-z]+", i.e. a scsi or ide disk.
+ * expression "^([hsv]|xv)d[a-z]+", i.e. a scsi, ide, virtio or xen disk.
  */
 static char *
 strip_partition(libzfs_handle_t *hdl, char *path)
@@ -3382,8 +3391,11 @@ strip_partition(libzfs_handle_t *hdl, char *path)
        } else if ((part = strrchr(tmp, 'p')) &&
            part > tmp + 1 && isdigit(*(part-1))) {
                d = part + 1;
-       } else if ((tmp[0] == 'h' || tmp[0] == 's') && tmp[1] == 'd') {
+       } else if ((tmp[0] == 'h' || tmp[0] == 's' || tmp[0] == 'v') &&
+           tmp[1] == 'd') {
                for (d = &tmp[2]; isalpha(*d); part = ++d);
+       } else if (strncmp("xvd", tmp, 3) == 0) {
+               for (d = &tmp[3]; isalpha(*d); part = ++d);
        }
        if (part && d && *d != '\0') {
                for (; isdigit(*d); d++);
@@ -3517,7 +3529,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
 }
 
 static int
-zbookmark_compare(const void *a, const void *b)
+zbookmark_mem_compare(const void *a, const void *b)
 {
        return (memcmp(a, b, sizeof (zbookmark_phys_t)));
 }
@@ -3580,7 +3592,7 @@ zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp)
            zc.zc_nvlist_dst_size;
        count -= zc.zc_nvlist_dst_size;
 
-       qsort(zb, count, sizeof (zbookmark_phys_t), zbookmark_compare);
+       qsort(zb, count, sizeof (zbookmark_phys_t), zbookmark_mem_compare);
 
        verify(nvlist_alloc(nverrlistp, 0, KM_SLEEP) == 0);