From nobody Thu Jan 18 22:39:39 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TGHk40t1Bz579sN; Thu, 18 Jan 2024 22:39:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TGHk36Kwvz4FRc; Thu, 18 Jan 2024 22:39:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705617579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i0fOP6HxRJR/4Qjn9/HzFs1bI4sfcGheUYG4v+VpB+A=; b=KqJUeEAfl0CUv8K2E/Jf5UKU4t3X5adeVjTsdSnZHq7oULSfwFFjPDbME9BMxV91p7bjX/ F35GLuxME2/L27UTEazR+rJTi19pclzpR4b8M2hfP6B2pcqLYmMeF04OUWRZdEmXnrBzVZ UDs874kHRlaLRMUVrWje+xW2KZjV0BbeoZ2BM4I6V8A9NPsHBfRtBw1GmNSq6mRrGHKdgG Q6nv2DlpZ3f91jYd5vAaSv3zS6FNIG2gKXtIaDZYPl79D8KpZBrOJCdO8brktJNpUqSk3Y t+NE98MX23vGUDe8ZQOxfCZTb8BgsXlzUJOWG4R1JDW3enqPl30M+J/r5iU0Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705617579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i0fOP6HxRJR/4Qjn9/HzFs1bI4sfcGheUYG4v+VpB+A=; b=EOhnPOR3hfeHzdqDchjqyzQeXhWEWVZ8bXSrVXrnMMctGyBJ3cbaw4dI9UwfcaPlmlse4x aTzquSva9Suwo/9j60lqjmbRxvQtt0JTulFpuvzy5jIddSjYrnpg3nQag3OWF7F/NK5hHC QXf+OpQ6uE4jUSV3wH2gXI0zC5PCG+bzy58TMMCCPpj2c7ne6HN/P6ExFCmSuaWdlhIHR8 Ytt0DmsqSn/OXa2kA3fRQB74Ei3vXpkGaSXOt/+cal1xA7Jk3GMJBKUPjebSjLUo+0ootN d86xHt45IxpWW5+KqHgntQsLUUv/e8Vreu5TGsiuIEan883p4q2EYNBh8DGzhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705617579; a=rsa-sha256; cv=none; b=qaXjCvTbL6U3eOjWFWClC/2BielBOLlOfdbC2esM5ZsM2qPzIMCV48Srg3T6uJ0/SvyLaZ D3xDNbYUX8K7JfJKtyFVY7zqo2I3+I6N4TXY3SeS1krJrio4D56SOMU4SIhnAmRhyQZubb x5k4ROR7zWD5jKjt0zoaiqc9uJNbOa3ZqEEfJr6C8K2mVRB3g7nr60cDRFrKIJ9UNaAqa2 NVxupHGN+U1eOB1F+tv21r9AAfASmMov7DYJp18oK+NSW/Q9sJgJ9A040Y5vpvPxzuB8Gr saRO2vl1Jo/L/JTfoObQdgfQRUwQ+yFhP/NKJv+dKqPhsl9BC0nN4Ngvw46phA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TGHk35HybzQXR; Thu, 18 Jan 2024 22:39:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40IMddUt008860; Thu, 18 Jan 2024 22:39:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40IMdd6i008857; Thu, 18 Jan 2024 22:39:39 GMT (envelope-from git) Date: Thu, 18 Jan 2024 22:39:39 GMT Message-Id: <202401182239.40IMdd6i008857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 58836703dc30 - stable/14 - mbuf.9: Document mtodo List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 58836703dc30889c1526cdb9dd482f795ae4508b Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=58836703dc30889c1526cdb9dd482f795ae4508b commit 58836703dc30889c1526cdb9dd482f795ae4508b Author: John Baldwin AuthorDate: 2023-12-28 19:17:22 +0000 Commit: John Baldwin CommitDate: 2024-01-18 22:34:10 +0000 mbuf.9: Document mtodo mtodo() accepts an mbuf and offset and returns a void * pointer to the requested offset into the mbuf's associated data. Similar to mtod(), no bounds checking is performed. Reviewed by: imp, markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D43215 (cherry picked from commit 854e1fd692185749fea092b1431efd4a8e09c2eb) --- share/man/man9/Makefile | 1 + share/man/man9/mbuf.9 | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 99ec5219d8e0..77b2038628be 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1516,6 +1516,7 @@ MLINKS+=\ mbuf.9 m_pullup.9 \ mbuf.9 m_split.9 \ mbuf.9 mtod.9 \ + mbuf.9 mtodo.9 \ mbuf.9 M_TRAILINGSPACE.9 \ mbuf.9 m_unshare.9 \ mbuf.9 M_WRITABLE.9 diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9 index 7c69ef86f63f..0b03d697b8bf 100644 --- a/share/man/man9/mbuf.9 +++ b/share/man/man9/mbuf.9 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 8, 2021 +.Dd December 28, 2023 .Dt MBUF 9 .Os .\" @@ -52,7 +52,10 @@ .Fc .\" .Ss Mbuf utility macros +.Ft type .Fn mtod "struct mbuf *mbuf" "type" +.Ft void * +.Fn mtodo "struct mbuf *mbuf" "offset" .Fn M_ALIGN "struct mbuf *mbuf" "u_int len" .Fn MH_ALIGN "struct mbuf *mbuf" "u_int len" .Ft int @@ -394,6 +397,14 @@ It is advisable to ensure that there is enough contiguous data in See .Fn m_pullup for details. +.It Fn mtodo mbuf offset +Return a data pointer at an offset (in bytes) into the data attached to +.Fa mbuf . +Returns a +.Ft void * +pointer . +.Sy Note : +The caller must ensure that the offset is in bounds of the attached data. .It Fn MGET mbuf how type Allocate an .Vt mbuf @@ -773,7 +784,9 @@ in the are contiguous and lay in the data area of .Fa mbuf , so they are accessible with -.Fn mtod mbuf type . +.Fn mtod +or +.Fn mtodo . .Fa len must be smaller than, or equal to, the size of an .Vt mbuf cluster . @@ -787,12 +800,13 @@ to the data contained in the returned mbuf is stored in If .Fa offsetp is NULL, the region may be accessed using -.Fn mtod mbuf type . +.Fn mtod mbuf type +or +.Fn mtodo mbuf 0 . If .Fa offsetp is non-NULL, the region may be accessed using -.Fn mtod mbuf uint8_t -+ *offsetp. +.Fn mtodo mbuf *offsetp . The region of the mbuf chain between its beginning and .Fa offset is not modified, therefore it is safe to hold pointers to data within