text stringlengths 0 14.1k |
|---|
return (0); |
} |
/* |
* Get phys_path for a root pool |
* Return 0 on success; non-zero on failure. |
*/ |
int |
zpool_get_physpath(zpool_handle_t *zhp, char *physpath, size_t phypath_size) |
{ |
return (zpool_get_config_physpath(zhp->zpool_config, physpath, |
phypath_size)); |
} |
/* |
* If the device has being dynamically expanded then we need to relabel |
* the disk to use the new unallocated space. |
*/ |
static int |
zpool_relabel_disk(libzfs_handle_t *hdl, const char *name) |
{ |
char path[MAXPATHLEN]; |
char errbuf[1024]; |
int fd, error; |
int (*_efi_use_whole_disk)(int); |
if ((_efi_use_whole_disk = (int (*)(int))dlsym(RTLD_DEFAULT, |
""efi_use_whole_disk"")) == NULL) |
return (-1); |
(void) snprintf(path, sizeof (path), ""%s/%s"", RDISK_ROOT, name); |
if ((fd = open(path, O_RDWR | O_NDELAY)) < 0) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, ""cannot "" |
""relabel '%s': unable to open device""), name); |
return (zfs_error(hdl, EZFS_OPENFAILED, errbuf)); |
} |
/* |
* It's possible that we might encounter an error if the device |
* does not have any unallocated space left. If so, we simply |
* ignore that error and continue on. |
*/ |
/* zfs-fuse : no efi function here, this should be fixed later if |
* possible... |
* error = _efi_use_whole_disk(fd); */ |
(void) close(fd); |
/* if (error && error != VT_ENOSPC) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, ""cannot "" |
""relabel '%s': unable to read disk capacity""), name); |
return (zfs_error(hdl, EZFS_NOCAP, errbuf)); |
} */ |
return (0); |
} |
/* |
* Bring the specified vdev online. The 'flags' parameter is a set of the |
* ZFS_ONLINE_* flags. |
*/ |
int |
zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags, |
vdev_state_t *newstate) |
{ |
zfs_cmd_t zc = { 0 }; |
char msg[1024]; |
nvlist_t *tgt; |
boolean_t avail_spare, l2cache, islog; |
libzfs_handle_t *hdl = zhp->zpool_hdl; |
if (flags & ZFS_ONLINE_EXPAND) { |
(void) snprintf(msg, sizeof (msg), |
dgettext(TEXT_DOMAIN, ""cannot expand %s""), path); |
} else { |
(void) snprintf(msg, sizeof (msg), |
dgettext(TEXT_DOMAIN, ""cannot online %s""), path); |
} |
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); |
if ((tgt = zpool_find_vdev(zhp, path, &avail_spare, &l2cache, |
&islog)) == NULL) |
return (zfs_error(hdl, EZFS_NODEVICE, msg)); |
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, &zc.zc_guid) == 0); |
if (avail_spare) |
return (zfs_error(hdl, EZFS_ISSPARE, msg)); |
if (flags & ZFS_ONLINE_EXPAND || |
zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) { |
char *pathname = NULL; |
uint64_t wholedisk = 0; |
(void) nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK, |
&wholedisk); |
verify(nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, |
&pathname) == 0); |
/* |
* XXX - L2ARC 1.0 devices can't support expansion. |
*/ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.