Restructure nvlist_nv_alloc to work on FreeBSD

KM_PUSHPAGE is an Illumosism - On FreeBSD it's
aliased to the same malloc flag as KM_SLEEP.
The compiler naturally rejects multiple case
statements with the same value.  This is effectively
a no-op since all callers pass a specific KM_* flag.

Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #9643
This commit is contained in:
Matthew Macy 2019-11-30 15:45:07 -08:00 committed by Brian Behlendorf
parent 101f9b1771
commit 758699b6f1

View File

@ -558,10 +558,10 @@ nvlist_nv_alloc(int kmflag)
switch (kmflag) {
case KM_SLEEP:
return (nv_alloc_sleep);
case KM_PUSHPAGE:
return (nv_alloc_pushpage);
default:
case KM_NOSLEEP:
return (nv_alloc_nosleep);
default:
return (nv_alloc_pushpage);
}
#else
return (nv_alloc_nosleep);