diff options
-rw-r--r-- | share/man/man9/mbuf.9 | 22 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 25 |
2 files changed, 22 insertions, 25 deletions
diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9 index 5c4189f7f03..5a6c8f62e69 100644 --- a/share/man/man9/mbuf.9 +++ b/share/man/man9/mbuf.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mbuf.9,v 1.21 2006/09/05 18:00:34 thib Exp $ +.\" $OpenBSD: mbuf.9,v 1.22 2006/10/11 22:39:46 mpf Exp $ .\" .\" Copyright (c) 2001 Jean-Jacques Bernard-Gundol <jjbg@openbsd.org> .\" All rights reserved. @@ -34,9 +34,9 @@ .Sh SYNOPSIS .Fd #include <sys/mbuf.h> .Ft struct mbuf * -.Fn m_copym2 "struct mbuf *m" "int off0" "int len" "int wait" +.Fn m_copym2 "struct mbuf *m" "int off" "int len" "int wait" .Ft struct mbuf * -.Fn m_copym "struct mbuf *m" "int off0" "int len" "int wait" +.Fn m_copym "struct mbuf *m" "int off" "int len" "int wait" .Ft struct mbuf * .Fn m_free "struct mbuf *m" .Fn MFREE "struct mbuf *m" "struct mbuf *n" @@ -76,7 +76,7 @@ .Ft void .Fn m_cat "struct mbuf *m" "struct mbuf *n" .Ft struct mbuf * -.Fn m_devget "char *buf" "int totlen" "int off0" "struct ifnet *ifp" \ +.Fn m_devget "char *buf" "int totlen" "int off" "struct ifnet *ifp" \ "void (*func)(const void *, void *, size_t)" .Ft void .Fn m_zero "struct mbuf *m" @@ -325,15 +325,15 @@ The structure used is the same as the previous one except that the element is not empty, it contains the same information as when M_PKTHDR is used alone. .Bl -tag -width Ds -.It Fn m_copym "struct mbuf *m" "int off0" "int len" "int wait" +.It Fn m_copym "struct mbuf *m" "int off" "int len" "int wait" Copy an mbuf chain starting at -.Fa off0 +.Fa off bytes from the beginning and continuing for .Fa len bytes. If -.Fa off0 +.Fa off is zero and .Fa m has the M_PKTHDR flag set, @@ -347,7 +347,7 @@ The parameter can be M_WAIT or M_DONTWAIT. It does not copy clusters, it just increases their reference count. -.It Fn m_copym2 "struct mbuf *m" "int off0" "int len" "int wait" +.It Fn m_copym2 "struct mbuf *m" "int off" "int len" "int wait" The same as .Fn m_copym except that it copies cluster mbufs, whereas @@ -548,7 +548,7 @@ Concatenate the mbuf chain pointed to by to the mbuf chain pointed to by .Fa m . The mbuf chains must be of the same type. -.It Fn m_devget "char *buf" "int totlen" "int off0" "struct ifnet *ifp" \ +.It Fn m_devget "char *buf" "int totlen" "int off" "struct ifnet *ifp" \ "void (*func)(const void *, void *, size_t)" Copy .Fa totlen @@ -559,9 +559,9 @@ using the function The data is copied into an mbuf chain and a pointer to the head of it is returned. If -.Fa off0 +.Fa off is non-zero, it means the packet is trailer-encapsulated and -.Fa off0 +.Fa off bytes plus the type and length fields will be skipped before doing the copy. Returns NULL on failure. diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 1acfb96ec49..ba42a460a3c 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.76 2006/07/14 01:58:58 pedro Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.77 2006/10/11 22:39:46 mpf Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -239,16 +239,16 @@ m_prepend(struct mbuf *m, int len, int how) } /* - * Make a copy of an mbuf chain starting "off0" bytes from the beginning, + * Make a copy of an mbuf chain starting "off" bytes from the beginning, * continuing for "len" bytes. If len is M_COPYALL, copy to end of mbuf. * The wait parameter is a choice of M_WAIT/M_DONTWAIT from caller. */ int MCFail; struct mbuf * -m_copym(struct mbuf *m, int off0, int len, int wait) +m_copym(struct mbuf *m, int off, int len, int wait) { - return m_copym0(m, off0, len, wait, 0); /* shallow copy on M_EXT */ + return m_copym0(m, off, len, wait, 0); /* shallow copy on M_EXT */ } /* @@ -256,16 +256,15 @@ m_copym(struct mbuf *m, int off0, int len, int wait) * of merely bumping the reference count. */ struct mbuf * -m_copym2(struct mbuf *m, int off0, int len, int wait) +m_copym2(struct mbuf *m, int off, int len, int wait) { - return m_copym0(m, off0, len, wait, 1); /* deep copy */ + return m_copym0(m, off, len, wait, 1); /* deep copy */ } struct mbuf * -m_copym0(struct mbuf *m, int off0, int len, int wait, int deep) +m_copym0(struct mbuf *m, int off, int len, int wait, int deep) { struct mbuf *n, **np; - int off = off0; struct mbuf *top; int copyhdr = 0; @@ -295,9 +294,7 @@ m_copym0(struct mbuf *m, int off0, int len, int wait, int deep) goto nospace; if (copyhdr) { M_DUP_PKTHDR(n, m); - if (len == M_COPYALL) - n->m_pkthdr.len -= off0; - else + if (len != M_COPYALL) n->m_pkthdr.len = len; copyhdr = 0; } @@ -321,7 +318,7 @@ m_copym0(struct mbuf *m, int off0, int len, int wait, int deep) (unsigned)n->m_len); } } else - memcpy(mtod(n, caddr_t), mtod(m, caddr_t)+off, + memcpy(mtod(n, caddr_t), mtod(m, caddr_t) + off, (unsigned)n->m_len); if (len != M_COPYALL) len -= n->m_len; @@ -819,12 +816,12 @@ extpacket: * Routine to copy from device local memory into mbufs. */ struct mbuf * -m_devget(char *buf, int totlen, int off0, struct ifnet *ifp, +m_devget(char *buf, int totlen, int off, struct ifnet *ifp, void (*copy)(const void *, void *, size_t)) { struct mbuf *m; struct mbuf *top = NULL, **mp = ⊤ - int off = off0, len; + int len; char *cp; char *epkt; |