diff options
author | Matthew Ahrens <[email protected]> | 2014-09-12 18:26:53 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-09-23 11:44:29 -0700 |
commit | ab2894e66f40785b7d56d54f71158d6bf5b31b9a (patch) | |
tree | 7b8e48558097dd69383fd864f60ec7c7fd5ce733 /lib/libzfs | |
parent | d97aa48f7c53e851675ad5d250daecee1bac81c1 (diff) |
Illumos 5135 - zpool_find_import_cached() can use fnvlist_*
Reviewed by: Christopher Siden <[email protected]>
Reviewed by: Max Grossman <[email protected]>
Reviewed by: Richard Elling <[email protected]>
Approved by: Dan McDonald <[email protected]>
References:
https://www.illumos.org/issues/5135
https://github.com/illumos/illumos-gate/commit/b18d6b0
Ported by: Turbo Fredriksson <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #2693
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/libzfs_import.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c index 8afe77af3..e71cbb86b 100644 --- a/lib/libzfs/libzfs_import.c +++ b/lib/libzfs/libzfs_import.c @@ -1312,21 +1312,15 @@ zpool_find_import_cached(libzfs_handle_t *hdl, const char *cachefile, 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) == 0); + name = fnvlist_lookup_string(src, ZPOOL_CONFIG_POOL_NAME); if (poolname != NULL && strcmp(poolname, name) != 0) continue; - verify(nvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID, - &this_guid) == 0); - if (guid != 0) { - verify(nvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID, - &this_guid) == 0); - if (guid != this_guid) - continue; - } + this_guid = fnvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID); + if (guid != 0 && guid != this_guid) + continue; if (pool_active(hdl, name, this_guid, &active) != 0) { nvlist_free(raw); |