mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Register correct handlers for nvlist_{dup,pack,unpack}
This change is related to commit 81eaf15
which ensured the correct
allocation handlers were installed for nvlist_alloc(). The nvlist
functions nvlist_dup(), nvlist_pack(), and nvlist_unpack() suffer
from the same issue and have been updated accordingly.
Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #1937
This commit is contained in:
parent
11b9ec23b9
commit
ac0340970c
@ -262,32 +262,30 @@ nvlist_nvflag(nvlist_t *nvl)
|
|||||||
return (nvl->nvl_nvflag);
|
return (nvl->nvl_nvflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static nv_alloc_t *
|
||||||
* nvlist_alloc - Allocate nvlist.
|
nvlist_nv_alloc(int kmflag)
|
||||||
*/
|
|
||||||
/*ARGSUSED1*/
|
|
||||||
int
|
|
||||||
nvlist_alloc(nvlist_t **nvlp, uint_t nvflag, int kmflag)
|
|
||||||
{
|
{
|
||||||
nv_alloc_t *nva = nv_alloc_nosleep;
|
|
||||||
|
|
||||||
#if defined(_KERNEL) && !defined(_BOOT)
|
#if defined(_KERNEL) && !defined(_BOOT)
|
||||||
switch (kmflag) {
|
switch (kmflag) {
|
||||||
case KM_SLEEP:
|
case KM_SLEEP:
|
||||||
nva = nv_alloc_sleep;
|
return (nv_alloc_sleep);
|
||||||
break;
|
|
||||||
case KM_PUSHPAGE:
|
case KM_PUSHPAGE:
|
||||||
nva = nv_alloc_pushpage;
|
return (nv_alloc_pushpage);
|
||||||
break;
|
|
||||||
case KM_NOSLEEP:
|
|
||||||
nva = nv_alloc_nosleep;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (nv_alloc_nosleep);
|
||||||
}
|
}
|
||||||
#endif
|
#else
|
||||||
|
return (nv_alloc_nosleep);
|
||||||
|
#endif /* _KERNEL && !_BOOT */
|
||||||
|
}
|
||||||
|
|
||||||
return (nvlist_xalloc(nvlp, nvflag, nva));
|
/*
|
||||||
|
* nvlist_alloc - Allocate nvlist.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
nvlist_alloc(nvlist_t **nvlp, uint_t nvflag, int kmflag)
|
||||||
|
{
|
||||||
|
return (nvlist_xalloc(nvlp, nvflag, nvlist_nv_alloc(kmflag)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -614,16 +612,10 @@ nvlist_contains_nvp(nvlist_t *nvl, nvpair_t *nvp)
|
|||||||
/*
|
/*
|
||||||
* Make a copy of nvlist
|
* Make a copy of nvlist
|
||||||
*/
|
*/
|
||||||
/*ARGSUSED1*/
|
|
||||||
int
|
int
|
||||||
nvlist_dup(nvlist_t *nvl, nvlist_t **nvlp, int kmflag)
|
nvlist_dup(nvlist_t *nvl, nvlist_t **nvlp, int kmflag)
|
||||||
{
|
{
|
||||||
#if defined(_KERNEL) && !defined(_BOOT)
|
return (nvlist_xdup(nvl, nvlp, nvlist_nv_alloc(kmflag)));
|
||||||
return (nvlist_xdup(nvl, nvlp,
|
|
||||||
(kmflag == KM_SLEEP ? nv_alloc_sleep : nv_alloc_nosleep)));
|
|
||||||
#else
|
|
||||||
return (nvlist_xdup(nvl, nvlp, nv_alloc_nosleep));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -2352,17 +2344,12 @@ nvlist_size(nvlist_t *nvl, size_t *size, int encoding)
|
|||||||
/*
|
/*
|
||||||
* Pack nvlist into contiguous memory
|
* Pack nvlist into contiguous memory
|
||||||
*/
|
*/
|
||||||
/*ARGSUSED1*/
|
|
||||||
int
|
int
|
||||||
nvlist_pack(nvlist_t *nvl, char **bufp, size_t *buflen, int encoding,
|
nvlist_pack(nvlist_t *nvl, char **bufp, size_t *buflen, int encoding,
|
||||||
int kmflag)
|
int kmflag)
|
||||||
{
|
{
|
||||||
#if defined(_KERNEL) && !defined(_BOOT)
|
|
||||||
return (nvlist_xpack(nvl, bufp, buflen, encoding,
|
return (nvlist_xpack(nvl, bufp, buflen, encoding,
|
||||||
(kmflag == KM_SLEEP ? nv_alloc_sleep : nv_alloc_nosleep)));
|
nvlist_nv_alloc(kmflag)));
|
||||||
#else
|
|
||||||
return (nvlist_xpack(nvl, bufp, buflen, encoding, nv_alloc_nosleep));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -2415,16 +2402,10 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, size_t *buflen, int encoding,
|
|||||||
/*
|
/*
|
||||||
* Unpack buf into an nvlist_t
|
* Unpack buf into an nvlist_t
|
||||||
*/
|
*/
|
||||||
/*ARGSUSED1*/
|
|
||||||
int
|
int
|
||||||
nvlist_unpack(char *buf, size_t buflen, nvlist_t **nvlp, int kmflag)
|
nvlist_unpack(char *buf, size_t buflen, nvlist_t **nvlp, int kmflag)
|
||||||
{
|
{
|
||||||
#if defined(_KERNEL) && !defined(_BOOT)
|
return (nvlist_xunpack(buf, buflen, nvlp, nvlist_nv_alloc(kmflag)));
|
||||||
return (nvlist_xunpack(buf, buflen, nvlp,
|
|
||||||
(kmflag == KM_SLEEP ? nv_alloc_sleep : nv_alloc_nosleep)));
|
|
||||||
#else
|
|
||||||
return (nvlist_xunpack(buf, buflen, nvlp, nv_alloc_nosleep));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user