mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Illumos 5135 - zpool_find_import_cached() can use fnvlist_*
Reviewed by: Christopher Siden <christopher.siden@delphix.com> Reviewed by: Max Grossman <max.grossman@delphix.com> Reviewed by: Richard Elling <richard.elling@gmail.com> Approved by: Dan McDonald <danmcd@omniti.com> References: https://www.illumos.org/issues/5135 https://github.com/illumos/illumos-gate/commit/b18d6b0 Ported by: Turbo Fredriksson <turbo@bayour.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2693
This commit is contained in:
parent
d97aa48f7c
commit
ab2894e66f
@ -1312,21 +1312,15 @@ zpool_find_import_cached(libzfs_handle_t *hdl, const char *cachefile,
|
|||||||
|
|
||||||
elem = NULL;
|
elem = NULL;
|
||||||
while ((elem = nvlist_next_nvpair(raw, elem)) != NULL) {
|
while ((elem = nvlist_next_nvpair(raw, elem)) != NULL) {
|
||||||
verify(nvpair_value_nvlist(elem, &src) == 0);
|
src = fnvpair_value_nvlist(elem);
|
||||||
|
|
||||||
verify(nvlist_lookup_string(src, ZPOOL_CONFIG_POOL_NAME,
|
name = fnvlist_lookup_string(src, ZPOOL_CONFIG_POOL_NAME);
|
||||||
&name) == 0);
|
|
||||||
if (poolname != NULL && strcmp(poolname, name) != 0)
|
if (poolname != NULL && strcmp(poolname, name) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
verify(nvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID,
|
this_guid = fnvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID);
|
||||||
&this_guid) == 0);
|
if (guid != 0 && guid != this_guid)
|
||||||
if (guid != 0) {
|
continue;
|
||||||
verify(nvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID,
|
|
||||||
&this_guid) == 0);
|
|
||||||
if (guid != this_guid)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pool_active(hdl, name, this_guid, &active) != 0) {
|
if (pool_active(hdl, name, this_guid, &active) != 0) {
|
||||||
nvlist_free(raw);
|
nvlist_free(raw);
|
||||||
|
Loading…
Reference in New Issue
Block a user