diff options
author | Richard Yao <richard.yao@alumni.stonybrook.edu> | 2023-03-11 18:39:24 +0000 |
---|---|---|
committer | Brian Behlendorf <behlendorf1@llnl.gov> | 2023-03-14 22:25:50 +0000 |
commit | d1807f168edd09ca26a5a0c6b570686b982808ad (patch) | |
tree | db5bfd360991fa3528fe688247eb289ef1d8b859 /lib | |
parent | 50f6934b9c1f4aa583592e8a969b934440a44c64 (diff) | |
download | src-d1807f168edd09ca26a5a0c6b570686b982808ad.tar.gz src-d1807f168edd09ca26a5a0c6b570686b982808ad.zip |
nvpair: Constify string functions
After addressing coverity complaints involving `nvpair_name()`, the
compiler started complaining about dropping const. This lead to a rabbit
hole where not only `nvpair_name()` needed to be constified, but also
`nvpair_value_string()`, `fnvpair_value_string()` and a few other static
functions, plus variable pointers throughout the code. The result became
a fairly big change, so it has been split out into its own patch.
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14612
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libnvpair/libnvpair.abi | 74 | ||||
-rw-r--r-- | lib/libnvpair/libnvpair.c | 41 | ||||
-rw-r--r-- | lib/libnvpair/libnvpair_json.c | 4 | ||||
-rw-r--r-- | lib/libzfs/libzfs.abi | 34 | ||||
-rw-r--r-- | lib/libzfs/libzfs_crypto.c | 8 | ||||
-rw-r--r-- | lib/libzfs/libzfs_dataset.c | 30 | ||||
-rw-r--r-- | lib/libzfs/libzfs_impl.h | 2 | ||||
-rw-r--r-- | lib/libzfs/libzfs_import.c | 2 | ||||
-rw-r--r-- | lib/libzfs/libzfs_iter.c | 2 | ||||
-rw-r--r-- | lib/libzfs/libzfs_mount.c | 2 | ||||
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 44 | ||||
-rw-r--r-- | lib/libzfs/libzfs_sendrecv.c | 48 | ||||
-rw-r--r-- | lib/libzfs/libzfs_status.c | 3 | ||||
-rw-r--r-- | lib/libzfs/libzfs_util.c | 4 | ||||
-rw-r--r-- | lib/libzfs/os/linux/libzfs_pool_os.c | 2 | ||||
-rw-r--r-- | lib/libzfs_core/libzfs_core.abi | 12 | ||||
-rw-r--r-- | lib/libzfsbootenv/libzfsbootenv.abi | 5 | ||||
-rw-r--r-- | lib/libzfsbootenv/lzbe_device.c | 17 | ||||
-rw-r--r-- | lib/libzpool/util.c | 9 | ||||
-rw-r--r-- | lib/libzutil/os/linux/zutil_import_os.c | 12 | ||||
-rw-r--r-- | lib/libzutil/zutil_import.c | 35 | ||||
-rw-r--r-- | lib/libzutil/zutil_import.h | 4 |
22 files changed, 211 insertions, 183 deletions
diff --git a/lib/libnvpair/libnvpair.abi b/lib/libnvpair/libnvpair.abi index 5900a6551571..ef92f3e9bda6 100644 --- a/lib/libnvpair/libnvpair.abi +++ b/lib/libnvpair/libnvpair.abi @@ -243,6 +243,9 @@ <array-type-def dimensions='1' type-id='a84c031d' size-in-bits='160' id='664ac0b7'> <subrange length='20' type-id='7359adad' id='fdca39cf'/> </array-type-def> + <array-type-def dimensions='1' type-id='a84c031d' size-in-bits='infinite' id='e84913bd'> + <subrange length='infinite' type-id='7359adad' id='031f2035'/> + </array-type-def> <class-decl name='_IO_codecvt' is-struct='yes' visibility='default' is-declaration-only='yes' id='a4036571'/> <class-decl name='_IO_marker' is-struct='yes' visibility='default' is-declaration-only='yes' id='010ae0b9'/> <class-decl name='_IO_wide_data' is-struct='yes' visibility='default' is-declaration-only='yes' id='79bd3751'/> @@ -321,6 +324,9 @@ <data-member access='public' layout-offset-in-bits='96'> <var-decl name='nvp_type' type-id='8d0687d2' visibility='default'/> </data-member> + <data-member access='public' layout-offset-in-bits='128'> + <var-decl name='nvp_name' type-id='e84913bd' visibility='default'/> + </data-member> </class-decl> <typedef-decl name='nvpair_t' type-id='1c34e459' id='57928edf'/> <class-decl name='nvlist' size-in-bits='192' is-struct='yes' visibility='default' id='ac266fd9'> @@ -698,7 +704,7 @@ </class-decl> <class-decl name='__anonymous_struct__12' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' id='e7f43f7e'> <data-member access='public' layout-offset-in-bits='0'> - <var-decl name='op' type-id='c0d0f877' visibility='default'/> + <var-decl name='op' type-id='bfc48fe4' visibility='default'/> </data-member> <data-member access='public' layout-offset-in-bits='64'> <var-decl name='arg' type-id='eaa32e2f' visibility='default'/> @@ -802,7 +808,7 @@ </class-decl> <class-decl name='__anonymous_struct__25' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' id='e7f43f8b'> <data-member access='public' layout-offset-in-bits='0'> - <var-decl name='op' type-id='de20bf07' visibility='default'/> + <var-decl name='op' type-id='337f4a72' visibility='default'/> </data-member> <data-member access='public' layout-offset-in-bits='64'> <var-decl name='arg' type-id='eaa32e2f' visibility='default'/> @@ -858,11 +864,11 @@ <pointer-type-def type-id='c19b74c3' size-in-bits='64' id='37e3bd22'/> <pointer-type-def type-id='37e3bd22' size-in-bits='64' id='03829398'/> <pointer-type-def type-id='a84c031d' size-in-bits='64' id='26a90f95'/> - <pointer-type-def type-id='26a90f95' size-in-bits='64' id='9b23c9ad'/> - <pointer-type-def type-id='9b23c9ad' size-in-bits='64' id='c0563f85'/> <qualified-type-def type-id='a84c031d' const='yes' id='9b45d938'/> <pointer-type-def type-id='9b45d938' size-in-bits='64' id='80f4b756'/> <qualified-type-def type-id='80f4b756' restrict='yes' id='9d26089a'/> + <pointer-type-def type-id='80f4b756' size-in-bits='64' id='7d3cd834'/> + <pointer-type-def type-id='7d3cd834' size-in-bits='64' id='44c8373a'/> <qualified-type-def type-id='57928edf' const='yes' id='642ee20f'/> <pointer-type-def type-id='642ee20f' size-in-bits='64' id='dace003f'/> <qualified-type-def type-id='aca3bac8' const='yes' id='2498fd78'/> @@ -871,8 +877,8 @@ <pointer-type-def type-id='a0eb0f08' size-in-bits='64' id='7408d286'/> <pointer-type-def type-id='cebdd548' size-in-bits='64' id='e379e62d'/> <pointer-type-def type-id='9f88f76e' size-in-bits='64' id='7ef0e988'/> - <pointer-type-def type-id='c5bb1a2b' size-in-bits='64' id='c0d0f877'/> - <pointer-type-def type-id='573fea1b' size-in-bits='64' id='de20bf07'/> + <pointer-type-def type-id='889f3b42' size-in-bits='64' id='bfc48fe4'/> + <pointer-type-def type-id='49055dd8' size-in-bits='64' id='337f4a72'/> <pointer-type-def type-id='70284cc6' size-in-bits='64' id='3be4d568'/> <pointer-type-def type-id='700c3bca' size-in-bits='64' id='6d994334'/> <pointer-type-def type-id='18ac1860' size-in-bits='64' id='506ab59a'/> @@ -898,8 +904,8 @@ <pointer-type-def type-id='3bd73b0c' size-in-bits='64' id='7e85a9b6'/> <pointer-type-def type-id='0d445e26' size-in-bits='64' id='330cc0d0'/> <pointer-type-def type-id='e4b89f30' size-in-bits='64' id='ed8aa8ba'/> - <pointer-type-def type-id='be7f4941' size-in-bits='64' id='2809de35'/> - <pointer-type-def type-id='fe5ae69d' size-in-bits='64' id='90d5edb9'/> + <pointer-type-def type-id='78e3bec8' size-in-bits='64' id='b38a1022'/> + <pointer-type-def type-id='a5193bb2' size-in-bits='64' id='6263eda4'/> <pointer-type-def type-id='2783af3c' size-in-bits='64' id='e44553b6'/> <pointer-type-def type-id='33c6e3d8' size-in-bits='64' id='1263777a'/> <pointer-type-def type-id='dadb9eca' size-in-bits='64' id='cbda43ac'/> @@ -966,7 +972,7 @@ </function-decl> <function-decl name='nvpair_name' mangled-name='nvpair_name' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvpair_name'> <parameter type-id='dace003f'/> - <return type-id='26a90f95'/> + <return type-id='80f4b756'/> </function-decl> <function-decl name='nvpair_type' mangled-name='nvpair_type' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvpair_type'> <parameter type-id='dace003f'/> @@ -1027,8 +1033,8 @@ <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvpair_value_string' mangled-name='nvpair_value_string' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvpair_value_string'> - <parameter type-id='3fa542f0'/> - <parameter type-id='9b23c9ad'/> + <parameter type-id='dace003f'/> + <parameter type-id='7d3cd834'/> <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvpair_value_nvlist' mangled-name='nvpair_value_nvlist' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvpair_value_nvlist'> @@ -1098,7 +1104,7 @@ </function-decl> <function-decl name='nvpair_value_string_array' mangled-name='nvpair_value_string_array' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvpair_value_string_array'> <parameter type-id='3fa542f0'/> - <parameter type-id='c0563f85'/> + <parameter type-id='44c8373a'/> <parameter type-id='4dd26a40'/> <return type-id='95e97e5e'/> </function-decl> @@ -1280,7 +1286,7 @@ </function-decl> <function-decl name='nvlist_prtctlop_string' mangled-name='nvlist_prtctlop_string' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvlist_prtctlop_string'> <parameter type-id='b0c1ff8d' name='pctl'/> - <parameter type-id='2809de35' name='func'/> + <parameter type-id='b38a1022' name='func'/> <parameter type-id='eaa32e2f' name='private'/> <return type-id='48b5725f'/> </function-decl> @@ -1358,7 +1364,7 @@ </function-decl> <function-decl name='nvlist_prtctlop_string_array' mangled-name='nvlist_prtctlop_string_array' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvlist_prtctlop_string_array'> <parameter type-id='b0c1ff8d' name='pctl'/> - <parameter type-id='90d5edb9' name='func'/> + <parameter type-id='6263eda4' name='func'/> <parameter type-id='eaa32e2f' name='private'/> <return type-id='48b5725f'/> </function-decl> @@ -1393,16 +1399,16 @@ <function-decl name='nvpair_value_match_regex' mangled-name='nvpair_value_match_regex' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvpair_value_match_regex'> <parameter type-id='3fa542f0' name='nvp'/> <parameter type-id='95e97e5e' name='ai'/> - <parameter type-id='26a90f95' name='value'/> + <parameter type-id='80f4b756' name='value'/> <parameter type-id='d33f11cb' name='value_regex'/> - <parameter type-id='9b23c9ad' name='ep'/> + <parameter type-id='7d3cd834' name='ep'/> <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvpair_value_match' mangled-name='nvpair_value_match' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvpair_value_match'> <parameter type-id='3fa542f0' name='nvp'/> <parameter type-id='95e97e5e' name='ai'/> - <parameter type-id='26a90f95' name='value'/> - <parameter type-id='9b23c9ad' name='ep'/> + <parameter type-id='80f4b756' name='value'/> + <parameter type-id='7d3cd834' name='ep'/> <return type-id='95e97e5e'/> </function-decl> <function-type size-in-bits='64' id='9f88f76e'> @@ -1414,20 +1420,20 @@ <parameter type-id='3502e3ff'/> <return type-id='95e97e5e'/> </function-type> - <function-type size-in-bits='64' id='c5bb1a2b'> + <function-type size-in-bits='64' id='889f3b42'> <parameter type-id='196db161'/> <parameter type-id='eaa32e2f'/> <parameter type-id='5ce45b60'/> <parameter type-id='80f4b756'/> - <parameter type-id='26a90f95'/> + <parameter type-id='80f4b756'/> <return type-id='95e97e5e'/> </function-type> - <function-type size-in-bits='64' id='573fea1b'> + <function-type size-in-bits='64' id='49055dd8'> <parameter type-id='196db161'/> <parameter type-id='eaa32e2f'/> <parameter type-id='5ce45b60'/> <parameter type-id='80f4b756'/> - <parameter type-id='9b23c9ad'/> + <parameter type-id='7d3cd834'/> <parameter type-id='3502e3ff'/> <return type-id='95e97e5e'/> </function-type> @@ -1642,20 +1648,20 @@ <parameter type-id='3502e3ff'/> <return type-id='95e97e5e'/> </function-type> - <function-type size-in-bits='64' id='be7f4941'> + <function-type size-in-bits='64' id='78e3bec8'> <parameter type-id='b0c1ff8d'/> <parameter type-id='eaa32e2f'/> <parameter type-id='5ce45b60'/> <parameter type-id='80f4b756'/> - <parameter type-id='26a90f95'/> + <parameter type-id='80f4b756'/> <return type-id='95e97e5e'/> </function-type> - <function-type size-in-bits='64' id='fe5ae69d'> + <function-type size-in-bits='64' id='a5193bb2'> <parameter type-id='b0c1ff8d'/> <parameter type-id='eaa32e2f'/> <parameter type-id='5ce45b60'/> <parameter type-id='80f4b756'/> - <parameter type-id='9b23c9ad'/> + <parameter type-id='7d3cd834'/> <parameter type-id='3502e3ff'/> <return type-id='95e97e5e'/> </function-type> @@ -1930,8 +1936,8 @@ <return type-id='9c313c2d'/> </function-decl> <function-decl name='fnvpair_value_string' mangled-name='fnvpair_value_string' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='fnvpair_value_string'> - <parameter type-id='3fa542f0'/> - <return type-id='26a90f95'/> + <parameter type-id='dace003f'/> + <return type-id='80f4b756'/> </function-decl> <function-decl name='fnvpair_value_nvlist' mangled-name='fnvpair_value_nvlist' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='fnvpair_value_nvlist'> <parameter type-id='3fa542f0'/> @@ -2327,9 +2333,9 @@ <return type-id='9c313c2d'/> </function-decl> <function-decl name='fnvlist_lookup_string' mangled-name='fnvlist_lookup_string' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='fnvlist_lookup_string'> - <parameter type-id='5ce45b60' name='nvl'/> + <parameter type-id='22cce67b' name='nvl'/> <parameter type-id='80f4b756' name='name'/> - <return type-id='26a90f95'/> + <return type-id='80f4b756'/> </function-decl> <function-decl name='fnvlist_lookup_nvlist' mangled-name='fnvlist_lookup_nvlist' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='fnvlist_lookup_nvlist'> <parameter type-id='5ce45b60' name='nvl'/> @@ -2466,7 +2472,9 @@ <typedef-decl name='u_quad_t' type-id='5f3d50a6' id='bd226ac0'/> <pointer-type-def type-id='bc407f0e' size-in-bits='64' id='17fd1621'/> <pointer-type-def type-id='755707df' size-in-bits='64' id='812c6697'/> + <pointer-type-def type-id='26a90f95' size-in-bits='64' id='9b23c9ad'/> <qualified-type-def type-id='9b23c9ad' restrict='yes' id='8c85230f'/> + <pointer-type-def type-id='9b23c9ad' size-in-bits='64' id='c0563f85'/> <qualified-type-def type-id='c19b74c3' const='yes' id='12373e33'/> <pointer-type-def type-id='12373e33' size-in-bits='64' id='c5f6c15b'/> <qualified-type-def type-id='80f4b756' const='yes' id='b99c00c9'/> @@ -2925,9 +2933,9 @@ <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvlist_lookup_string' mangled-name='nvlist_lookup_string' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvlist_lookup_string'> - <parameter type-id='5ce45b60' name='nvl'/> + <parameter type-id='22cce67b' name='nvl'/> <parameter type-id='80f4b756' name='name'/> - <parameter type-id='9b23c9ad' name='val'/> + <parameter type-id='7d3cd834' name='val'/> <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvlist_lookup_nvlist' mangled-name='nvlist_lookup_nvlist' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvlist_lookup_nvlist'> @@ -3043,7 +3051,7 @@ <parameter type-id='80f4b756' name='name'/> <parameter type-id='0b283d2e' name='ret'/> <parameter type-id='7292109c' name='ip'/> - <parameter type-id='9b23c9ad' name='ep'/> + <parameter type-id='7d3cd834' name='ep'/> <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvlist_exists' mangled-name='nvlist_exists' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='nvlist_exists'> diff --git a/lib/libnvpair/libnvpair.c b/lib/libnvpair/libnvpair.c index a75e7316739f..f19ee707a5aa 100644 --- a/lib/libnvpair/libnvpair.c +++ b/lib/libnvpair/libnvpair.c @@ -70,7 +70,7 @@ struct nvlist_printops { DEFINEOP(print_int64, int64_t); DEFINEOP(print_uint64, uint64_t); DEFINEOP(print_double, double); - DEFINEOP(print_string, char *); + DEFINEOP(print_string, const char *); DEFINEOP(print_hrtime, hrtime_t); DEFINEOP(print_nvlist, nvlist_t *); DEFINEARROP(print_boolean_array, boolean_t *); @@ -83,7 +83,7 @@ struct nvlist_printops { DEFINEARROP(print_uint32_array, uint32_t *); DEFINEARROP(print_int64_array, int64_t *); DEFINEARROP(print_uint64_array, uint64_t *); - DEFINEARROP(print_string_array, char **); + DEFINEARROP(print_string_array, const char **); DEFINEARROP(print_nvlist_array, nvlist_t **); }; @@ -222,7 +222,7 @@ NVLIST_PRTFUNC(uint32, uint32_t, uint32_t, "0x%x") NVLIST_PRTFUNC(int64, int64_t, longlong_t, "%lld") NVLIST_PRTFUNC(uint64, uint64_t, u_longlong_t, "0x%llx") NVLIST_PRTFUNC(double, double, double, "0x%f") -NVLIST_PRTFUNC(string, char *, char *, "%s") +NVLIST_PRTFUNC(string, const char *, const char *, "%s") NVLIST_PRTFUNC(hrtime, hrtime_t, hrtime_t, "0x%llx") #if defined(__GNUC__) && !defined(__clang__) && \ defined(ZFS_UBSAN_ENABLED) && defined(HAVE_FORMAT_OVERFLOW) @@ -266,7 +266,7 @@ NVLIST_ARRPRTFUNC(int32_array, int32_t, int32_t, "%d") NVLIST_ARRPRTFUNC(uint32_array, uint32_t, uint32_t, "0x%x") NVLIST_ARRPRTFUNC(int64_array, int64_t, longlong_t, "%lld") NVLIST_ARRPRTFUNC(uint64_array, uint64_t, u_longlong_t, "0x%llx") -NVLIST_ARRPRTFUNC(string_array, char *, char *, "%s") +NVLIST_ARRPRTFUNC(string_array, const char *, const char *, "%s") static int nvprint_nvlist(nvlist_prtctl_t pctl, void *private, @@ -398,13 +398,13 @@ nvlist_prtctl_dofmt(nvlist_prtctl_t pctl, enum nvlist_prtctl_fmt which, ...) { FILE *fp = pctl->nvprt_fp; va_list ap; - char *name; + const char *name; va_start(ap, which); switch (which) { case NVLIST_FMT_MEMBER_NAME: - name = va_arg(ap, char *); + name = va_arg(ap, const char *); (void) fprintf(fp, pctl->nvprt_nmfmt, name); break; @@ -453,7 +453,7 @@ NVLIST_PRINTCTL_REPLACE(uint32, uint32_t) NVLIST_PRINTCTL_REPLACE(int64, int64_t) NVLIST_PRINTCTL_REPLACE(uint64, uint64_t) NVLIST_PRINTCTL_REPLACE(double, double) -NVLIST_PRINTCTL_REPLACE(string, char *) +NVLIST_PRINTCTL_REPLACE(string, const char *) NVLIST_PRINTCTL_REPLACE(hrtime, hrtime_t) NVLIST_PRINTCTL_REPLACE(nvlist, nvlist_t *) @@ -477,7 +477,7 @@ NVLIST_PRINTCTL_AREPLACE(int32_array, int32_t *) NVLIST_PRINTCTL_AREPLACE(uint32_array, uint32_t *) NVLIST_PRINTCTL_AREPLACE(int64_array, int64_t *) NVLIST_PRINTCTL_AREPLACE(uint64_array, uint64_t *) -NVLIST_PRINTCTL_AREPLACE(string_array, char **) +NVLIST_PRINTCTL_AREPLACE(string_array, const char **) NVLIST_PRINTCTL_AREPLACE(nvlist_array, nvlist_t **) /* @@ -580,7 +580,7 @@ static void nvlist_print_with_indent(nvlist_t *nvl, nvlist_prtctl_t pctl) { FILE *fp = pctl->nvprt_fp; - char *name; + const char *name; uint_t nelem; nvpair_t *nvp; @@ -670,7 +670,7 @@ nvlist_print_with_indent(nvlist_t *nvl, nvlist_prtctl_t pctl) break; } case DATA_TYPE_STRING: { - char *val; + const char *val; (void) nvpair_value_string(nvp, &val); RENDER(pctl, string, nvl, name, val); break; @@ -736,7 +736,7 @@ nvlist_print_with_indent(nvlist_t *nvl, nvlist_prtctl_t pctl) break; } case DATA_TYPE_STRING_ARRAY: { - char **val; + const char **val; (void) nvpair_value_string_array(nvp, &val, &nelem); ARENDER(pctl, string_array, nvl, name, val, nelem); break; @@ -866,7 +866,7 @@ dump_nvlist(nvlist_t *list, int indent) break; case DATA_TYPE_STRING: - NVP(elem, string, char *, char *, "'%s'"); + NVP(elem, string, const char *, const char *, "'%s'"); break; case DATA_TYPE_BYTE_ARRAY: @@ -907,7 +907,8 @@ dump_nvlist(nvlist_t *list, int indent) break; case DATA_TYPE_STRING_ARRAY: - NVPA(elem, string_array, char *, char *, "'%s'"); + NVPA(elem, string_array, const char *, const char *, + "'%s'"); break; case DATA_TYPE_NVLIST: @@ -961,11 +962,11 @@ dump_nvlist(nvlist_t *list, int indent) */ int nvpair_value_match_regex(nvpair_t *nvp, int ai, - char *value, regex_t *value_regex, char **ep) + const char *value, regex_t *value_regex, const char **ep) { - char *evalue; - uint_t a_len; - int sr; + const char *evalue; + uint_t a_len; + int sr; if (ep) *ep = NULL; @@ -993,7 +994,7 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai, sr = EOF; switch (nvpair_type(nvp)) { case DATA_TYPE_STRING: { - char *val; + const char *val; /* check string value for match */ if (nvpair_value_string(nvp, &val) == 0) { @@ -1009,7 +1010,7 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai, break; } case DATA_TYPE_STRING_ARRAY: { - char **val_array; + const char **val_array; /* check indexed string value of array for match */ if ((nvpair_value_string_array(nvp, &val_array, &a_len) == 0) && @@ -1285,7 +1286,7 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai, } int -nvpair_value_match(nvpair_t *nvp, int ai, char *value, char **ep) +nvpair_value_match(nvpair_t *nvp, int ai, const char *value, const char **ep) { return (nvpair_value_match_regex(nvp, ai, value, NULL, ep)); } diff --git a/lib/libnvpair/libnvpair_json.c b/lib/libnvpair/libnvpair_json.c index 19acea8f5094..b8029dd4d271 100644 --- a/lib/libnvpair/libnvpair_json.c +++ b/lib/libnvpair/libnvpair_json.c @@ -134,7 +134,7 @@ nvlist_print_json(FILE *fp, nvlist_t *nvl) switch (type) { case DATA_TYPE_STRING: { - char *string = fnvpair_value_string(curr); + const char *string = fnvpair_value_string(curr); if (nvlist_print_json_string(fp, string) == -1) return (-1); break; @@ -220,7 +220,7 @@ nvlist_print_json(FILE *fp, nvlist_t *nvl) } case DATA_TYPE_STRING_ARRAY: { - char **val; + const char **val; uint_t valsz, i; VERIFY0(nvpair_value_string_array(curr, &val, &valsz)); FPRINTF(fp, "["); diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 9d3c0379da18..99e1b8cdf695 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -2399,6 +2399,9 @@ <array-type-def dimensions='1' type-id='a84c031d' size-in-bits='65536' id='163f6aa5'> <subrange length='8192' type-id='7359adad' id='c88f397d'/> </array-type-def> + <array-type-def dimensions='1' type-id='a84c031d' size-in-bits='infinite' id='e84913bd'> + <subrange length='infinite' type-id='7359adad' id='031f2035'/> + </array-type-def> <array-type-def dimensions='1' type-id='9c313c2d' size-in-bits='128' id='c1c22e6c'> <subrange length='2' type-id='7359adad' id='52efc4ef'/> </array-type-def> @@ -2456,6 +2459,9 @@ <data-member access='public' layout-offset-in-bits='96'> <var-decl name='nvp_type' type-id='8d0687d2' visibility='default'/> </data-member> + <data-member access='public' layout-offset-in-bits='128'> + <var-decl name='nvp_name' type-id='e84913bd' visibility='default'/> + </data-member> </class-decl> <typedef-decl name='nvpair_t' type-id='1c34e459' id='57928edf'/> <class-decl name='drr_begin' size-in-bits='2432' is-struct='yes' visibility='default' id='09fcdc01'> @@ -2745,7 +2751,7 @@ </function-decl> <function-decl name='nvpair_name' visibility='default' binding='global' size-in-bits='64'> <parameter type-id='dace003f'/> - <return type-id='26a90f95'/> + <return type-id='80f4b756'/> </function-decl> <function-decl name='fnvpair_value_nvlist' visibility='default' binding='global' size-in-bits='64'> <parameter type-id='3fa542f0'/> @@ -3239,6 +3245,7 @@ <pointer-type-def type-id='79bd3751' size-in-bits='64' id='c65a1f29'/> <qualified-type-def type-id='9b23c9ad' restrict='yes' id='8c85230f'/> <qualified-type-def type-id='80f4b756' restrict='yes' id='9d26089a'/> + <pointer-type-def type-id='80f4b756' size-in-bits='64' id='7d3cd834'/> <qualified-type-def type-id='aca3bac8' const='yes' id='2498fd78'/> <pointer-type-def type-id='2498fd78' size-in-bits='64' id='eed6c816'/> <qualified-type-def type-id='eed6c816' restrict='yes' id='a431a9da'/> @@ -3351,9 +3358,9 @@ <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvlist_lookup_string' visibility='default' binding='global' size-in-bits='64'> - <parameter type-id='5ce45b60'/> + <parameter type-id='22cce67b'/> <parameter type-id='80f4b756'/> - <parameter type-id='9b23c9ad'/> + <parameter type-id='7d3cd834'/> <return type-id='95e97e5e'/> </function-decl> <function-decl name='fnvlist_alloc' visibility='default' binding='global' size-in-bits='64'> @@ -3803,7 +3810,6 @@ <pointer-type-def type-id='fba6cb51' size-in-bits='64' id='32adbf30'/> <pointer-type-def type-id='f20fbd51' size-in-bits='64' id='a3681dea'/> <qualified-type-def type-id='26a90f95' restrict='yes' id='266fe297'/> - <pointer-type-def type-id='80f4b756' size-in-bits='64' id='7d3cd834'/> <qualified-type-def type-id='56fe4a37' const='yes' id='a75125ce'/> <pointer-type-def type-id='a75125ce' size-in-bits='64' id='48bea5ec'/> <qualified-type-def type-id='8afd6070' const='yes' id='1d853360'/> @@ -4166,8 +4172,8 @@ <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvpair_value_string' visibility='default' binding='global' size-in-bits='64'> - <parameter type-id='3fa542f0'/> - <parameter type-id='9b23c9ad'/> + <parameter type-id='dace003f'/> + <parameter type-id='7d3cd834'/> <return type-id='95e97e5e'/> </function-decl> <function-decl name='fnvlist_free' visibility='default' binding='global' size-in-bits='64'> @@ -4203,9 +4209,9 @@ <return type-id='9c313c2d'/> </function-decl> <function-decl name='fnvlist_lookup_string' visibility='default' binding='global' size-in-bits='64'> - <parameter type-id='5ce45b60'/> + <parameter type-id='22cce67b'/> <parameter type-id='80f4b756'/> - <return type-id='26a90f95'/> + <return type-id='80f4b756'/> </function-decl> <function-decl name='fnvlist_lookup_nvlist' visibility='default' binding='global' size-in-bits='64'> <parameter type-id='5ce45b60'/> @@ -4418,7 +4424,7 @@ <function-decl name='getprop_uint64' mangled-name='getprop_uint64' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='getprop_uint64'> <parameter type-id='9200a744' name='zhp'/> <parameter type-id='58603c44' name='prop'/> - <parameter type-id='9b23c9ad' name='source'/> + <parameter type-id='7d3cd834' name='source'/> <return type-id='9c313c2d'/> </function-decl> <function-decl name='zfs_prop_get_recvd' mangled-name='zfs_prop_get_recvd' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_prop_get_recvd'> @@ -4688,7 +4694,7 @@ <parameter type-id='95e97e5e'/> <parameter type-id='2e45de5d'/> <parameter type-id='5ce45b60'/> - <parameter type-id='9b23c9ad'/> + <parameter type-id='7d3cd834'/> <parameter type-id='5d6479ae'/> <parameter type-id='80f4b756'/> <return type-id='95e97e5e'/> @@ -5993,8 +5999,8 @@ <return type-id='9da381c4'/> </function-decl> <function-decl name='fnvpair_value_string' visibility='default' binding='global' size-in-bits='64'> - <parameter type-id='3fa542f0'/> - <return type-id='26a90f95'/> + <parameter type-id='dace003f'/> + <return type-id='80f4b756'/> </function-decl> <function-decl name='zfeature_is_supported' mangled-name='zfeature_is_supported' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfeature_is_supported'> <parameter type-id='80f4b756'/> @@ -8140,8 +8146,8 @@ <function-decl name='label_paths' visibility='default' binding='global' size-in-bits='64'> <parameter type-id='5507783b'/> <parameter type-id='5ce45b60'/> - <parameter type-id='9b23c9ad'/> - <parameter type-id='9b23c9ad'/> + <parameter type-id='7d3cd834'/> + <parameter type-id='7d3cd834'/> <return type-id='95e97e5e'/> </function-decl> <function-decl name='zutil_alloc' visibility='default' binding='global' size-in-bits='64'> diff --git a/lib/libzfs/libzfs_crypto.c b/lib/libzfs/libzfs_crypto.c index e8351b22ff96..40059063e21a 100644 --- a/lib/libzfs/libzfs_crypto.c +++ b/lib/libzfs/libzfs_crypto.c @@ -942,7 +942,7 @@ proplist_has_encryption_props(nvlist_t *props) { int ret; uint64_t intval; - char *strval; + const char *strval; ret = nvlist_lookup_uint64(props, zfs_prop_to_name(ZFS_PROP_ENCRYPTION), &intval); @@ -1007,7 +1007,7 @@ zfs_crypto_create(libzfs_handle_t *hdl, char *parent_name, nvlist_t *props, char errbuf[ERRBUFLEN]; uint64_t crypt = ZIO_CRYPT_INHERIT, pcrypt = ZIO_CRYPT_INHERIT; uint64_t keyformat = ZFS_KEYFORMAT_NONE; - char *keylocation = NULL; + const char *keylocation = NULL; zfs_handle_t *pzhp = NULL; uint8_t *wkeydata = NULL; uint_t wkeylen = 0; @@ -1595,7 +1595,7 @@ zfs_crypto_rewrap(zfs_handle_t *zhp, nvlist_t *raw_props, boolean_t inheritkey) uint64_t crypt, pcrypt, keystatus, pkeystatus; uint64_t keyformat = ZFS_KEYFORMAT_NONE; zfs_handle_t *pzhp = NULL; - char *keylocation = NULL; + const char *keylocation = NULL; char origin_name[MAXNAMELEN]; char prop_keylocation[MAXNAMELEN]; char parent_name[ZFS_MAX_DATASET_NAME_LEN]; @@ -1705,7 +1705,7 @@ zfs_crypto_rewrap(zfs_handle_t *zhp, nvlist_t *raw_props, boolean_t inheritkey) /* default to prompt if no keylocation is specified */ if (keylocation == NULL) { - keylocation = (char *)"prompt"; + keylocation = "prompt"; ret = nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_KEYLOCATION), keylocation); diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 9ecb1ac5c6fb..8fa36fa95a17 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -1029,7 +1029,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, { nvpair_t *elem; uint64_t intval; - char *strval; + const char *strval; zfs_prop_t prop; nvlist_t *ret; int chosen_normal = -1; @@ -2065,7 +2065,7 @@ error: * extract them appropriately. */ uint64_t -getprop_uint64(zfs_handle_t *zhp, zfs_prop_t prop, char **source) +getprop_uint64(zfs_handle_t *zhp, zfs_prop_t prop, const char **source) { nvlist_t *nv; uint64_t value; @@ -2079,14 +2079,14 @@ getprop_uint64(zfs_handle_t *zhp, zfs_prop_t prop, char **source) verify(!zhp->zfs_props_table || zhp->zfs_props_table[prop] == B_TRUE); value = zfs_prop_default_numeric(prop); - *source = (char *)""; + *source = ""; } return (value); } static const char * -getprop_string(zfs_handle_t *zhp, zfs_prop_t prop, char **source) +getprop_string(zfs_handle_t *zhp, zfs_prop_t prop, const char **source) { nvlist_t *nv; const char *value; @@ -2100,7 +2100,7 @@ getprop_string(zfs_handle_t *zhp, zfs_prop_t prop, char **source) verify(!zhp->zfs_props_table || zhp->zfs_props_table[prop] == B_TRUE); value = zfs_prop_default_string(prop); - *source = (char *)""; + *source = ""; } return (value); @@ -2138,7 +2138,7 @@ zfs_unset_recvd_props_mode(zfs_handle_t *zhp, uintptr_t *cookie) */ static int get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src, - char **source, uint64_t *val) + const char **source, uint64_t *val) { zfs_cmd_t zc = {"\0"}; nvlist_t *zplprops = NULL; @@ -2370,7 +2370,7 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src, * Calculate the source type, given the raw source string. */ static void -get_source(zfs_handle_t *zhp, zprop_source_t *srctype, char *source, +get_source(zfs_handle_t *zhp, zprop_source_t *srctype, const char *source, char *statbuf, size_t statlen) { if (statbuf == NULL || @@ -2418,7 +2418,7 @@ zfs_prop_get_recvd(zfs_handle_t *zhp, const char *propname, char *propbuf, zfs_unset_recvd_props_mode(zhp, &cookie); } else { nvlist_t *propval; - char *recvdval; + const char *recvdval; if (nvlist_lookup_nvlist(zhp->zfs_recvd_props, propname, &propval) != 0) return (-1); @@ -2620,7 +2620,7 @@ zcp_check(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t intval, (u_longlong_t)intval, (u_longlong_t)ans); } } else { - char *str_ans; + const char *str_ans; error = nvlist_lookup_string(retnvl, "value", &str_ans); if (error != 0) { (void) fprintf(stderr, "%s: zcp check error: " @@ -2652,7 +2652,7 @@ int zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen, zprop_source_t *src, char *statbuf, size_t statlen, boolean_t literal) { - char *source = NULL; + const char *source = NULL; uint64_t val; const char *str; const char *strval; @@ -3053,7 +3053,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen, uint64_t zfs_prop_get_int(zfs_handle_t *zhp, zfs_prop_t prop) { - char *source; + const char *source; uint64_t val = 0; (void) get_numeric_property(zhp, prop, NULL, &source, &val); @@ -3077,7 +3077,7 @@ int zfs_prop_get_numeric(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t *value, zprop_source_t *src, char *statbuf, size_t statlen) { - char *source; + const char *source; /* * Check to see if this property applies to our object @@ -4698,7 +4698,7 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received, zprop_list_t **last, **start; nvlist_t *userprops, *propval; nvpair_t *elem; - char *strval; + const char *strval; char buf[ZFS_MAXPROPLEN]; if (zprop_expand_list(hdl, plp, ZFS_TYPE_DATASET) != 0) @@ -5484,7 +5484,7 @@ volsize_from_vdevs(zpool_handle_t *zhp, uint64_t nblocks, uint64_t blksize) } for (int v = 0; v < nvdevs; v++) { - char *type; + const char *type; uint64_t nparity, ashift, asize, tsize; uint64_t volsize; @@ -5566,7 +5566,7 @@ zvol_volsize_to_reservation(zpool_handle_t *zph, uint64_t volsize, uint64_t numdb; uint64_t nblocks, volblocksize; int ncopies; - char *strval; + const char *strval; if (nvlist_lookup_string(props, zfs_prop_to_name(ZFS_PROP_COPIES), &strval) == 0) diff --git a/lib/libzfs/libzfs_impl.h b/lib/libzfs/libzfs_impl.h index 64de6d7b22b4..ef0359f45ea0 100644 --- a/lib/libzfs/libzfs_impl.h +++ b/lib/libzfs/libzfs_impl.h @@ -140,7 +140,7 @@ extern zfs_handle_t *make_dataset_handle_zc(libzfs_handle_t *, zfs_cmd_t *); extern zfs_handle_t *make_dataset_simple_handle_zc(zfs_handle_t *, zfs_cmd_t *); extern int zprop_parse_value(libzfs_handle_t *, nvpair_t *, int, zfs_type_t, - nvlist_t *, char **, uint64_t *, const char *); + nvlist_t *, const char **, uint64_t *, const char *); extern int zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp, zfs_type_t type); diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c index 5023f06f7cad..2a7c5a76a0a6 100644 --- a/lib/libzfs/libzfs_import.c +++ b/lib/libzfs/libzfs_import.c @@ -280,7 +280,7 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr, boolean_t *inuse) { nvlist_t *config; - char *name = NULL; + const char *name = NULL; boolean_t ret; uint64_t guid = 0, vdev_guid; zpool_handle_t *zhp; diff --git a/lib/libzfs/libzfs_iter.c b/lib/libzfs/libzfs_iter.c index 55cb7a8b5035..681fe5b4748d 100644 --- a/lib/libzfs/libzfs_iter.c +++ b/lib/libzfs/libzfs_iter.c @@ -224,7 +224,7 @@ zfs_iter_bookmarks(zfs_handle_t *zhp, int flags __maybe_unused, for (pair = nvlist_next_nvpair(bmarks, NULL); pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) { char name[ZFS_MAX_DATASET_NAME_LEN]; - char *bmark_name; + const char *bmark_name; nvlist_t *bmark_props; bmark_name = nvpair_name(pair); diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index 8612e082ba34..024f449baa0b 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -291,7 +291,7 @@ static int zfs_add_option(zfs_handle_t *zhp, char *options, int len, zfs_prop_t prop, const char *on, const char *off) { - char *source; + const char *source; uint64_t value; /* Skip adding duplicate default options */ diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index ac25ecf9e1aa..f9b7cc004d6b 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -459,9 +459,9 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname, nvpair_t *elem; nvlist_t *retprops; zpool_prop_t prop; - char *strval; + const char *strval; uint64_t intval; - char *slash, *check; + const char *slash, *check; struct stat64 statbuf; zpool_handle_t *zhp; char report[1024]; @@ -689,12 +689,12 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname, goto error; } - *slash = '\0'; + *(char *)slash = '\0'; if (strval[0] != '\0' && (stat64(strval, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode))) { - *slash = '/'; + *(char *)slash = '/'; zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "'%s' is not a valid directory"), strval); @@ -702,7 +702,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname, goto error; } - *slash = '/'; + *(char *)slash = '/'; break; case ZPOOL_PROP_COMPATIBILITY: @@ -932,7 +932,7 @@ vdev_expand_proplist(zpool_handle_t *zhp, const char *vdevname, { zprop_list_t *entry; char buf[ZFS_MAXPROPLEN]; - char *strval = NULL; + const char *strval = NULL; int err = 0; nvpair_t *elem = NULL; nvlist_t *vprops = NULL; @@ -1290,7 +1290,7 @@ zpool_has_special_vdev(nvlist_t *nvroot) if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, &child, &children) == 0) { for (uint_t c = 0; c < children; c++) { - char *bias; + const char *bias; if (nvlist_lookup_string(child[c], ZPOOL_CONFIG_ALLOCATION_BIAS, &bias) == 0 && @@ -1314,7 +1314,7 @@ zpool_has_draid_vdev(nvlist_t *nvroot) if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, &child, &children) == 0) { for (uint_t c = 0; c < children; c++) { - char *type; + const char *type; if (nvlist_lookup_string(child[c], ZPOOL_CONFIG_TYPE, &type) == 0 && @@ -1394,7 +1394,7 @@ zpool_create(libzfs_handle_t *hdl, const char *pool, nvlist_t *nvroot, if (fsprops) { uint64_t zoned; - char *zonestr; + const char *zonestr; zoned = ((nvlist_lookup_string(fsprops, zfs_prop_to_name(ZFS_PROP_ZONED), &zonestr) == 0) && @@ -1987,7 +1987,7 @@ zpool_print_unsup_feat(nvlist_t *config) for (nvpair_t *nvp = nvlist_next_nvpair(unsup_feat, NULL); nvp != NULL; nvp = nvlist_next_nvpair(unsup_feat, nvp)) { - char *desc = fnvpair_value_string(nvp); + const char *desc = fnvpair_value_string(nvp); if (strlen(desc) > 0) (void) printf("\t%s (%s)\n", nvpair_name(nvp), desc); else @@ -2011,7 +2011,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname, nvlist_t *nvinfo = NULL; nvlist_t *missing = NULL; const char *thename; - char *origname; + const char *origname; int ret; int error = 0; char errbuf[ERRBUFLEN]; @@ -2239,7 +2239,7 @@ zpool_translate_vdev_guids(zpool_handle_t *zhp, nvlist_t *vds, elem = nvlist_next_nvpair(vds, elem)) { boolean_t spare, cache; - char *vd_path = nvpair_name(elem); + const char *vd_path = nvpair_name(elem); nvlist_t *tgt = zpool_find_vdev(zhp, vd_path, &spare, &cache, NULL); @@ -2353,7 +2353,7 @@ list_errors: for (elem = nvlist_next_nvpair(vd_errlist, NULL); elem != NULL; elem = nvlist_next_nvpair(vd_errlist, elem)) { int64_t vd_error = xlate_init_err(fnvpair_value_int64(elem)); - char *path; + const char *path; if (nvlist_lookup_string(guids_to_paths, nvpair_name(elem), &path) != 0) @@ -2451,7 +2451,7 @@ check_trim_errs(zpool_handle_t *zhp, trimflags_t *trim_flags, for (elem = nvlist_next_nvpair(errlist, NULL); elem != NULL; elem = nvlist_next_nvpair(errlist, elem)) { int64_t vd_error = xlate_trim_err(fnvpair_value_int64(elem)); - char *path; + const char *path; /* * If only the pool was specified, and it was not a secure @@ -2634,7 +2634,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare, nvlist_t **child; nvlist_t *ret; uint64_t is_log; - char *srchkey; + const char *srchkey; nvpair_t *pair = nvlist_next_nvpair(search, NULL); /* Nothing to look for */ @@ -2656,7 +2656,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare, break; case DATA_TYPE_STRING: { - char *srchval, *val; + const char *srchval, *val; srchval = fnvpair_value_string(pair); if (nvlist_lookup_string(nv, srchkey, &val) != 0) @@ -2969,7 +2969,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags, return (zfs_error(hdl, EZFS_ISSPARE, errbuf)); #ifndef __FreeBSD__ - char *pathname; + const char *pathname; if ((flags & ZFS_ONLINE_EXPAND || zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) && nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &pathname) == 0) { @@ -3181,7 +3181,8 @@ is_replacing_spare(nvlist_t *search, nvlist_t *tgt, int which) if (nvlist_lookup_nvlist_array(search, ZPOOL_CONFIG_CHILDREN, &child, &children) == 0) { - char *type = fnvlist_lookup_string(search, ZPOOL_CONFIG_TYPE); + const char *type = fnvlist_lookup_string(search, + ZPOOL_CONFIG_TYPE); if ((strcmp(type, VDEV_TYPE_SPARE) == 0 || strcmp(type, VDEV_TYPE_DRAID_SPARE) == 0) && children == 2 && child[which] == tgt) @@ -3484,7 +3485,8 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot, nvlist_t *props, splitflags_t flags) { zfs_cmd_t zc = {"\0"}; - char errbuf[ERRBUFLEN], *bias; + char errbuf[ERRBUFLEN]; + const char *bias; nvlist_t *tree, *config, **child, **newchild, *newconfig = NULL; nvlist_t **varray = NULL, *zc_props = NULL; uint_t c, children, newchildren, lastlog = 0, vcount, found = 0; @@ -3542,7 +3544,7 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot, for (c = 0; c < children; c++) { uint64_t is_log = B_FALSE, is_hole = B_FALSE; boolean_t is_special = B_FALSE, is_dedup = B_FALSE; - char *type; + const char *type; nvlist_t **mchild, *vdev; uint_t mchildren; int entry; @@ -4015,7 +4017,7 @@ char * zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, int name_flags) { - char *type, *tpath; + const char *type, *tpath; const char *path; uint64_t value; char buf[PATH_BUF_LEN]; diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 4b6e06df69be..23402f86a8ae 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -119,7 +119,7 @@ dump_record(dmu_replay_record_t *drr, void *payload, size_t payload_len, typedef struct fsavl_node { avl_node_t fn_node; nvlist_t *fn_nvfs; - char *fn_snapname; + const char *fn_snapname; uint64_t fn_guid; } fsavl_node_t; @@ -137,7 +137,7 @@ fsavl_compare(const void *arg1, const void *arg2) * (optionally) name. */ static nvlist_t * -fsavl_find(avl_tree_t *avl, uint64_t snapguid, char **snapname) +fsavl_find(avl_tree_t *avl, uint64_t snapguid, const char **snapname) { fsavl_node_t fn_find; fsavl_node_t *fn; @@ -384,7 +384,7 @@ send_iterate_prop(zfs_handle_t *zhp, boolean_t received_only, nvlist_t *nv) nvpair_t *elem = NULL; while ((elem = nvlist_next_nvpair(props, elem)) != NULL) { - char *propname = nvpair_name(elem); + const char *propname = nvpair_name(elem); zfs_prop_t prop = zfs_name_to_prop(propname); if (!zfs_prop_user(propname)) { @@ -412,7 +412,7 @@ send_iterate_prop(zfs_handle_t *zhp, boolean_t received_only, nvlist_t *nv) if (isspacelimit && zhp->zfs_type == ZFS_TYPE_SNAPSHOT) continue; - char *source; + const char *source; if (nvlist_lookup_string(propnv, ZPROP_SOURCE, &source) == 0) { if (strcmp(source, zhp->zfs_name) != 0 && strcmp(source, ZPROP_SOURCE_VAL_RECVD) != 0) @@ -428,7 +428,7 @@ send_iterate_prop(zfs_handle_t *zhp, boolean_t received_only, nvlist_t *nv) if (zfs_prop_user(propname) || zfs_prop_get_type(prop) == PROP_TYPE_STRING) { - char *value; + const char *value; value = fnvlist_lookup_string(propnv, ZPROP_VALUE); fnvlist_add_string(nv, propname, value); } else { @@ -1132,7 +1132,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) if (!sdd->doall && !isfromsnap && !istosnap) { if (sdd->replicate) { - char *snapname; + const char *snapname; nvlist_t *snapprops; /* * Filter out all intermediate snapshots except origin @@ -1372,7 +1372,7 @@ dump_filesystems(zfs_handle_t *rzhp, send_dump_data_t *sdd) nvfs = fnvpair_value_nvlist(fspair); (void) nvlist_lookup_uint64(nvfs, "origin", &origin_guid); if (origin_guid != 0) { - char *snapname; + const char *snapname; nvlist_t *origin_nv = fsavl_find(sdd->fsavl, origin_guid, &snapname); if (origin_nv != NULL) { @@ -1391,7 +1391,7 @@ again: for (fspair = nvlist_next_nvpair(sdd->fss, NULL); fspair; fspair = nvlist_next_nvpair(sdd->fss, fspair)) { nvlist_t *fslist, *parent_nv; - char *fsname; + const char *fsname; zfs_handle_t *zhp; int err; uint64_t origin_guid = 0; @@ -1757,8 +1757,8 @@ zfs_send_resume_impl_cb_impl(libzfs_handle_t *hdl, sendflags_t *flags, int outfd, nvlist_t *resume_nvl) { char errbuf[ERRBUFLEN]; - char *toname; - char *fromname = NULL; + const char *toname; + const char *fromname = NULL; uint64_t resumeobj, resumeoff, toguid, fromguid, bytes; zfs_handle_t *zhp; int error = 0; @@ -3254,7 +3254,7 @@ created_before(libzfs_handle_t *hdl, avl_tree_t *avl, uint64_t guid1, uint64_t guid2) { nvlist_t *nvfs; - char *fsname = NULL, *snapname = NULL; + const char *fsname = NULL, *snapname = NULL; char buf[ZFS_MAX_DATASET_NAME_LEN]; int rv; zfs_handle_t *guid1hdl, *guid2hdl; @@ -3320,7 +3320,7 @@ recv_fix_encryption_hierarchy(libzfs_handle_t *hdl, const char *top_zfs, nvpair_t *snapel = NULL; boolean_t is_encroot, is_clone, stream_encroot; char *cp; - char *stream_keylocation = NULL; + const char *stream_keylocation = NULL; char keylocation[MAXNAMELEN]; char fsname[ZFS_MAX_DATASET_NAME_LEN]; @@ -3440,12 +3440,12 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs, nvlist_t *local_nv, *deleted = NULL; avl_tree_t *local_avl; nvpair_t *fselem, *nextfselem; - char *fromsnap; + const char *fromsnap; char newname[ZFS_MAX_DATASET_NAME_LEN]; char guidname[32]; int error; boolean_t needagain, progress, recursive; - char *s1, *s2; + const char *s1, *s2; fromsnap = fnvlist_lookup_string(stream_nv, "fromsnap"); @@ -3477,7 +3477,7 @@ again: uint64_t originguid = 0; uint64_t stream_originguid = 0; uint64_t parent_fromsnap_guid, stream_parent_fromsnap_guid; - char *fsname, *stream_fsname; + const char *fsname, *stream_fsname; nextfselem = nvlist_next_nvpair(local_nv, fselem); @@ -3512,7 +3512,7 @@ again: case 1: { /* promote it! */ nvlist_t *origin_nvfs; - char *origin_fsname; + const char *origin_fsname; origin_nvfs = fsavl_find(local_avl, originguid, NULL); @@ -3543,7 +3543,7 @@ again: for (snapelem = nvlist_next_nvpair(snaps, NULL); snapelem; snapelem = nextsnapelem) { uint64_t thisguid; - char *stream_snapname; + const char *stream_snapname; nvlist_t *found, *props; nextsnapelem = nvlist_next_nvpair(snaps, snapelem); @@ -3689,7 +3689,7 @@ again: * new fs. */ if (parent != NULL) { - char *pname; + const char *pname; pname = fnvlist_lookup_string(parent, "name"); (void) snprintf(tryname, sizeof (tryname), @@ -3740,8 +3740,8 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname, { nvlist_t *stream_nv = NULL; avl_tree_t *stream_avl = NULL; - char *fromsnap = NULL; - char *sendsnap = NULL; + const char *fromsnap = NULL; + const char *sendsnap = NULL; char *cp; char tofs[ZFS_MAX_DATASET_NAME_LEN]; char sendfs[ZFS_MAX_DATASET_NAME_LEN]; @@ -4230,7 +4230,7 @@ zfs_setup_cmdline_props(libzfs_handle_t *hdl, zfs_type_t type, */ if (nvlist_exists(origprops, newname)) { nvlist_t *attrs; - char *source = NULL; + const char *source = NULL; attrs = fnvlist_lookup_nvlist(origprops, newname); @@ -4354,7 +4354,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, zprop_errflags_t prop_errflags; nvlist_t *prop_errors = NULL; boolean_t recursive; - char *snapname = NULL; + const char *snapname = NULL; char destsnap[MAXPATHLEN * 2]; char origin[MAXNAMELEN] = {0}; char name[MAXPATHLEN]; @@ -4385,7 +4385,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, boolean_t holds = flags->holds && !flags->skipholds; if (stream_avl != NULL) { - char *keylocation = NULL; + const char *keylocation = NULL; nvlist_t *lookup = NULL; nvlist_t *fs = fsavl_find(stream_avl, drrb->drr_toguid, &snapname); @@ -5503,7 +5503,7 @@ zfs_receive(libzfs_handle_t *hdl, const char *tosnap, nvlist_t *props, char *top_zfs = NULL; int err; struct stat sb; - char *originsnap = NULL; + const char *originsnap = NULL; /* * The only way fstat can fail is if we do not have a valid file diff --git a/lib/libzfs/libzfs_status.c b/lib/libzfs/libzfs_status.c index 27bb4476d706..a2259eee91ca 100644 --- a/lib/libzfs/libzfs_status.c +++ b/lib/libzfs/libzfs_status.c @@ -168,7 +168,8 @@ find_vdev_problem(nvlist_t *vdev, int (*func)(vdev_stat_t *, uint_t), * later. */ if (ignore_replacing == B_TRUE) { - char *type = fnvlist_lookup_string(vdev, ZPOOL_CONFIG_TYPE); + const char *type = fnvlist_lookup_string(vdev, + ZPOOL_CONFIG_TYPE); if (strcmp(type, VDEV_TYPE_REPLACING) == 0) return (B_FALSE); } diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 2507bfecdc9b..b0d7b2afaf7b 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1595,13 +1595,13 @@ zfs_nicestrtonum(libzfs_handle_t *hdl, const char *value, uint64_t *num) */ int zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop, - zfs_type_t type, nvlist_t *ret, char **svalp, uint64_t *ivalp, + zfs_type_t type, nvlist_t *ret, const char **svalp, uint64_t *ivalp, const char *errbuf) { data_type_t datatype = nvpair_type(elem); zprop_type_t proptype; const char *propname; - char *value; + const char *value; boolean_t isnone = B_FALSE; boolean_t isauto = B_FALSE; int err = 0; diff --git a/lib/libzfs/os/linux/libzfs_pool_os.c b/lib/libzfs/os/linux/libzfs_pool_os.c index cab12d39e6e4..401151b1afb5 100644 --- a/lib/libzfs/os/linux/libzfs_pool_os.c +++ b/lib/libzfs/os/linux/libzfs_pool_os.c @@ -96,7 +96,7 @@ zpool_relabel_disk(libzfs_handle_t *hdl, const char *path, const char *msg) static int read_efi_label(nvlist_t *config, diskaddr_t *sb) { - char *path; + const char *path; int fd; char diskname[MAXPATHLEN]; int err = -1; diff --git a/lib/libzfs_core/libzfs_core.abi b/lib/libzfs_core/libzfs_core.abi index 26a4339e7fab..ec94a4650553 100644 --- a/lib/libzfs_core/libzfs_core.abi +++ b/lib/libzfs_core/libzfs_core.abi @@ -1061,6 +1061,9 @@ <array-type-def dimensions='1' type-id='a84c031d' size-in-bits='65536' id='163f6aa5'> <subrange length='8192' type-id='7359adad' id='c88f397d'/> </array-type-def> + <array-type-def dimensions='1' type-id='a84c031d' size-in-bits='infinite' id='e84913bd'> + <subrange length='infinite' type-id='7359adad' id='031f2035'/> + </array-type-def> <class-decl name='_IO_codecvt' is-struct='yes' visibility='default' is-declaration-only='yes' id='a4036571'/> <class-decl name='_IO_marker' is-struct='yes' visibility='default' is-declaration-only='yes' id='010ae0b9'/> <class-decl name='_IO_wide_data' is-struct='yes' visibility='default' is-declaration-only='yes' id='79bd3751'/> @@ -1325,6 +1328,9 @@ <data-member access='public' layout-offset-in-bits='96'> <var-decl name='nvp_type' type-id='8d0687d2' visibility='default'/> </data-member> + <data-member access='public' layout-offset-in-bits='128'> + <var-decl name='nvp_name' type-id='e84913bd' visibility='default'/> + </data-member> </class-decl> <typedef-decl name='nvpair_t' type-id='1c34e459' id='57928edf'/> <class-decl name='nvlist' size-in-bits='192' is-struct='yes' visibility='default' id='ac266fd9'> @@ -2229,7 +2235,7 @@ </function-decl> <function-decl name='nvpair_name' visibility='default' binding='global' size-in-bits='64'> <parameter type-id='dace003f'/> - <return type-id='26a90f95'/> + <return type-id='80f4b756'/> </function-decl> <function-decl name='fnvlist_alloc' visibility='default' binding='global' size-in-bits='64'> <return type-id='5ce45b60'/> @@ -2317,9 +2323,9 @@ <return type-id='9c313c2d'/> </function-decl> <function-decl name='fnvlist_lookup_string' visibility='default' binding='global' size-in-bits='64'> - <parameter type-id='5ce45b60'/> + <parameter type-id='22cce67b'/> <parameter type-id='80f4b756'/> - <return type-id='26a90f95'/> + <return type-id='80f4b756'/> </function-decl> <function-decl name='libspl_assertf' mangled-name='libspl_assertf' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='libspl_assertf'> <parameter type-id='80f4b756'/> diff --git a/lib/libzfsbootenv/libzfsbootenv.abi b/lib/libzfsbootenv/libzfsbootenv.abi index 866106d5bb99..5903d5dcbe21 100644 --- a/lib/libzfsbootenv/libzfsbootenv.abi +++ b/lib/libzfsbootenv/libzfsbootenv.abi @@ -181,6 +181,7 @@ <qualified-type-def type-id='a84c031d' const='yes' id='9b45d938'/> <pointer-type-def type-id='9b45d938' size-in-bits='64' id='80f4b756'/> <qualified-type-def type-id='80f4b756' restrict='yes' id='9d26089a'/> + <pointer-type-def type-id='80f4b756' size-in-bits='64' id='7d3cd834'/> <qualified-type-def type-id='8e8d4be3' const='yes' id='693c3853'/> <pointer-type-def type-id='693c3853' size-in-bits='64' id='22cce67b'/> <pointer-type-def type-id='95942d0c' size-in-bits='64' id='b0382bb3'/> @@ -235,9 +236,9 @@ <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvlist_lookup_string' visibility='default' binding='global' size-in-bits='64'> - <parameter type-id='5ce45b60'/> + <parameter type-id='22cce67b'/> <parameter type-id='80f4b756'/> - <parameter type-id='9b23c9ad'/> + <parameter type-id='7d3cd834'/> <return type-id='95e97e5e'/> </function-decl> <function-decl name='nvlist_exists' visibility='default' binding='global' size-in-bits='64'> diff --git a/lib/libzfsbootenv/lzbe_device.c b/lib/libzfsbootenv/lzbe_device.c index 21007fd9ef50..894471a9bf35 100644 --- a/lib/libzfsbootenv/lzbe_device.c +++ b/lib/libzfsbootenv/lzbe_device.c @@ -116,7 +116,7 @@ lzbe_get_boot_device(const char *pool, char **device) libzfs_handle_t *hdl; zpool_handle_t *zphdl; nvlist_t *nv; - char *val; + const char *val; int rv = -1; if (pool == NULL || *pool == '\0' || device == NULL) @@ -140,14 +140,13 @@ lzbe_get_boot_device(const char *pool, char **device) * we only do need dataset name. */ if (strncmp(val, "zfs:", 4) == 0) { - val += 4; - val = strdup(val); - if (val != NULL) { - size_t len = strlen(val); - - if (val[len - 1] == ':') - val[len - 1] = '\0'; - *device = val; + char *tmp = strdup(val + 4); + if (tmp != NULL) { + size_t len = strlen(tmp); + + if (tmp[len - 1] == ':') + tmp[len - 1] = '\0'; + *device = tmp; } else { rv = ENOMEM; } diff --git a/lib/libzpool/util.c b/lib/libzpool/util.c index 551f1294d31f..b9503d4e56d0 100644 --- a/lib/libzpool/util.c +++ b/lib/libzpool/util.c @@ -65,7 +65,7 @@ show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent) if (desc != NULL) { const char *suffix = ""; - char *bias = NULL; + const char *bias = NULL; char bias_suffix[32]; (void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_LOG, &is_log); @@ -113,12 +113,13 @@ show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent) for (c = 0; c < children; c++) { nvlist_t *cnv = child[c]; - char *cname = NULL, *tname; + const char *cname = NULL; + char *tname; uint64_t np; int len; if (nvlist_lookup_string(cnv, ZPOOL_CONFIG_PATH, &cname) && nvlist_lookup_string(cnv, ZPOOL_CONFIG_TYPE, &cname)) - cname = (char *)"<unknown>"; + cname = "<unknown>"; len = strlen(cname) + 2; tname = umem_zalloc(len, UMEM_NOFAIL); (void) strlcpy(tname, cname, len); @@ -133,7 +134,7 @@ void show_pool_stats(spa_t *spa) { nvlist_t *config, *nvroot; - char *name; + const char *name; VERIFY(spa_get_stats(spa_name(spa), &config, NULL, 0) == 0); diff --git a/lib/libzutil/os/linux/zutil_import_os.c b/lib/libzutil/os/linux/zutil_import_os.c index eb2417b47987..8b64369dc29f 100644 --- a/lib/libzutil/os/linux/zutil_import_os.c +++ b/lib/libzutil/os/linux/zutil_import_os.c @@ -168,9 +168,9 @@ zpool_open_func(void *arg) * Add additional entries for paths described by this label. */ if (rn->rn_labelpaths) { - char *path = NULL; - char *devid = NULL; - char *env = NULL; + const char *path = NULL; + const char *devid = NULL; + const char *env = NULL; rdsk_node_t *slice; avl_index_t where; int timeout; @@ -769,7 +769,7 @@ no_dev: * vdev_enc_sysfs_path: '/sys/class/enclosure/11:0:1:0/SLOT 4' */ static void -update_vdev_config_dev_sysfs_path(nvlist_t *nv, char *path) +update_vdev_config_dev_sysfs_path(nvlist_t *nv, const char *path) { char *upath, *spath; @@ -795,7 +795,7 @@ sysfs_path_pool_vdev_iter_f(void *hdl_data, nvlist_t *nv, void *data) { (void) hdl_data, (void) data; - char *path = NULL; + const char *path = NULL; if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) != 0) return (1); @@ -841,7 +841,7 @@ void update_vdev_config_dev_strs(nvlist_t *nv) { vdev_dev_strs_t vds; - char *env, *type, *path; + const char *env, *type, *path; uint64_t wholedisk = 0; /* diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c index 7c86054f05b5..65f462e42cd0 100644 --- a/lib/libzutil/zutil_import.c +++ b/lib/libzutil/zutil_import.c @@ -233,7 +233,7 @@ fix_paths(libpc_handle_t *hdl, nvlist_t *nv, name_entry_t *names) uint_t c, children; uint64_t guid; name_entry_t *ne, *best; - char *path; + const char *path; if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) == 0) { @@ -497,7 +497,7 @@ get_configs(libpc_handle_t *hdl, pool_list_t *pl, boolean_t active_ok, uint_t i, nspares, nl2cache; boolean_t config_seen; uint64_t best_txg; - char *name, *hostname = NULL; + const char *name, *hostname = NULL; uint64_t guid; uint_t children = 0; nvlist_t **child = NULL; @@ -591,8 +591,8 @@ get_configs(libpc_handle_t *hdl, pool_list_t *pl, boolean_t active_ok, * hostname (if available) */ uint64_t state, version; - char *comment = NULL; - char *compatibility = NULL; + const char *comment = NULL; + const char *compatibility = NULL; version = fnvlist_lookup_uint64(tmp, ZPOOL_CONFIG_VERSION); @@ -1161,12 +1161,12 @@ slice_cache_compare(const void *arg1, const void *arg2) static int label_paths_impl(libpc_handle_t *hdl, nvlist_t *nvroot, uint64_t pool_guid, - uint64_t vdev_guid, char **path, char **devid) + uint64_t vdev_guid, const char **path, const char **devid) { nvlist_t **child; uint_t c, children; uint64_t guid; - char *val; + const char *val; int error; if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, @@ -1204,7 +1204,8 @@ label_paths_impl(libpc_handle_t *hdl, nvlist_t *nvroot, uint64_t pool_guid, * The returned pointers are only valid as long as label remains valid. */ int -label_paths(libpc_handle_t *hdl, nvlist_t *label, char **path, char **devid) +label_paths(libpc_handle_t *hdl, nvlist_t *label, const char **path, + const char **devid) { nvlist_t *nvroot; uint64_t pool_guid; @@ -1473,7 +1474,7 @@ zpool_find_import_impl(libpc_handle_t *hdl, importargs_t *iarg, } if (iarg->poolname != NULL && !aux) { - char *pname; + const char *pname; matched = nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &pname) == 0 && @@ -1547,7 +1548,7 @@ static int discover_cached_paths(libpc_handle_t *hdl, nvlist_t *nv, avl_tree_t *cache, pthread_mutex_t *lock) { - char *path = NULL; + const char *path = NULL; ssize_t dl; uint_t children; nvlist_t **child; @@ -1567,15 +1568,17 @@ discover_cached_paths(libpc_handle_t *hdl, nvlist_t *nv, int ret; char c = '\0'; if ((dl = zfs_dirnamelen(path)) == -1) { - path = (char *)"."; + path = "."; } else { c = path[dl]; - path[dl] = '\0'; + ((char *)path)[dl] = '\0'; + } ret = zpool_find_import_scan_dir(hdl, lock, cache, path, 0); if (c != '\0') - path[dl] = c; + ((char *)path)[dl] = c; + return (ret); } return (0); @@ -1595,7 +1598,7 @@ zpool_find_import_cached(libpc_handle_t *hdl, importargs_t *iarg) nvlist_t *raw, *src, *dst; nvlist_t *pools; nvpair_t *elem; - char *name; + const char *name; uint64_t this_guid; boolean_t active; @@ -1825,10 +1828,10 @@ zpool_search_import(libpc_handle_t *hdl, importargs_t *import) } static boolean_t -pool_match(nvlist_t *cfg, char *tgt) +pool_match(nvlist_t *cfg, const char *tgt) { uint64_t v, guid = strtoull(tgt, NULL, 0); - char *s; + const char *s; if (guid != 0) { if (nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_POOL_GUID, &v) == 0) @@ -1913,7 +1916,7 @@ for_each_vdev_cb(void *zhp, nvlist_t *nv, pool_vdev_iter_f func, uint_t c, children; int ret = 0; int i; - char *type; + const char *type; const char *list[] = { ZPOOL_CONFIG_SPARES, diff --git a/lib/libzutil/zutil_import.h b/lib/libzutil/zutil_import.h index f851a91132ce..da7941fa5307 100644 --- a/lib/libzutil/zutil_import.h +++ b/lib/libzutil/zutil_import.h @@ -33,8 +33,8 @@ #define IMPORT_ORDER_SCAN_OFFSET 10 #define IMPORT_ORDER_DEFAULT 100 -int label_paths(libpc_handle_t *hdl, nvlist_t *label, char **path, - char **devid); +int label_paths(libpc_handle_t *hdl, nvlist_t *label, const char **path, + const char **devid); int zpool_find_import_blkid(libpc_handle_t *hdl, pthread_mutex_t *lock, avl_tree_t **slice_cache); |