mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-07 00:50:50 +00:00
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
This commit is contained in:
parent
10ed63fc06
commit
854e1fd692
|
@ -1516,6 +1516,7 @@ MLINKS+=\
|
||||||
mbuf.9 m_pullup.9 \
|
mbuf.9 m_pullup.9 \
|
||||||
mbuf.9 m_split.9 \
|
mbuf.9 m_split.9 \
|
||||||
mbuf.9 mtod.9 \
|
mbuf.9 mtod.9 \
|
||||||
|
mbuf.9 mtodo.9 \
|
||||||
mbuf.9 M_TRAILINGSPACE.9 \
|
mbuf.9 M_TRAILINGSPACE.9 \
|
||||||
mbuf.9 m_unshare.9 \
|
mbuf.9 m_unshare.9 \
|
||||||
mbuf.9 M_WRITABLE.9
|
mbuf.9 M_WRITABLE.9
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd August 8, 2021
|
.Dd December 28, 2023
|
||||||
.Dt MBUF 9
|
.Dt MBUF 9
|
||||||
.Os
|
.Os
|
||||||
.\"
|
.\"
|
||||||
|
@ -52,7 +52,10 @@
|
||||||
.Fc
|
.Fc
|
||||||
.\"
|
.\"
|
||||||
.Ss Mbuf utility macros
|
.Ss Mbuf utility macros
|
||||||
|
.Ft type
|
||||||
.Fn mtod "struct mbuf *mbuf" "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 M_ALIGN "struct mbuf *mbuf" "u_int len"
|
||||||
.Fn MH_ALIGN "struct mbuf *mbuf" "u_int len"
|
.Fn MH_ALIGN "struct mbuf *mbuf" "u_int len"
|
||||||
.Ft int
|
.Ft int
|
||||||
|
@ -394,6 +397,14 @@ It is advisable to ensure that there is enough contiguous data in
|
||||||
See
|
See
|
||||||
.Fn m_pullup
|
.Fn m_pullup
|
||||||
for details.
|
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
|
.It Fn MGET mbuf how type
|
||||||
Allocate an
|
Allocate an
|
||||||
.Vt mbuf
|
.Vt mbuf
|
||||||
|
@ -773,7 +784,9 @@ in the
|
||||||
are contiguous and lay in the data area of
|
are contiguous and lay in the data area of
|
||||||
.Fa mbuf ,
|
.Fa mbuf ,
|
||||||
so they are accessible with
|
so they are accessible with
|
||||||
.Fn mtod mbuf type .
|
.Fn mtod
|
||||||
|
or
|
||||||
|
.Fn mtodo .
|
||||||
.Fa len
|
.Fa len
|
||||||
must be smaller than, or equal to, the size of an
|
must be smaller than, or equal to, the size of an
|
||||||
.Vt mbuf cluster .
|
.Vt mbuf cluster .
|
||||||
|
@ -787,12 +800,13 @@ to the data contained in the returned mbuf is stored in
|
||||||
If
|
If
|
||||||
.Fa offsetp
|
.Fa offsetp
|
||||||
is NULL, the region may be accessed using
|
is NULL, the region may be accessed using
|
||||||
.Fn mtod mbuf type .
|
.Fn mtod mbuf type
|
||||||
|
or
|
||||||
|
.Fn mtodo mbuf 0 .
|
||||||
If
|
If
|
||||||
.Fa offsetp
|
.Fa offsetp
|
||||||
is non-NULL, the region may be accessed using
|
is non-NULL, the region may be accessed using
|
||||||
.Fn mtod mbuf uint8_t
|
.Fn mtodo mbuf *offsetp .
|
||||||
+ *offsetp.
|
|
||||||
The region of the mbuf chain between its beginning and
|
The region of the mbuf chain between its beginning and
|
||||||
.Fa offset
|
.Fa offset
|
||||||
is not modified, therefore it is safe to hold pointers to data within
|
is not modified, therefore it is safe to hold pointers to data within
|
||||||
|
|
Loading…
Reference in a new issue