Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 2024 22:39:46 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e73b54810308 - stable/13 - mbuf.9: Document mtodo
Message-ID:  <202401182239.40IMdkLV009225@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=e73b54810308327c26aeca1737c89b4b2da1fe61

commit e73b54810308327c26aeca1737c89b4b2da1fe61
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-12-28 19:17:22 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-18 22:34:52 +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 d237f677311a..30712ab4f987 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1503,6 +1503,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 84fad793b970..2b488f59cfd6 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 April 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
@@ -392,6 +395,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
@@ -764,7 +775,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 .
@@ -778,12 +791,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401182239.40IMdkLV009225>