History log of /freebsd-10.3-release/lib/libnv/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
296373 04-Mar-2016 marius

- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
builds.
- Update newvers.sh to reflect RC1.
- Update __FreeBSD_version to reflect 10.3.
- Update default pkg(8) configuration to use the quarterly branch.

Approved by: re (implicit)

292973 31-Dec-2015 ngie

MFC nv(3) and part of nv(9) to stable/10

This includes the following revisions from head:

r258065,r258594,r259430,r260222,r261407,r261408,r263479,r264021,r266351,
r269603,r271026,r271027,r271028,r271241,r271578,r271579,r271847,r272102,
r272843,r273752,r277920,r277921,r277925,r277926,r277927,r279421,r279422,
r279423,r279424,r279425,r279426,r279427,r279428,r279429,r279430,r279431,
r279432,r279434,r279435,r279436,r279438,r279439,r279440,r279760,r282122,
r282254,r282257,r282304,r282312,r285339,r288340

This change reverts stable/10@r282122 and stable/10@r288340, and re-MFCs the
series again (r282122, r285339, and r288340).

More changes are pending to nv(9)/pci(4) after further review/work. Please see
the Phabricator review for more details (both https://reviews.freebsd.org/D4232
and https://reviews.freebsd.org/D4249 ).

- Tested with:
-- Booting VMware Fusion 8.1.0 running on a Haswell Apple Macbook Pro
-- Booting a Haswell machine with zfs and running some stress workloads with
VirtualBox guests
-- make tinderbox
-- kyua test -k /usr/tests/lib/libnv

Differential Revision: https://reviews.freebsd.org/D4249 (part of a larger diff)
Relnotes: yes
Reviewed by: oshogbo (implicit), sbruno (implicit)
Submitted by: Kevin Bowling <kevin.bowling@kev009.com>
Sponsored by: EMC / Isilon Storage Division


292637 22-Dec-2015 ngie

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)


292636 22-Dec-2015 ngie

MFC r271026,r271027,r271028:

r271026 (by pjd):

Fix descriptors leak in case of nvlist_xunpack() failure.

Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org>

r271027 (by pjd):

Declare i.

Reported by: sbruno

r271028 (by pjd):

Use better type for i.


292635 22-Dec-2015 ngie

MFC r271241:

Include src.opts.mk after SHLIBDIR has been defined so libnv is installed to
/lib , not /usr/lib

Approved by: rpaulo (mentor)
Submitted by: antoine
Pointyhat to: me
Phabric: D739


292634 22-Dec-2015 ngie

MFC r279424,r279425,r279426,r279427,r279428,r279429,r279430,r279431,r279432:

r279424 (by rstone):

Tests of basic nvlist add functions

Differential Revision: https://reviews.freebsd.org/D1869
Reviewed by: jfv, pjd
Sponsored by: Sandvine Inc.

r279425 (by rstone):

Add tests for nvlist_clone

Differential Revision: https://reviews.freebsd.org/D1870
Reviewed by: pjd, jfv
Sponsored by: Sandvine Inc

r279426 (by rstone):

Add tests for nvlist_pack/unpack

Differential Revision: https://reviews.freebsd.org/D1871
Reviewed by: jfv, pjd
Sponsored by: Sandvine Inc.

r279427 (by rstone):

Add test cases for nvlist_move_*

Differential Revision: https://reviews.freebsd.org/D1872
Reviewed by: jfv, pjd
Sponsored by: Sandvine Inc.

r279428 (by rstone):

Add tests for nvlist_take_*

Differential Revision: https://reviews.freebsd.org/D1873
Reviewed by: jfv, pjd
Sponsored by: Sandvine Inc.

r279429 (by rstone):

Add tests for nvlist_free* functions

Differential Revision: https://reviews.freebsd.org/D1874
Reviewed by: jfv, pjd
Sponsored by: Sandvine Inc.

r279430 (by rstone):

Add tests for dnv_get_*

Differential Revision: https://reviews.freebsd.org/D1875
Reviewed by: jfv, pjd
Sponsored by: Sandvine Inc.

r279431 (by rstone):

Add tests for dnvlist_take_*

Differential Revision: https://reviews.freebsd.org/D1876
Reviewed by: jfv, pjd
Sponsored by: Sandvine Inc.

r279432 (by rstone):

Extend the unit test to fix the bug caught in r277925

Differential Revision: https://reviews.freebsd.org/D1888
MFC After: 1 month
Sponsored by: Sandvine Inc.


292633 22-Dec-2015 ngie

Convert src.opts.mk to bsd.own.mk


292632 22-Dec-2015 ngie

MFC r271578,r271579,r271847,r272102,r272843,r273752,r277920,r277921,r277925,r277926,r277927,r279421,r279422,r279423:

r271578 (by pjd):

Remove the limit on descriptors that can be send in one nvlist.

Submitted by: Mariusz Zaborski

