diff options
Diffstat (limited to 'lib/libnvpair')
-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 |
3 files changed, 64 insertions, 55 deletions
diff --git a/lib/libnvpair/libnvpair.abi b/lib/libnvpair/libnvpair.abi index 5900a6551..ef92f3e9b 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 a75e73167..f19ee707a 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 19acea8f5..b8029dd4d 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, "["); |