22
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
22
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23
23
* Use is subject to license terms.
26
/* #pragma ident "%Z%%M% %I% %E% SMI" */
29
27
* This file is intended for functions that ought to be common between user
30
28
* land (libzfs) and the kernel. When many common routines need to be shared
69
zpool_get_rewind_policy(nvlist_t *nvl, zpool_rewind_policy_t *zrpp)
76
zrpp->zrp_request = ZPOOL_NO_REWIND;
77
zrpp->zrp_maxmeta = 0;
78
zrpp->zrp_maxdata = UINT64_MAX;
79
zrpp->zrp_txg = UINT64_MAX;
85
while ((elem = nvlist_next_nvpair(nvl, elem)) != NULL) {
86
nm = nvpair_name(elem);
87
if (strcmp(nm, ZPOOL_REWIND_POLICY) == 0) {
88
if (nvpair_value_nvlist(elem, &policy) == 0)
89
zpool_get_rewind_policy(policy, zrpp);
91
} else if (strcmp(nm, ZPOOL_REWIND_REQUEST) == 0) {
92
if (nvpair_value_uint32(elem, &zrpp->zrp_request) == 0)
93
if (zrpp->zrp_request & ~ZPOOL_REWIND_POLICIES)
94
zrpp->zrp_request = ZPOOL_NO_REWIND;
95
} else if (strcmp(nm, ZPOOL_REWIND_REQUEST_TXG) == 0) {
96
(void) nvpair_value_uint64(elem, &zrpp->zrp_txg);
97
} else if (strcmp(nm, ZPOOL_REWIND_META_THRESH) == 0) {
98
(void) nvpair_value_uint64(elem, &zrpp->zrp_maxmeta);
99
} else if (strcmp(nm, ZPOOL_REWIND_DATA_THRESH) == 0) {
100
(void) nvpair_value_uint64(elem, &zrpp->zrp_maxdata);
103
if (zrpp->zrp_request == 0)
104
zrpp->zrp_request = ZPOOL_NO_REWIND;