r271579 (by pjd):

Use non-recursive algorithm for traversing nvlists. This also removes
the limit on number of nested nvlists.

Submitted by: Mariusz Zaborski

r271847 (by pjd):

Don't use nvl in case of a failure.

Reported by: Coverity
CID: 1238922

r272102 (by pjd):

Document the new nvlist_get_parent() function.

Submitted by: Mariusz Zaborski

r272843 (by pjd):

Fix problem on big endian systems introduced in r271579 - when we were
returning from handling a nested nvlist we were resetting big-endian flag.

Reported by: Kuleshov Aleksey @ yandex.ru
Tested by: Kuleshov Aleksey @ yandex.ru

r273752 (by jmg):

fix typo, properly install a link to nv for nvlist_freev...

r277920 (by pjd):

If moving descriptor or binary data to an nvlist fails, we need to close the
descriptor or free the memory before returning.

Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org>

While here, protect errno, so it won't be overwritted by close(2) or free(3).

r277921 (by pjd):

Modify nvlist_get_parent() API to take additional cookie argument.
This allow for non-recursive iteration over nested nvlists, as in documented
example.

Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org>

r277925 (by pjd):

Handle empty nvlists correctly.

Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org>

r277926 (by pjd):

Add missing nvlist_get_parent(3) link.

Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org>

r277927 (by pjd):

Make gcc happy.

Reported by: bz

r279421 (by rstone):

Make libnv headers includable from C++

Differential Revision: https://reviews.freebsd.org/D1868
Reviewed by: jfv, pjd
Sponsored by: Sandvine Inc.

r279422 (by rstone):

Tests of basic nvlist add functions

Differential Revision: https://reviews.freebsd.org/D1869
Reviewed by: jfv, pjd
Sponsored by: Sandvine Inc.

r279423 (by rstone):

Revert r279422. My "apply patch and commit" script wasn't adding
new files properly.

Pointy hat to: rstone


292631 22-Dec-2015 ngie

MFC r258065,r258594,r259430,r260222,r261407,r261408,r263479,r264021,r266351,r269603:

r258065 (by pjd):

Bring in libnv library for managing name/value pairs. The following types
are currently supported:

- NV_TYPE_NULL - only name, no data;
- NV_TYPE_BOOL - boolean (true or false);
- NV_TYPE_NUMBER - 64bit unsigned integer;
- NV_TYPE_STRING - C string;
- NV_TYPE_NVLIST - nested nvlist;
- NV_TYPE_DESCRIPTOR - file descriptor;
- NV_TYPE_BINARY - binary data.

For detailed documentation and examples see nv(3) manual page.

Sponsored by: The FreeBSD Foundation

r258594 (by pjd):

Fix double free().

Reported by: Coverity
Coverity CID: 1130048

r259430 (by pjd):

MFp4 @1189139:

Get rid of the msg_peek() function, which has a problem. If there was less
data in the socket buffer than requested by the caller, the function would busy
loop, as select(2) will always return immediately.

We can just receive nvlhdr now, because some time ago we splitted receive of
data from the receive of descriptors.

r260222 (by pjd):

MFp4 @1189711:

Fix resource leaks on nvlist_destroy().

Reported by: Mariusz Zaborski <oshogbo@FreeBSD.org>

r261407 (by pjd):

Fix sending empty nvlist.

Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org>

r261408 (by pjd):

Assert input arguments to buf_send() and buf_recv().

Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org>

r263479 (by bdrewery):

nv(3) was not in 10.0.

It might be MFC'd to stable/10 for 10.1, but for now update the manual to
avoid confusion on its availability.

Discussed with: pjd

r264021 (by jilles):

libnv: Don't lose big-endian flag when receiving a message.

A bug caused the "big endian" flag to be lost when receiving a message. As a
result, the bits are interpreted as little endian and an extremely large
allocation is attempted.

This change fixes ping(8)'s communication to casperd(8) on big-endian
architectures.

Reported by: Anton Shterenlikht
Tested by: danfe

r266351 (by rstone):

Correct a typo.

r269603:

Integrate lib/libnv into the build/kyua

Rename all of the TAP test applications from <test> to <test>_test
to match the convention described in the TestSuite wiki page

Phabric: D538
Approved by: jmmv (mentor)
Sponsored by: EMC / Isilon Storage Division


258065 12-Nov-2013 pjd

Bring in libnv library for managing name/value pairs. The following types
are currently supported:

- NV_TYPE_NULL - only name, no data;
- NV_TYPE_BOOL - boolean (true or false);
- NV_TYPE_NUMBER - 64bit unsigned integer;
- NV_TYPE_STRING - C string;
- NV_TYPE_NVLIST - nested nvlist;
- NV_TYPE_DESCRIPTOR - file descriptor;
- NV_TYPE_BINARY - binary data.

For detailed documentation and examples see nv(3) manual page.

Sponsored by: The FreeBSD Foundation