From owner-svn-src-head@freebsd.org Sat Jun 23 20:05:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA398100458C; Sat, 23 Jun 2018 20:05:08 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B70C90D16; Sat, 23 Jun 2018 20:05:08 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CC42147D5; Sat, 23 Jun 2018 20:05:08 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5NK58hF008218; Sat, 23 Jun 2018 20:05:08 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5NK57E1008216; Sat, 23 Jun 2018 20:05:07 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201806232005.w5NK57E1008216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 23 Jun 2018 20:05:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335587 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 335587 X-SVN-Commit-Repository: base 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.26 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: Sat, 23 Jun 2018 20:05:09 -0000 Author: gonzo Date: Sat Jun 23 20:05:07 2018 New Revision: 335587 URL: https://svnweb.freebsd.org/changeset/base/335587 Log: Document multi variants of *prop_alloc functions Add documentation and symlinks for OF_getprop_alloc_multi and OF_getencprop_alloc_multi functions. Also while here fix copy-pasted .Dt value and add one more failure condition for OF_getencprop_alloc. Modified: head/share/man/man9/Makefile head/share/man/man9/OF_getprop.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sat Jun 23 19:30:29 2018 (r335586) +++ head/share/man/man9/Makefile Sat Jun 23 20:05:07 2018 (r335587) @@ -1540,7 +1540,9 @@ MLINKS+=OF_device_from_xref.9 OF_device_register_xref. OF_device_from_xref.9 OF_xref_from_device.9 MLINKS+=OF_getprop.9 OF_getencprop.9 \ OF_getprop.9 OF_getencprop_alloc.9 \ + OF_getprop.9 OF_getencprop_alloc_multi.9 \ OF_getprop.9 OF_getprop_alloc.9 \ + OF_getprop.9 OF_getprop_alloc_multi.9 \ OF_getprop.9 OF_getproplen.9 \ OF_getprop.9 OF_hasprop.9 \ OF_getprop.9 OF_nextprop.9 \ Modified: head/share/man/man9/OF_getprop.9 ============================================================================== --- head/share/man/man9/OF_getprop.9 Sat Jun 23 19:30:29 2018 (r335586) +++ head/share/man/man9/OF_getprop.9 Sat Jun 23 20:05:07 2018 (r335587) @@ -25,8 +25,8 @@ .\" .\" $FreeBSD$ .\" -.Dd April 9, 2018 -.Dt OF_CHILD 9 +.Dd June 23, 2018 +.Dt OF_GETPROP 9 .Os .Sh NAME .Nm OF_getprop , @@ -37,6 +37,8 @@ .Nm OF_searchencprop , .Nm OF_getprop_alloc , .Nm OF_getencprop_alloc , +.Nm OF_getprop_alloc_multi , +.Nm OF_getencprop_alloc_multi , .Nm OF_prop_free , .Nm OF_nextprop , .Nm OF_setprop @@ -66,6 +68,12 @@ .Ft ssize_t .Fn OF_getencprop_alloc "phandle_t node" "const char *propname" \ "pcell_t **buf" +.Ft ssize_t +.Fn OF_getprop_alloc_multi "phandle_t node" "const char *propname" \ +"int elsz" "void **buf" +.Ft ssize_t +.Fn OF_getencprop_alloc_multi "phandle_t node" "const char *propname" \ +"int elsz" "pcell_t **buf" .Ft void .Fn OF_prop_free "void *buf" .Ft int @@ -204,19 +212,73 @@ If the property has zero-length value, .Fa *buf is set to NULL. Returns -1 if the property does not exist or -memory allocation failed. +memory allocation failed or the size of the value is not +divisible by a cell size (4 bytes). Allocated memory should be released when no longer required by calling .Fn OF_prop_free . The function might sleep when allocating memory. .Pp +.Fn OF_getprop_alloc_multi +allocates memory large enough to hold the +value associated with the property +.Fa propname +of the device node +.Fa node +and copies the value into the newly allocated memory region. +The value is expected to be an array of zero or more elements +.Fa elsz +bytes long. +Returns the number of elements in the value and stores +the address of the allocated memory in +.Fa *buf . +If the property has a zero-sized value +.Fa *buf +is set NULL. +Returns -1 if the property does not exist or +memory allocation failed or the size of the value is not +divisible by +.Fa elsz . +Allocated memory should be released when no longer required +by calling +.Fn OF_prop_free . +The function might sleep when allocating memory. +.Pp +.Fn OF_getencprop_alloc_multi +allocates memory large enough to hold the +value associated with the property +.Fa propname +of the device node +.Fa node +and copies the value into the newly allocated memory region, and +then converts cell values from big-endian to host byte +order. +The value is expected to be an array of zero or more elements +.Fa elsz +bytes long. +Returns the number of elements in the value and stores +the address of the allocated memory in +.Fa *buf . +If the property has a zero-sized value +.Fa *buf +is set NULL. +Returns -1 if the property does not exist or +memory allocation failed or the size of the value is not +divisible by +.Fa elsz . +Allocated memory should be released when no longer required +by calling +.Fn OF_prop_free . +The function might sleep when allocating memory. +.Pp .Fn OF_prop_free releases memory at .Fa buf that was allocated by -.Fn OF_getprop_alloc -or -.Fn OF_getencprop_alloc . +.Fn OF_getprop_alloc , +.Fn OF_getencprop_alloc , +.Fn OF_getprop_alloc_multi , +.Fn OF_getencprop_alloc_multi . .Pp .Fn OF_nextprop copies a maximum of