diff options
author | Xin LI <delphij@FreeBSD.org> | 2014-09-13 16:41:39 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2014-09-13 16:41:39 +0000 |
commit | e11a25e8d04eaac93dad53a2b5bdd9b3ff5afd00 (patch) | |
tree | 37d980fd1782166507a467d35159860522b90253 /cddl | |
parent | 263f396e2b736938a90eb6b6e75d0b5b8b8e230f (diff) | |
parent | 7bdd0535ff6dfa7b7fb3cff641e4e83f2e903013 (diff) | |
download | src-e11a25e8d04eaac93dad53a2b5bdd9b3ff5afd00.tar.gz src-e11a25e8d04eaac93dad53a2b5bdd9b3ff5afd00.zip |
MFV r271511:
Use fnvlist_* to make code more readable.
Illumos issue:
5135 zpool_find_import_cached() can use fnvlist_*
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=271527
Diffstat (limited to 'cddl')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c index 868961d96d66..49a43855d5fe 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ @@ -1426,21 +1426,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); |