aboutsummaryrefslogtreecommitdiff
path: root/lib/libnv
Commit message (Collapse)AuthorAgeFilesLines
* Use SRCTOP-relative paths to other directories instead of .CURDIR-relative onesEnji Cooper2017-01-201-2/+2
| | | | | | | | | | This implifies pathing in make/displayed output MFC after: 3 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=312492
* Fix style issue in the cnv API.Mariusz Zaborski2016-08-272-5/+4
| | | | | | | | Remove unused arguments in a macro. Remove unused typedef. Notes: svn path=/head/; revision=304909
* Add cnv API.Mariusz Zaborski2016-08-273-1/+1512
| | | | | | | | | | | cnv API is a set of functions for managing name/value pairs by cookie. The cookie can be obtained by nvlist_next(), nvlist_get_parent() or nvlist_get_pararr() function. This patch also includes unit tests. Submitted by: Adam Starak <starak.adam@gmail.com> Notes: svn path=/head/; revision=304908
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedEnji Cooper2016-05-041-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=299094
* MFHGlen Barber2016-03-101-0/+24
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296625
| * DIRDEPS_BUILD: Connect MK_TESTS.Bryan Drewery2016-03-091-0/+24
| | | | | | | | | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296587
* | MFHGlen Barber2016-03-021-2/+0
|\| | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296318
| * Remove WARNS inherited fine by ../Makefile.inc.Bryan Drewery2016-02-261-2/+0
| | | | | | | | | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296129
* | First pass through library packaging.Glen Barber2016-02-041-0/+1
| | | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295278
* | First pass to fix the 'tests' packages.Glen Barber2016-02-021-0/+4
|/ | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295171
* Remove free'ing of an uninitialized variableEnji Cooper2016-01-041-2/+0
| | | | | | | | | | | | | | Just remove it completely from the test as it's initialized but unused apart from the free(3) call Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff) MFC after: 5 days Reported by: cppcheck Reviewed by: oshogbo Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293135
* Use `nitems(x)` macro instead of using hardcoded numbers for indices intoEnji Cooper2016-01-041-53/+59
| | | | | | | | | | | | | | | the nvlists Convert some of the variables from int to unsigned int to squelch -Wsign-compare warnings when converting hardcoded values to nitems(..) Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff) MFC after: 5 days Reviewed by: oshogbo Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293134
* Convert another `string` variable to `string_arr` missed in r293130Enji Cooper2016-01-041-3/+3
| | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff) MFC after: 5 days Reviewed by: oshogbo Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293131
* Rename nitems and string variables to avoid collisionsEnji Cooper2016-01-041-105/+106
| | | | | | | | | | | | | | | | | Rename the `nitems` variable to `num_items` to avoid collisions with the macro in sys/param.h for counting elements in an array Similarly, rename `string` to `string_arr` to avoid future collisions with potential keywords, as well as make it clear that `string_arr` isn't a char* value, but instead a char** value. Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff) MFC after: 5 days Reviewed by: oshogbo Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293130
* Add sys/types.h for for size_t, etcEnji Cooper2016-01-031-0/+1
| | | | | | | | | | stable/10 requires it due to header pollution MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293102
* META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.Bryan Drewery2015-11-251-1/+0
| | | | | | | | | | | This both avoids some dependencies on xinstall.host and allows bootstrapping on older releases to work due to lack of at least 'install -l' support. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291307
* Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) andEnji Cooper2015-10-121-2/+0
| | | | | | | | | | | | | | | netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison Notes: svn path=/head/; revision=289172
* Add support for the arrays in nvlist library.Mariusz Zaborski2015-08-152-0/+1192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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) Notes: svn path=/head/; revision=286796
* Move the nvlist source and private includes from sys/kern to seperateMariusz Zaborski2015-07-041-4/+4
| | | | | | | | | | | | 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) Notes: svn path=/head/; revision=285139
* Move nvlist documentation to the FreeBSD Kernel Developer's sections.Mariusz Zaborski2015-07-042-756/+0
| | | | | | | Approved by: pjd (mentor) Notes: svn path=/head/; revision=285129
* Let the nv.h and dnv.h includes be only in sys directory.Mariusz Zaborski2015-07-029-18/+15
| | | | | | | | | | Change consumers to include those files from sys. Add duplicated files to ObsoleteFiles. Approved by: pjd (mentor) Notes: svn path=/head/; revision=285063
* Revert r284417 it is not necessary anymoreBaptiste Daroussin2015-06-151-1/+1
| | | | Notes: svn path=/head/; revision=284421
* Enforce overwritting SHLIBDIRBaptiste Daroussin2015-06-151-1/+1
| | | | | | | | | | | | Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere. This makes /lib being populated again. Reported by: many Notes: svn path=/head/; revision=284417
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-2714-4180/+2011
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Merge from head@274682Simon J. Gerraty2014-11-1916-216/+1865
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=274683
| * \ Merge head from 7/28Simon J. Gerraty2014-08-191-2/+2
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=270164
| * | | Updated dependenciesSimon J. Gerraty2014-05-161-1/+1
| | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | | New/updated dependenciesSimon J. Gerraty2014-05-051-0/+18
| | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265381
* | | | Add test case for unpack with diffrent flags.Mariusz Zaborski2015-05-021-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: pjd (mentor) Notes: svn path=/head/; revision=282348
* | | | Introduce the NV_FLAG_NO_UNIQUE flag. When set, it allows to storeMariusz Zaborski2015-05-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=282347
* | | | Approved, oprócz użycie RESTORE_ERRNO() do ustawiania errno.Mariusz Zaborski2015-05-023-11/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the nvlist_recv() function to take additional argument that specifies flags expected on the received nvlist. Receiving a nvlist with different set of flags than the ones we expect might lead to undefined behaviour, which might be potentially dangerous. Update consumers of this and related functions and update the tests. Approved by: pjd (mentor) Update man page for nvlist_unpack, nvlist_recv, nvlist_xfer, cap_recv_nvlist and cap_xfer_nvlist. Reviewed by: AllanJude Approved by: pjd (mentor) Notes: svn path=/head/; revision=282346
* | | | Add nvlist_flags() function, which returns nvlist's public flags.Mariusz Zaborski2015-05-012-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: pjd (mentor) Notes: svn path=/head/; revision=282312
* | | | Sort MLINKS alphabetically.Mariusz Zaborski2015-05-011-46/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: pjd (mentor) Notes: svn path=/head/; revision=282304
* | | | Remove the nvlist_.*[fv] functions.Mariusz Zaborski2015-04-291-82/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=282257
* | | | Remove the use of nvlist_.*[fv] functions from tests.Mariusz Zaborski2015-04-292-48/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: pjd (mentor) Notes: svn path=/head/; revision=282254
* | | | Fix lib/libnv tests compilation with -std=c++11, by adding appropriateDimitry Andric2015-03-082-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | casts for NULL to invocations of the ATF_REQUIER_EQ() macro. Reviewed by: rstone, jmmv Differential Revision: https://reviews.freebsd.org/D2027 Notes: svn path=/head/; revision=279760
* | | | Fix build of nv_tests.ccRyan Stone2015-03-011-1776/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. MFC after: 1 month X-MFC-With: r279424 Notes: svn path=/head/; revision=279440
* | | | Move libnv into the kernel and hook it into the kernel buildRyan Stone2015-03-019-4385/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D1883 Reviewed by: jfv MFC after: 1 month Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=279439
* | | | Add macros to make code compile in kernelRyan Stone2015-03-018-121/+349
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=279438
* | | | Prevent creation of an invalid nvlistRyan Stone2015-03-012-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=279436
* | | | Don't allocate memory for operations that do not insertRyan Stone2015-03-013-178/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 MFC after: 1 month Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=279435
* | | | Add function to force an nvlist into the error stateRyan Stone2015-03-015-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=279434
* | | | Extend the unit test to fix the bug caught in r277925Ryan Stone2015-03-011-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D1888 MFC After: 1 month Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=279432
* | | | Add tests for dnvlist_take_*Ryan Stone2015-03-011-0/+288
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D1876 Reviewed by: jfv, pjd MFC after: 1 month Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=279431
* | | | Add tests for dnv_get_*Ryan Stone2015-03-012-1/+292
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D1875 Reviewed by: jfv, pjd MFC after: 1 month Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=279430
* | | | Add tests for nvlist_free* functionsRyan Stone2015-03-011-0/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D1874 Reviewed by: jfv, pjd MFC after: 1 month Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=279429
* | | | Add tests for nvlist_take_*Ryan Stone2015-03-011-0/+292
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D1873 Reviewed by: jfv, pjd MFC after: 1 month Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=279428