MFC r279434,r279435,r279436,r279438,r279439,r279440,r279760,r282254,r282257,r282304,r282312:
r279434 (by rstone):
Add function to force an nvlist into the error state
Add an nvlist_set_error() function that can be used to force an
nvlist into the error state. This is useful both for writing
tests and for writing APIs that use nvlists internally.
Differential Revision: https://reviews.freebsd.org/D1878
Reviewed by: pjd, jfv
MFC After: 1 month
Sponsored by: Sandvine Inc.
r279435 (by rstone):
Don't allocate memory for operations that do not insert
Almost every operation performed on an nvlist was allocating a
new string to hold the key name. The nvlist_exists* family of
functions would always return false if they failed to allocate
the string. The rest of the functions would outright abort().
Fix the non-varargs variants of the functions to perform the
requested operations directly and the varargs versions to
allocate the string and call into the non-varargs versions.
The varargs versions are still broken and really can't be fixed,
so we might consider axing them entirely. However, now the non-
varargs functions are always safe to call.
Differential Revision: https://reviews.freebsd.org/D1879
Reviewed by: pjd, jfv
Sponsored by: Sandvine Inc.
r279436 (by rstone):
Prevent creation of an invalid nvlist
If an nvlist is set as a child of another nvlist with
nvlist_move_nvlist then fail the operation and set the parent
nvlist to the error state.
Differential Revision: https://reviews.freebsd.org/D1880
Reviewers: jfv
Sponsored by: Sandvine Inc
r279438 (by rstone):
Add macros to make code compile in kernel
Make it possible to compile libnv in the kernel. Mostly this
involves wrapping functions that have a different signature in
the kernel and in userland (e.g. malloc()) in a macro that will
conditionally expand to the right API depending on whether the
code is being compiled for the kernel or not.
I have also #ifdef'ed out all of file descriptor-handling code,
as well as the unsafe varargs functions.
Differential Revision: https://reviews.freebsd.org/D1882
Reviewed by: jfv
Sponsored by: Sandvine Inc
r279439 (by rstone):
Move libnv into the kernel and hook it into the kernel build
Differential Revision: https://reviews.freebsd.org/D1883
Reviewed by: jfv
Sponsored by: Sandvine Inc.
r279440 (by rstone):
Fix build of nv_tests.cc
nv_tests.cc managed to get two copies of several functions due to me
applying a patch in an unclean working tree. My kingdom for an
"svn clean" command.
X-MFC-With: r279424
r279760 (by dim):
Fix lib/libnv tests compilation with -std=c++11, by adding appropriate
casts for NULL to invocations of the ATF_REQUIER_EQ() macro.
Reviewed by: rstone, jmmv
Differential Revision: https://reviews.freebsd.org/D2027
r282254 (by oshogbo):
Remove the use of nvlist_.*[fv] functions from tests.
Approved by: pjd (mentor)
r282257 (by oshogbo):
Remove the nvlist_.*[fv] functions.
Those functions are problematic, because there is no way to report
memory allocation problems without complicating the API, so we can
either abort or potentially return invalid results. None of which is
acceptable.
In most cases the caller knows the size of the name, so he can allocate
buffer on the stack and use snprintf(3) to prepare the name.
After some discussion the conclusion is to removed those functions,
which also simplifies the API.
Discussed with: pjd, rstone
Approved by: pjd (mentor)
r282304 (by oshogbo):
Sort MLINKS alphabetically.
Approved by: pjd (mentor)
r282312 (by oshogbo):
Add nvlist_flags() function, which returns nvlist's public flags.
Approved by: pjd (mentor)