Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Show First 20 Lines • Show All 1,238 Lines • ▼ Show 20 Lines | zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg) | ||||
pool_list_t pools = { 0 }; | pool_list_t pools = { 0 }; | ||||
pool_entry_t *pe, *penext; | pool_entry_t *pe, *penext; | ||||
vdev_entry_t *ve, *venext; | vdev_entry_t *ve, *venext; | ||||
config_entry_t *ce, *cenext; | config_entry_t *ce, *cenext; | ||||
name_entry_t *ne, *nenext; | name_entry_t *ne, *nenext; | ||||
avl_tree_t slice_cache; | avl_tree_t slice_cache; | ||||
rdsk_node_t *slice; | rdsk_node_t *slice; | ||||
void *cookie; | void *cookie; | ||||
boolean_t skip_zvols = B_FALSE; | |||||
int value; | |||||
size_t size = sizeof(value); | |||||
if (dirs == 0) { | if (dirs == 0) { | ||||
dirs = 1; | dirs = 1; | ||||
dir = &default_dir; | dir = &default_dir; | ||||
} | } | ||||
if (sysctlbyname("vfs.zfs.vol.recursive", &value, &size, NULL, 0) == 0 | |||||
&& value == 0) | |||||
{ | |||||
skip_zvols = B_TRUE; | |||||
} | |||||
/* | /* | ||||
* Go through and read the label configuration information from every | * Go through and read the label configuration information from every | ||||
* possible device, organizing the information according to pool GUID | * possible device, organizing the information according to pool GUID | ||||
* and toplevel GUID. | * and toplevel GUID. | ||||
*/ | */ | ||||
for (i = 0; i < dirs; i++) { | for (i = 0; i < dirs; i++) { | ||||
tpool_t *t; | tpool_t *t; | ||||
char rdsk[MAXPATHLEN]; | char rdsk[MAXPATHLEN]; | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | if (strcmp(rdsk, "/dev/") == 0) { | ||||
if (errno != 0) { | if (errno != 0) { | ||||
zfs_error_aux(hdl, strerror(errno)); | zfs_error_aux(hdl, strerror(errno)); | ||||
(void) zfs_error_fmt(hdl, EZFS_BADPATH, | (void) zfs_error_fmt(hdl, EZFS_BADPATH, | ||||
dgettext(TEXT_DOMAIN, "cannot get GEOM tree")); | dgettext(TEXT_DOMAIN, "cannot get GEOM tree")); | ||||
goto error; | goto error; | ||||
} | } | ||||
LIST_FOREACH(mp, &mesh.lg_class, lg_class) { | LIST_FOREACH(mp, &mesh.lg_class, lg_class) { | ||||
if (skip_zvols && | |||||
strcmp(mp->lg_name, "ZFS::ZVOL") == 0) { | |||||
continue; | |||||
} | |||||
LIST_FOREACH(gp, &mp->lg_geom, lg_geom) { | LIST_FOREACH(gp, &mp->lg_geom, lg_geom) { | ||||
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { | LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { | ||||
slice = zfs_alloc(hdl, sizeof (rdsk_node_t)); | slice = zfs_alloc(hdl, sizeof (rdsk_node_t)); | ||||
slice->rn_name = zfs_strdup(hdl, pp->lg_name); | slice->rn_name = zfs_strdup(hdl, pp->lg_name); | ||||
slice->rn_avl = &slice_cache; | slice->rn_avl = &slice_cache; | ||||
slice->rn_dfd = dfd; | slice->rn_dfd = dfd; | ||||
slice->rn_hdl = hdl; | slice->rn_hdl = hdl; | ||||
slice->rn_nozpool = B_FALSE; | slice->rn_nozpool = B_FALSE; | ||||
▲ Show 20 Lines • Show All 593 Lines • Show Last 20 Lines |