History log of /freebsd-11.0-release/sys/contrib/libnv/nvpair.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 303975 11-Aug-2016 gjb

Copy stable/11@r303970 to releng/11.0 as part of the 11.0-RELEASE
cycle.

Prune svn:mergeinfo from the new branch, and rename it to RC1.

Update __FreeBSD_version.

Use the quarterly branch for the default FreeBSD.conf pkg(8) repo and
the dvd1.iso packages population.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 303825 08-Aug-2016 oshogbo

MFC r302965:
Fix memory leak in the nvlist string array.

Submitted by: Adam Starak <starak.adam@gmail.com>
Approved by: re (gjb)


# 302408 08-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 286796 15-Aug-2015 oshogbo

Add support for the arrays in nvlist library.

- Add
nvlist_{add,get,take,move,exists,free}_{number,bool,string,nvlist,
descriptor} functions.
- Add support for (un)packing arrays.
- Add the nvl_array_next field to the nvlist structure.
If an array is added by the nvlist_{move,add}_nvlist_array function
this field will contains next element in the array.
- Add the nitems field to the nvpair and nvpair_header structure.
This field contains number of elements in the array.
- Add special flag (NV_FLAG_IN_ARRAY) which is set if nvlist is a part of
an array.
- Add special type (NV_TYPE_NVLIST_ARRAY_NEXT).This type is used only
on packing/unpacking.
- Add new API for traversing arrays (nvlist_get_array_next).
- Add the nvlist_get_pararr function which combines the
nvlist_get_array_next and nvlist_get_parent functions. If nvlist is in
the array it will return next element from array. If nvlist is last
element in array or it isn't in array it will return his
container (parent). This function should simplify traveling over nvlist.
- Add tests for new features.
- Add documentation for new functions.
- Add my copyright.
- Regenerate the sys/cddl/compat/opensolaris/sys/nvpair.h file.

PR: 191083
Reviewed by: allanjude (doc)
Approved by: pjd (mentor)


# 285139 04-Jul-2015 oshogbo

Move the nvlist source and private includes from sys/kern to seperate
directory sys/contrib/libnv.

The goal of this operation is to NOT install header files which shouldn't
be used outside the nvlist library.

Approved by: pjd (mentor)


# 283157 20-May-2015 oshogbo

Style.

Approved by: pjd (mentor)


# 282347 02-May-2015 oshogbo

Introduce the NV_FLAG_NO_UNIQUE flag. When set, it allows to store
multiple values using the same key in a nvlist.

Approved by: pjd (mentor)
Obtained from: WHEEL Systems (http://www.wheelsystems.com)

Update man page.

Reviewed by: AllanJude
Approved by: pjd (mentor)


# 282337 02-May-2015 bz

Fix an off-by-one bug in string/array handling which lead to memory overwrite
and follow-up assertion errors on at least ARM after r282257,
with nvp_magic being 0x6e7600:
Assertion failed: ((nvp)->nvp_magic == 0x6e7670), function nvpair_name, file .../subr_nvpair.c, line 713.

Sponsored by: DARPA/AFRL


# 282282 30-Apr-2015 oshogbo

Rename macros to use prefix ERRNO. Add macro ERRNO_SET. Now
ERRNO_{RESTORE/SAVE} must by used together, additional variable is not
needed. Always use ERRNO_{SAVE/RESTORE/SET} macros.

Approved by: pjd (mentor)


# 282258 29-Apr-2015 oshogbo

Save errno from close override.

Approved by: pjd (mentor)


# 282257 29-Apr-2015 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)


# 279439 01-Mar-2015 rstone

Move libnv into the kernel and hook it into the kernel build

Differential Revision: https://reviews.freebsd.org/D1883
Reviewed by: jfv
MFC after: 1 month
Sponsored by: Sandvine Inc.


# 279438 01-Mar-2015 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
MFC after: 1 month
Sponsored by: Sandvine Inc


# 279436 01-Mar-2015 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
MFC after: 1 month
Sponsored by: Sandvine Inc


# 277920 30-Jan-2015 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).


# 272843 09-Oct-2014 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


# 271847 18-Sep-2014 pjd

Don't use nvl in case of a failure.

Reported by: Coverity
CID: 1238922


# 271579 14-Sep-2014 pjd

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

Submitted by: Mariusz Zaborski


# 258594 25-Nov-2013 pjd

Fix double free().

Reported by: Coverity
Coverity CID: 1130048


# 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