fnvlist: add _xdr variants of _size and _pack
This allows code to be incrementally converted to use XDR packed nvlists while still using the simplified fnvlist API. Signed-off-by: Brooks Davis <brooks.davis@sri.com>
This commit is contained in:
parent
8a30bd4541
commit
4003f9b805
|
@ -310,7 +310,9 @@ _SYS_NVPAIR_H int nvpair_value_double(const nvpair_t *, double *);
|
||||||
_SYS_NVPAIR_H nvlist_t *fnvlist_alloc(void);
|
_SYS_NVPAIR_H nvlist_t *fnvlist_alloc(void);
|
||||||
_SYS_NVPAIR_H void fnvlist_free(nvlist_t *);
|
_SYS_NVPAIR_H void fnvlist_free(nvlist_t *);
|
||||||
_SYS_NVPAIR_H size_t fnvlist_size(nvlist_t *);
|
_SYS_NVPAIR_H size_t fnvlist_size(nvlist_t *);
|
||||||
|
_SYS_NVPAIR_H size_t fnvlist_size_xdr(nvlist_t *);
|
||||||
_SYS_NVPAIR_H char *fnvlist_pack(nvlist_t *, size_t *);
|
_SYS_NVPAIR_H char *fnvlist_pack(nvlist_t *, size_t *);
|
||||||
|
_SYS_NVPAIR_H char *fnvlist_pack_xdr(nvlist_t *, size_t *);
|
||||||
_SYS_NVPAIR_H void fnvlist_pack_free(char *, size_t);
|
_SYS_NVPAIR_H void fnvlist_pack_free(char *, size_t);
|
||||||
_SYS_NVPAIR_H nvlist_t *fnvlist_unpack(char *, size_t);
|
_SYS_NVPAIR_H nvlist_t *fnvlist_unpack(char *, size_t);
|
||||||
_SYS_NVPAIR_H nvlist_t *fnvlist_dup(const nvlist_t *);
|
_SYS_NVPAIR_H nvlist_t *fnvlist_dup(const nvlist_t *);
|
||||||
|
|
|
@ -69,6 +69,14 @@ fnvlist_size(nvlist_t *nvl)
|
||||||
return (size);
|
return (size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
fnvlist_size_xdr(nvlist_t *nvl)
|
||||||
|
{
|
||||||
|
size_t size;
|
||||||
|
VERIFY0(nvlist_size(nvl, &size, NV_ENCODE_XDR));
|
||||||
|
return (size);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns allocated buffer of size *sizep. Caller must free the buffer with
|
* Returns allocated buffer of size *sizep. Caller must free the buffer with
|
||||||
* fnvlist_pack_free().
|
* fnvlist_pack_free().
|
||||||
|
@ -82,6 +90,15 @@ fnvlist_pack(nvlist_t *nvl, size_t *sizep)
|
||||||
return (packed);
|
return (packed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
fnvlist_pack_xdr(nvlist_t *nvl, size_t *sizep)
|
||||||
|
{
|
||||||
|
char *packed = 0;
|
||||||
|
VERIFY3U(nvlist_pack(nvl, &packed, sizep, NV_ENCODE_XDR,
|
||||||
|
KM_SLEEP), ==, 0);
|
||||||
|
return (packed);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fnvlist_pack_free(char *pack, size_t size)
|
fnvlist_pack_free(char *pack, size_t size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue