From owner-svn-src-head@FreeBSD.ORG Fri May 1 17:50:26 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A808D4F9; Fri, 1 May 2015 17:50:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8902016FA; Fri, 1 May 2015 17:50:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t41HoQqT076332; Fri, 1 May 2015 17:50:26 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t41HoPYE075773; Fri, 1 May 2015 17:50:25 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201505011750.t41HoPYE075773@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Fri, 1 May 2015 17:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282312 - in head: lib/libnv sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2015 17:50:26 -0000 Author: oshogbo Date: Fri May 1 17:50:24 2015 New Revision: 282312 URL: https://svnweb.freebsd.org/changeset/base/282312 Log: Add nvlist_flags() function, which returns nvlist's public flags. Approved by: pjd (mentor) Modified: head/lib/libnv/Makefile head/lib/libnv/nv.3 head/sys/kern/subr_nvlist.c head/sys/sys/nv.h Modified: head/lib/libnv/Makefile ============================================================================== --- head/lib/libnv/Makefile Fri May 1 17:36:13 2015 (r282311) +++ head/lib/libnv/Makefile Fri May 1 17:50:24 2015 (r282312) @@ -47,6 +47,7 @@ MLINKS+=nv.3 nvlist_add_binary.3 \ nv.3 nvlist_exists_string.3 \ nv.3 nvlist_exists_type.3 \ nv.3 nvlist_fdump.3 \ + nv.3 nvlist_flags.3 \ nv.3 nvlist_free.3 \ nv.3 nvlist_free_binary.3 \ nv.3 nvlist_free_bool.3 \ Modified: head/lib/libnv/nv.3 ============================================================================== --- head/lib/libnv/nv.3 Fri May 1 17:36:13 2015 (r282311) +++ head/lib/libnv/nv.3 Fri May 1 17:50:24 2015 (r282312) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 30, 2015 +.Dd May 1, 2015 .Dt NV 3 .Os .Sh NAME @@ -37,6 +37,7 @@ .Nm nvlist_error , .Nm nvlist_set_error , .Nm nvlist_empty , +.Nm nvlist_flags , .Nm nvlist_exists , .Nm nvlist_free , .Nm nvlist_clone , @@ -68,6 +69,8 @@ .Fn nvlist_set_error "nvlist_t *nvl, int error" .Ft bool .Fn nvlist_empty "const nvlist_t *nvl" +.Ft int +.Fn nvlist_flags "const nvlist_t *nvl" .\" .Ft "nvlist_t *" .Fn nvlist_clone "const nvlist_t *nvl" @@ -269,6 +272,12 @@ otherwise. The nvlist must not be in error state. .Pp The +.Fn nvlist_flags +function returns flags used to create the nvlist with the +.Fn nvlist_create +function. +.Pp +The .Fn nvlist_clone functions clones the given nvlist. The clone shares no resources with its origin. Modified: head/sys/kern/subr_nvlist.c ============================================================================== --- head/sys/kern/subr_nvlist.c Fri May 1 17:36:13 2015 (r282311) +++ head/sys/kern/subr_nvlist.c Fri May 1 17:50:24 2015 (r282312) @@ -230,6 +230,17 @@ nvlist_empty(const nvlist_t *nvl) return (nvlist_first_nvpair(nvl) == NULL); } +int +nvlist_flags(const nvlist_t *nvl) +{ + + NVLIST_ASSERT(nvl); + PJDLOG_ASSERT(nvl->nvl_error == 0); + PJDLOG_ASSERT((nvl->nvl_flags & ~(NV_FLAG_PUBLIC_MASK)) == 0); + + return (nvl->nvl_flags); +} + static void nvlist_report_missing(int type, const char *name) { Modified: head/sys/sys/nv.h ============================================================================== --- head/sys/sys/nv.h Fri May 1 17:36:13 2015 (r282311) +++ head/sys/sys/nv.h Fri May 1 17:50:24 2015 (r282312) @@ -75,6 +75,7 @@ nvlist_t *nvlist_create(int flags); void nvlist_destroy(nvlist_t *nvl); int nvlist_error(const nvlist_t *nvl); bool nvlist_empty(const nvlist_t *nvl); +int nvlist_flags(const nvlist_t *nvl); void nvlist_set_error(nvlist_t *nvl, int error); nvlist_t *nvlist_clone(const nvlist_t *nvl);