aboutsummaryrefslogtreecommitdiffstats
path: root/module/nvpair
diff options
context:
space:
mode:
authorPaul Dagnelie <[email protected]>2021-12-06 17:19:13 -0800
committerGitHub <[email protected]>2021-12-06 18:19:13 -0700
commit795075e63803db70793079c2176dc419df3788c5 (patch)
treebdec35b2b73d946efca2537691b114604f112ab8 /module/nvpair
parent14ba514af6110bcc3772db7c7cde787861588316 (diff)
Add `const` to nvlist functions to properly expose their real behavior
Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Nguyen <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes #12728
Diffstat (limited to 'module/nvpair')
-rw-r--r--module/nvpair/fnvpair.c74
-rw-r--r--module/nvpair/nvpair.c144
2 files changed, 122 insertions, 96 deletions
diff --git a/module/nvpair/fnvpair.c b/module/nvpair/fnvpair.c
index dc8257e48..3a4f07486 100644
--- a/module/nvpair/fnvpair.c
+++ b/module/nvpair/fnvpair.c
@@ -102,7 +102,7 @@ fnvlist_unpack(char *buf, size_t buflen)
}
nvlist_t *
-fnvlist_dup(nvlist_t *nvl)
+fnvlist_dup(const nvlist_t *nvl)
{
nvlist_t *rv;
VERIFY0(nvlist_dup(nvl, &rv, KM_SLEEP));
@@ -213,78 +213,84 @@ fnvlist_add_nvpair(nvlist_t *nvl, nvpair_t *pair)
void
fnvlist_add_boolean_array(nvlist_t *nvl, const char *name,
- boolean_t *val, uint_t n)
+ const boolean_t *val, uint_t n)
{
VERIFY0(nvlist_add_boolean_array(nvl, name, val, n));
}
void
-fnvlist_add_byte_array(nvlist_t *nvl, const char *name, uchar_t *val, uint_t n)
+fnvlist_add_byte_array(nvlist_t *nvl, const char *name, const uchar_t *val,
+ uint_t n)
{
VERIFY0(nvlist_add_byte_array(nvl, name, val, n));
}
void
-fnvlist_add_int8_array(nvlist_t *nvl, const char *name, int8_t *val, uint_t n)
+fnvlist_add_int8_array(nvlist_t *nvl, const char *name, const int8_t *val,
+ uint_t n)
{
VERIFY0(nvlist_add_int8_array(nvl, name, val, n));
}
void
-fnvlist_add_uint8_array(nvlist_t *nvl, const char *name, uint8_t *val, uint_t n)
+fnvlist_add_uint8_array(nvlist_t *nvl, const char *name, const uint8_t *val,
+ uint_t n)
{
VERIFY0(nvlist_add_uint8_array(nvl, name, val, n));
}
void
-fnvlist_add_int16_array(nvlist_t *nvl, const char *name, int16_t *val, uint_t n)
+fnvlist_add_int16_array(nvlist_t *nvl, const char *name, const int16_t *val,
+ uint_t n)
{
VERIFY0(nvlist_add_int16_array(nvl, name, val, n));
}
void
fnvlist_add_uint16_array(nvlist_t *nvl, const char *name,
- uint16_t *val, uint_t n)
+ const uint16_t *val, uint_t n)
{
VERIFY0(nvlist_add_uint16_array(nvl, name, val, n));
}
void
-fnvlist_add_int32_array(nvlist_t *nvl, const char *name, int32_t *val, uint_t n)
+fnvlist_add_int32_array(nvlist_t *nvl, const char *name, const int32_t *val,
+ uint_t n)
{
VERIFY0(nvlist_add_int32_array(nvl, name, val, n));
}
void
fnvlist_add_uint32_array(nvlist_t *nvl, const char *name,
- uint32_t *val, uint_t n)
+ const uint32_t *val, uint_t n)
{
VERIFY0(nvlist_add_uint32_array(nvl, name, val, n));
}
void
-fnvlist_add_int64_array(nvlist_t *nvl, const char *name, int64_t *val, uint_t n)
+fnvlist_add_int64_array(nvlist_t *nvl, const char *name, const int64_t *val,
+ uint_t n)
{
VERIFY0(nvlist_add_int64_array(nvl, name, val, n));
}
void
fnvlist_add_uint64_array(nvlist_t *nvl, const char *name,
- uint64_t *val, uint_t n)
+ const uint64_t *val, uint_t n)
{
VERIFY0(nvlist_add_uint64_array(nvl, name, val, n));
}
void
fnvlist_add_string_array(nvlist_t *nvl, const char *name,
- char * const *val, uint_t n)
+ const char * const *val, uint_t n)
{
VERIFY0(nvlist_add_string_array(nvl, name, val, n));
}
void
fnvlist_add_nvlist_array(nvlist_t *nvl, const char *name,
- nvlist_t **val, uint_t n)
+ const nvlist_t * const *val, uint_t n)
{
VERIFY0(nvlist_add_nvlist_array(nvl, name, val, n));
}
@@ -311,13 +317,13 @@ fnvlist_lookup_nvpair(nvlist_t *nvl, const char *name)
/* returns B_TRUE if the entry exists */
boolean_t
-fnvlist_lookup_boolean(nvlist_t *nvl, const char *name)
+fnvlist_lookup_boolean(const nvlist_t *nvl, const char *name)
{
return (nvlist_lookup_boolean(nvl, name) == 0);
}
boolean_t
-fnvlist_lookup_boolean_value(nvlist_t *nvl, const char *name)
+fnvlist_lookup_boolean_value(const nvlist_t *nvl, const char *name)
{
boolean_t rv;
VERIFY0(nvlist_lookup_boolean_value(nvl, name, &rv));
@@ -325,7 +331,7 @@ fnvlist_lookup_boolean_value(nvlist_t *nvl, const char *name)
}
uchar_t
-fnvlist_lookup_byte(nvlist_t *nvl, const char *name)
+fnvlist_lookup_byte(const nvlist_t *nvl, const char *name)
{
uchar_t rv;
VERIFY0(nvlist_lookup_byte(nvl, name, &rv));
@@ -333,7 +339,7 @@ fnvlist_lookup_byte(nvlist_t *nvl, const char *name)
}
int8_t
-fnvlist_lookup_int8(nvlist_t *nvl, const char *name)
+fnvlist_lookup_int8(const nvlist_t *nvl, const char *name)
{
int8_t rv;
VERIFY0(nvlist_lookup_int8(nvl, name, &rv));
@@ -341,7 +347,7 @@ fnvlist_lookup_int8(nvlist_t *nvl, const char *name)
}
int16_t
-fnvlist_lookup_int16(nvlist_t *nvl, const char *name)
+fnvlist_lookup_int16(const nvlist_t *nvl, const char *name)
{
int16_t rv;
VERIFY0(nvlist_lookup_int16(nvl, name, &rv));
@@ -349,7 +355,7 @@ fnvlist_lookup_int16(nvlist_t *nvl, const char *name)
}
int32_t
-fnvlist_lookup_int32(nvlist_t *nvl, const char *name)
+fnvlist_lookup_int32(const nvlist_t *nvl, const char *name)
{
int32_t rv;
VERIFY0(nvlist_lookup_int32(nvl, name, &rv));
@@ -357,7 +363,7 @@ fnvlist_lookup_int32(nvlist_t *nvl, const char *name)
}
int64_t
-fnvlist_lookup_int64(nvlist_t *nvl, const char *name)
+fnvlist_lookup_int64(const nvlist_t *nvl, const char *name)
{
int64_t rv;
VERIFY0(nvlist_lookup_int64(nvl, name, &rv));
@@ -365,7 +371,7 @@ fnvlist_lookup_int64(nvlist_t *nvl, const char *name)
}
uint8_t
-fnvlist_lookup_uint8(nvlist_t *nvl, const char *name)
+fnvlist_lookup_uint8(const nvlist_t *nvl, const char *name)
{
uint8_t rv;
VERIFY0(nvlist_lookup_uint8(nvl, name, &rv));
@@ -373,7 +379,7 @@ fnvlist_lookup_uint8(nvlist_t *nvl, const char *name)
}
uint16_t
-fnvlist_lookup_uint16(nvlist_t *nvl, const char *name)
+fnvlist_lookup_uint16(const nvlist_t *nvl, const char *name)
{
uint16_t rv;
VERIFY0(nvlist_lookup_uint16(nvl, name, &rv));
@@ -381,7 +387,7 @@ fnvlist_lookup_uint16(nvlist_t *nvl, const char *name)
}
uint32_t
-fnvlist_lookup_uint32(nvlist_t *nvl, const char *name)
+fnvlist_lookup_uint32(const nvlist_t *nvl, const char *name)
{
uint32_t rv;
VERIFY0(nvlist_lookup_uint32(nvl, name, &rv));
@@ -389,7 +395,7 @@ fnvlist_lookup_uint32(nvlist_t *nvl, const char *name)
}
uint64_t
-fnvlist_lookup_uint64(nvlist_t *nvl, const char *name)
+fnvlist_lookup_uint64(const nvlist_t *nvl, const char *name)
{
uint64_t rv;
VERIFY0(nvlist_lookup_uint64(nvl, name, &rv));
@@ -492,7 +498,7 @@ fnvlist_lookup_uint64_array(nvlist_t *nvl, const char *name, uint_t *n)
}
boolean_t
-fnvpair_value_boolean_value(nvpair_t *nvp)
+fnvpair_value_boolean_value(const nvpair_t *nvp)
{
boolean_t rv;
VERIFY0(nvpair_value_boolean_value(nvp, &rv));
@@ -500,7 +506,7 @@ fnvpair_value_boolean_value(nvpair_t *nvp)
}
uchar_t
-fnvpair_value_byte(nvpair_t *nvp)
+fnvpair_value_byte(const nvpair_t *nvp)
{
uchar_t rv;
VERIFY0(nvpair_value_byte(nvp, &rv));
@@ -508,7 +514,7 @@ fnvpair_value_byte(nvpair_t *nvp)
}
int8_t
-fnvpair_value_int8(nvpair_t *nvp)
+fnvpair_value_int8(const nvpair_t *nvp)
{
int8_t rv;
VERIFY0(nvpair_value_int8(nvp, &rv));
@@ -516,7 +522,7 @@ fnvpair_value_int8(nvpair_t *nvp)
}
int16_t
-fnvpair_value_int16(nvpair_t *nvp)
+fnvpair_value_int16(const nvpair_t *nvp)
{
int16_t rv;
VERIFY0(nvpair_value_int16(nvp, &rv));
@@ -524,7 +530,7 @@ fnvpair_value_int16(nvpair_t *nvp)
}
int32_t
-fnvpair_value_int32(nvpair_t *nvp)
+fnvpair_value_int32(const nvpair_t *nvp)
{
int32_t rv;
VERIFY0(nvpair_value_int32(nvp, &rv));
@@ -532,7 +538,7 @@ fnvpair_value_int32(nvpair_t *nvp)
}
int64_t
-fnvpair_value_int64(nvpair_t *nvp)
+fnvpair_value_int64(const nvpair_t *nvp)
{
int64_t rv;
VERIFY0(nvpair_value_int64(nvp, &rv));
@@ -540,7 +546,7 @@ fnvpair_value_int64(nvpair_t *nvp)
}
uint8_t
-fnvpair_value_uint8(nvpair_t *nvp)
+fnvpair_value_uint8(const nvpair_t *nvp)
{
uint8_t rv;
VERIFY0(nvpair_value_uint8(nvp, &rv));
@@ -548,7 +554,7 @@ fnvpair_value_uint8(nvpair_t *nvp)
}
uint16_t
-fnvpair_value_uint16(nvpair_t *nvp)
+fnvpair_value_uint16(const nvpair_t *nvp)
{
uint16_t rv;
VERIFY0(nvpair_value_uint16(nvp, &rv));
@@ -556,7 +562,7 @@ fnvpair_value_uint16(nvpair_t *nvp)
}
uint32_t
-fnvpair_value_uint32(nvpair_t *nvp)
+fnvpair_value_uint32(const nvpair_t *nvp)
{
uint32_t rv;
VERIFY0(nvpair_value_uint32(nvp, &rv));
@@ -564,7 +570,7 @@ fnvpair_value_uint32(nvpair_t *nvp)
}
uint64_t
-fnvpair_value_uint64(nvpair_t *nvp)
+fnvpair_value_uint64(const nvpair_t *nvp)
{
uint64_t rv;
VERIFY0(nvpair_value_uint64(nvp, &rv));
diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c
index 9834dedd8..668e4a978 100644
--- a/module/nvpair/nvpair.c
+++ b/module/nvpair/nvpair.c
@@ -308,7 +308,7 @@ nvt_hash(const char *p)
}
static boolean_t
-nvt_nvpair_match(nvpair_t *nvp1, nvpair_t *nvp2, uint32_t nvflag)
+nvt_nvpair_match(const nvpair_t *nvp1, const nvpair_t *nvp2, uint32_t nvflag)
{
boolean_t match = B_FALSE;
if (nvflag & NV_UNIQUE_NAME_TYPE) {
@@ -324,9 +324,9 @@ nvt_nvpair_match(nvpair_t *nvp1, nvpair_t *nvp2, uint32_t nvflag)
}
static nvpair_t *
-nvt_lookup_name_type(nvlist_t *nvl, const char *name, data_type_t type)
+nvt_lookup_name_type(const nvlist_t *nvl, const char *name, data_type_t type)
{
- nvpriv_t *priv = (nvpriv_t *)(uintptr_t)nvl->nvl_priv;
+ const nvpriv_t *priv = (const nvpriv_t *)(uintptr_t)nvl->nvl_priv;
ASSERT(priv != NULL);
i_nvp_t **tab = priv->nvp_hashtable;
@@ -356,7 +356,7 @@ nvt_lookup_name_type(nvlist_t *nvl, const char *name, data_type_t type)
}
static nvpair_t *
-nvt_lookup_name(nvlist_t *nvl, const char *name)
+nvt_lookup_name(const nvlist_t *nvl, const char *name)
{
return (nvt_lookup_name_type(nvl, name, DATA_TYPE_DONTCARE));
}
@@ -462,7 +462,7 @@ nvt_shrink(nvpriv_t *priv)
}
static int
-nvt_remove_nvpair(nvlist_t *nvl, nvpair_t *nvp)
+nvt_remove_nvpair(nvlist_t *nvl, const nvpair_t *nvp)
{
nvpriv_t *priv = (nvpriv_t *)(uintptr_t)nvl->nvl_priv;
@@ -816,16 +816,16 @@ i_validate_nvpair(nvpair_t *nvp)
}
static int
-nvlist_copy_pairs(nvlist_t *snvl, nvlist_t *dnvl)
+nvlist_copy_pairs(const nvlist_t *snvl, nvlist_t *dnvl)
{
- nvpriv_t *priv;
- i_nvp_t *curr;
+ const nvpriv_t *priv;
+ const i_nvp_t *curr;
- if ((priv = (nvpriv_t *)(uintptr_t)snvl->nvl_priv) == NULL)
+ if ((priv = (const nvpriv_t *)(uintptr_t)snvl->nvl_priv) == NULL)
return (EINVAL);
for (curr = priv->nvp_list; curr != NULL; curr = curr->nvi_next) {
- nvpair_t *nvp = &curr->nvi_nvp;
+ const nvpair_t *nvp = &curr->nvi_nvp;
int err;
if ((err = nvlist_add_common(dnvl, NVP_NAME(nvp), NVP_TYPE(nvp),
@@ -896,10 +896,10 @@ nvlist_free(nvlist_t *nvl)
}
static int
-nvlist_contains_nvp(nvlist_t *nvl, nvpair_t *nvp)
+nvlist_contains_nvp(const nvlist_t *nvl, const nvpair_t *nvp)
{
- nvpriv_t *priv = (nvpriv_t *)(uintptr_t)nvl->nvl_priv;
- i_nvp_t *curr;
+ const nvpriv_t *priv = (const nvpriv_t *)(uintptr_t)nvl->nvl_priv;
+ const i_nvp_t *curr;
if (nvp == NULL)
return (0);
@@ -915,13 +915,13 @@ nvlist_contains_nvp(nvlist_t *nvl, nvpair_t *nvp)
* Make a copy of nvlist
*/
int
-nvlist_dup(nvlist_t *nvl, nvlist_t **nvlp, int kmflag)
+nvlist_dup(const nvlist_t *nvl, nvlist_t **nvlp, int kmflag)
{
return (nvlist_xdup(nvl, nvlp, nvlist_nv_alloc(kmflag)));
}
int
-nvlist_xdup(nvlist_t *nvl, nvlist_t **nvlp, nv_alloc_t *nva)
+nvlist_xdup(const nvlist_t *nvl, nvlist_t **nvlp, nv_alloc_t *nva)
{
int err;
nvlist_t *ret;
@@ -1356,68 +1356,77 @@ nvlist_add_string(nvlist_t *nvl, const char *name, const char *val)
int
nvlist_add_boolean_array(nvlist_t *nvl, const char *name,
- boolean_t *a, uint_t n)
+ const boolean_t *a, uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_BOOLEAN_ARRAY, n, a));
}
int
-nvlist_add_byte_array(nvlist_t *nvl, const char *name, uchar_t *a, uint_t n)
+nvlist_add_byte_array(nvlist_t *nvl, const char *name, const uchar_t *a,
+ uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_BYTE_ARRAY, n, a));
}
int
-nvlist_add_int8_array(nvlist_t *nvl, const char *name, int8_t *a, uint_t n)
+nvlist_add_int8_array(nvlist_t *nvl, const char *name, const int8_t *a,
+ uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_INT8_ARRAY, n, a));
}
int
-nvlist_add_uint8_array(nvlist_t *nvl, const char *name, uint8_t *a, uint_t n)
+nvlist_add_uint8_array(nvlist_t *nvl, const char *name, const uint8_t *a,
+ uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_UINT8_ARRAY, n, a));
}
int
-nvlist_add_int16_array(nvlist_t *nvl, const char *name, int16_t *a, uint_t n)
+nvlist_add_int16_array(nvlist_t *nvl, const char *name, const int16_t *a,
+ uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_INT16_ARRAY, n, a));
}
int
-nvlist_add_uint16_array(nvlist_t *nvl, const char *name, uint16_t *a, uint_t n)
+nvlist_add_uint16_array(nvlist_t *nvl, const char *name, const uint16_t *a,
+ uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_UINT16_ARRAY, n, a));
}
int
-nvlist_add_int32_array(nvlist_t *nvl, const char *name, int32_t *a, uint_t n)
+nvlist_add_int32_array(nvlist_t *nvl, const char *name, const int32_t *a,
+ uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_INT32_ARRAY, n, a));
}
int
-nvlist_add_uint32_array(nvlist_t *nvl, const char *name, uint32_t *a, uint_t n)
+nvlist_add_uint32_array(nvlist_t *nvl, const char *name, const uint32_t *a,
+ uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_UINT32_ARRAY, n, a));
}
int
-nvlist_add_int64_array(nvlist_t *nvl, const char *name, int64_t *a, uint_t n)
+nvlist_add_int64_array(nvlist_t *nvl, const char *name, const int64_t *a,
+ uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_INT64_ARRAY, n, a));
}
int
-nvlist_add_uint64_array(nvlist_t *nvl, const char *name, uint64_t *a, uint_t n)
+nvlist_add_uint64_array(nvlist_t *nvl, const char *name, const uint64_t *a,
+ uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_UINT64_ARRAY, n, a));
}
int
nvlist_add_string_array(nvlist_t *nvl, const char *name,
- char *const *a, uint_t n)
+ const char *const *a, uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_STRING_ARRAY, n, a));
}
@@ -1429,20 +1438,21 @@ nvlist_add_hrtime(nvlist_t *nvl, const char *name, hrtime_t val)
}
int
-nvlist_add_nvlist(nvlist_t *nvl, const char *name, nvlist_t *val)
+nvlist_add_nvlist(nvlist_t *nvl, const char *name, const nvlist_t *val)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_NVLIST, 1, val));
}
int
-nvlist_add_nvlist_array(nvlist_t *nvl, const char *name, nvlist_t **a, uint_t n)
+nvlist_add_nvlist_array(nvlist_t *nvl, const char *name,
+ const nvlist_t * const *a, uint_t n)
{
return (nvlist_add_common(nvl, name, DATA_TYPE_NVLIST_ARRAY, n, a));
}
/* reading name-value pairs */
nvpair_t *
-nvlist_next_nvpair(nvlist_t *nvl, nvpair_t *nvp)
+nvlist_next_nvpair(nvlist_t *nvl, const nvpair_t *nvp)
{
nvpriv_t *priv;
i_nvp_t *curr;
@@ -1471,7 +1481,7 @@ nvlist_next_nvpair(nvlist_t *nvl, nvpair_t *nvp)
}
nvpair_t *
-nvlist_prev_nvpair(nvlist_t *nvl, nvpair_t *nvp)
+nvlist_prev_nvpair(nvlist_t *nvl, const nvpair_t *nvp)
{
nvpriv_t *priv;
i_nvp_t *curr;
@@ -1495,31 +1505,31 @@ nvlist_prev_nvpair(nvlist_t *nvl, nvpair_t *nvp)
}
boolean_t
-nvlist_empty(nvlist_t *nvl)
+nvlist_empty(const nvlist_t *nvl)
{
- nvpriv_t *priv;
+ const nvpriv_t *priv;
if (nvl == NULL ||
- (priv = (nvpriv_t *)(uintptr_t)nvl->nvl_priv) == NULL)
+ (priv = (const nvpriv_t *)(uintptr_t)nvl->nvl_priv) == NULL)
return (B_TRUE);
return (priv->nvp_list == NULL);
}
char *
-nvpair_name(nvpair_t *nvp)
+nvpair_name(const nvpair_t *nvp)
{
return (NVP_NAME(nvp));
}
data_type_t
-nvpair_type(nvpair_t *nvp)
+nvpair_type(const nvpair_t *nvp)
{
return (NVP_TYPE(nvp));
}
int
-nvpair_type_is_array(nvpair_t *nvp)
+nvpair_type_is_array(const nvpair_t *nvp)
{
data_type_t type = NVP_TYPE(nvp);
@@ -1541,7 +1551,8 @@ nvpair_type_is_array(nvpair_t *nvp)
}
static int
-nvpair_value_common(nvpair_t *nvp, data_type_t type, uint_t *nelem, void *data)
+nvpair_value_common(const nvpair_t *nvp, data_type_t type, uint_t *nelem,
+ void *data)
{
int value_sz;
@@ -1585,6 +1596,10 @@ nvpair_value_common(nvpair_t *nvp, data_type_t type, uint_t *nelem, void *data)
case DATA_TYPE_STRING:
if (data == NULL)
return (EINVAL);
+ /*
+ * This discards the const from nvp, so all callers for these
+ * types must not accept const nvpairs.
+ */
*(void **)data = (void *)NVP_VALUE(nvp);
if (nelem != NULL)
*nelem = 1;
@@ -1604,6 +1619,10 @@ nvpair_value_common(nvpair_t *nvp, data_type_t type, uint_t *nelem, void *data)
case DATA_TYPE_NVLIST_ARRAY:
if (nelem == NULL || data == NULL)
return (EINVAL);
+ /*
+ * This discards the const from nvp, so all callers for these
+ * types must not accept const nvpairs.
+ */
if ((*nelem = NVP_NELEM(nvp)) != 0)
*(void **)data = (void *)NVP_VALUE(nvp);
else
@@ -1618,7 +1637,7 @@ nvpair_value_common(nvpair_t *nvp, data_type_t type, uint_t *nelem, void *data)
}
static int
-nvlist_lookup_common(nvlist_t *nvl, const char *name, data_type_t type,
+nvlist_lookup_common(const nvlist_t *nvl, const char *name, data_type_t type,
uint_t *nelem, void *data)
{
if (name == NULL || nvl == NULL || nvl->nvl_priv == 0)
@@ -1635,75 +1654,76 @@ nvlist_lookup_common(nvlist_t *nvl, const char *name, data_type_t type,
}
int
-nvlist_lookup_boolean(nvlist_t *nvl, const char *name)
+nvlist_lookup_boolean(const nvlist_t *nvl, const char *name)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_BOOLEAN, NULL, NULL));
}
int
-nvlist_lookup_boolean_value(nvlist_t *nvl, const char *name, boolean_t *val)
+nvlist_lookup_boolean_value(const nvlist_t *nvl, const char *name,
+ boolean_t *val)
{
return (nvlist_lookup_common(nvl, name,
DATA_TYPE_BOOLEAN_VALUE, NULL, val));
}
int
-nvlist_lookup_byte(nvlist_t *nvl, const char *name, uchar_t *val)
+nvlist_lookup_byte(const nvlist_t *nvl, const char *name, uchar_t *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_BYTE, NULL, val));
}
int
-nvlist_lookup_int8(nvlist_t *nvl, const char *name, int8_t *val)
+nvlist_lookup_int8(const nvlist_t *nvl, const char *name, int8_t *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_INT8, NULL, val));
}
int
-nvlist_lookup_uint8(nvlist_t *nvl, const char *name, uint8_t *val)
+nvlist_lookup_uint8(const nvlist_t *nvl, const char *name, uint8_t *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_UINT8, NULL, val));
}
int
-nvlist_lookup_int16(nvlist_t *nvl, const char *name, int16_t *val)
+nvlist_lookup_int16(const nvlist_t *nvl, const char *name, int16_t *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_INT16, NULL, val));
}
int
-nvlist_lookup_uint16(nvlist_t *nvl, const char *name, uint16_t *val)
+nvlist_lookup_uint16(const nvlist_t *nvl, const char *name, uint16_t *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_UINT16, NULL, val));
}
int
-nvlist_lookup_int32(nvlist_t *nvl, const char *name, int32_t *val)
+nvlist_lookup_int32(const nvlist_t *nvl, const char *name, int32_t *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_INT32, NULL, val));
}
int
-nvlist_lookup_uint32(nvlist_t *nvl, const char *name, uint32_t *val)
+nvlist_lookup_uint32(const nvlist_t *nvl, const char *name, uint32_t *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_UINT32, NULL, val));
}
int
-nvlist_lookup_int64(nvlist_t *nvl, const char *name, int64_t *val)
+nvlist_lookup_int64(const nvlist_t *nvl, const char *name, int64_t *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_INT64, NULL, val));
}
int
-nvlist_lookup_uint64(nvlist_t *nvl, const char *name, uint64_t *val)
+nvlist_lookup_uint64(const nvlist_t *nvl, const char *name, uint64_t *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_UINT64, NULL, val));
}
#if !defined(_KERNEL)
int
-nvlist_lookup_double(nvlist_t *nvl, const char *name, double *val)
+nvlist_lookup_double(const nvlist_t *nvl, const char *name, double *val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_DOUBLE, NULL, val));
}
@@ -2079,7 +2099,7 @@ int nvlist_lookup_nvpair_embedded_index(nvlist_t *nvl,
}
boolean_t
-nvlist_exists(nvlist_t *nvl, const char *name)
+nvlist_exists(const nvlist_t *nvl, const char *name)
{
nvpriv_t *priv;
nvpair_t *nvp;
@@ -2100,68 +2120,68 @@ nvlist_exists(nvlist_t *nvl, const char *name)
}
int
-nvpair_value_boolean_value(nvpair_t *nvp, boolean_t *val)
+nvpair_value_boolean_value(const nvpair_t *nvp, boolean_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_BOOLEAN_VALUE, NULL, val));
}
int
-nvpair_value_byte(nvpair_t *nvp, uchar_t *val)
+nvpair_value_byte(const nvpair_t *nvp, uchar_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_BYTE, NULL, val));
}
int
-nvpair_value_int8(nvpair_t *nvp, int8_t *val)
+nvpair_value_int8(const nvpair_t *nvp, int8_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_INT8, NULL, val));
}
int
-nvpair_value_uint8(nvpair_t *nvp, uint8_t *val)
+nvpair_value_uint8(const nvpair_t *nvp, uint8_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_UINT8, NULL, val));
}
int
-nvpair_value_int16(nvpair_t *nvp, int16_t *val)
+nvpair_value_int16(const nvpair_t *nvp, int16_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_INT16, NULL, val));
}
int
-nvpair_value_uint16(nvpair_t *nvp, uint16_t *val)
+nvpair_value_uint16(const nvpair_t *nvp, uint16_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_UINT16, NULL, val));
}
int
-nvpair_value_int32(nvpair_t *nvp, int32_t *val)
+nvpair_value_int32(const nvpair_t *nvp, int32_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_INT32, NULL, val));
}
int
-nvpair_value_uint32(nvpair_t *nvp, uint32_t *val)
+nvpair_value_uint32(const nvpair_t *nvp, uint32_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_UINT32, NULL, val));
}
int
-nvpair_value_int64(nvpair_t *nvp, int64_t *val)
+nvpair_value_int64(const nvpair_t *nvp, int64_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_INT64, NULL, val));
}
int
-nvpair_value_uint64(nvpair_t *nvp, uint64_t *val)
+nvpair_value_uint64(const nvpair_t *nvp, uint64_t *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_UINT64, NULL, val));
}
#if !defined(_KERNEL)
int
-nvpair_value_double(nvpair_t *nvp, double *val)
+nvpair_value_double(const nvpair_t *nvp, double *val)
{
return (nvpair_value_common(nvp, DATA_TYPE_DOUBLE, NULL, val));
}