Date: Sat, 28 Oct 2000 19:28:25 +0400 (MSD) From: Yar Tikhiy <yar@comp.chem.msu.su> To: nik@FreeBSD.org Cc: freebsd-doc@FreeBSD.org Subject: Re: docs/22053: mbuf(9) man page suggested Message-ID: <200010281528.TAA22063@comp.chem.msu.su> In-Reply-To: <200010262316.QAA89405@freefall.freebsd.org> from "nik@FreeBSD.org" at "Oct 26, 0 04:16:11 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Hello, > Synopsis: mbuf(9) man page suggested > > State-Changed-From-To: open->closed > State-Changed-By: nik > State-Changed-When: Thu Oct 26 16:15:50 PDT 2000 > State-Changed-Why: > Committed, thanks. Sorry to disturb you, but I've found a error in the man page, when it speaks about the ``mtod'' macro. I've also added a couple of details about functions used to manage mbufs. All the changes are included in the small patch below. SY, Yar --- mbuf.man.old Tue Oct 17 20:42:56 2000 +++ mbuf.man Sat Oct 28 19:21:19 2000 @@ -36,7 +36,7 @@ .Fd #include <sys/mbuf.h> .\" .Ss Mbuf manipulation macros -.Fn mtod "struct mbuf *mbuf" "any type" +.Fn mtod "struct mbuf *mbuf" "TYPE" .Fn MGET "struct mbuf *mbuf" "int how" "short type" .Fn MGETHDR "struct mbuf *mbuf" "int how" "short type" .Fn MCLGET "struct mbuf *mbuf" "int how" @@ -200,14 +200,17 @@ developer not to worry about mbuf internals. The macros are: .\" .Bl -ohang -offset indent -.It Fn mtod mbuf type -Convert a mbuf pointer to a data pointer. -The macro expands to the data pointer cast to the pointer to the specified type. +.It Fn mtod mbuf TYPE +Convert a mbuf pointer to a pointer to the data contained in the mbuf +itself or in its external storage. The pointer to the data is cast to +the specified type. Usually, it's a pointer to a header structure, +or the character array type. .Sy Note : You must usually ensure that there is enough contiguous data in the mbuf. See .Fn m_pullup for details. +.\" .It Fn MGET mbuf how type Allocate a mbuf and initialize it to contain internal data. .Fa Mbuf @@ -304,11 +307,16 @@ .Dv NULL on failure .Pq the chain is freed in this case . -.Sy Note : +.Sy Notes : It doesn't allocate any clusters, so .Fa len must be less than .Dv MHLEN . +The function will fail and return +.Dv NULL +if there is less data than +.Fa len +bytes. .\" .It Fn m_copym mbuf offset len how Make a copy of an mbuf chain starting @@ -355,12 +363,16 @@ starting at .Fa offset bytes from the beginning of the chain, extending the mbuf chain if necessary. -.Sy Note : +.Sy Notes : It doesn't allocate any clusters, just adds mbufs to the chain. It's safe to set .Fa offset beyond the current chain end: zeroed mbufs will be allocated to fill the -space. +space; +.Fa buf +may be +.Dv NULL +in this case, just causing the mbuf chain's tail to grow. .\" .It Fn m_devget buf len offset ifp copy Copy data from a device local memory pointed to by To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010281528.TAA22063>