add m_copyup(9) obtained from FreeBSD (manual only)

This commit is contained in:
ryo 2013-06-17 09:58:21 +00:00
parent 0b17430ea3
commit dedc54f76f
2 changed files with 28 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.371 2013/05/22 16:01:44 christos Exp $ # $NetBSD: Makefile,v 1.372 2013/06/17 09:58:21 ryo Exp $
# Makefile for section 9 (kernel function and variable) manual pages. # Makefile for section 9 (kernel function and variable) manual pages.
@ -462,8 +462,8 @@ MLINKS+=mbuf.9 m_get.9 mbuf.9 m_getclr.9 mbuf.9 m_gethdr.9 mbuf.9 m_devget.9 \
mbuf.9 m_copyback.9 mbuf.9 m_cat.9 mbuf.9 m_dup.9 mbuf.9 m_prepend.9 \ mbuf.9 m_copyback.9 mbuf.9 m_cat.9 mbuf.9 m_dup.9 mbuf.9 m_prepend.9 \
mbuf.9 m_copyback_cow.9 \ mbuf.9 m_copyback_cow.9 \
mbuf.9 m_makewritable.9 \ mbuf.9 m_makewritable.9 \
mbuf.9 m_pulldown.9 \ mbuf.9 m_pulldown.9 mbuf.9 m_pullup.9 mbuf.9 m_copyup.9 \
mbuf.9 m_pullup.9 mbuf.9 m_split.9 mbuf.9 m_adj.9 mbuf.9 m_free.9 \ mbuf.9 m_split.9 mbuf.9 m_adj.9 mbuf.9 m_free.9 \
mbuf.9 m_freem.9 mbuf.9 mtod.9 mbuf.9 mtocl.9 mbuf.9 cltom.9 \ mbuf.9 m_freem.9 mbuf.9 mtod.9 mbuf.9 mtocl.9 mbuf.9 cltom.9 \
mbuf.9 MGET.9 mbuf.9 MGETHDR.9 mbuf.9 MEXTMALLOC.9 \ mbuf.9 MGET.9 mbuf.9 MGETHDR.9 mbuf.9 MEXTMALLOC.9 \
mbuf.9 MEXTADD.9 mbuf.9 MCLGET.9 mbuf.9 M_COPY_PKTHDR.9 \ mbuf.9 MEXTADD.9 mbuf.9 MCLGET.9 mbuf.9 M_COPY_PKTHDR.9 \

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mbuf.9,v 1.50 2010/12/02 12:54:13 wiz Exp $ .\" $NetBSD: mbuf.9,v 1.51 2013/06/17 09:58:21 ryo Exp $
.\" .\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc. .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd March 24, 2008 .Dd June 17, 2013
.Dt MBUF 9 .Dt MBUF 9
.Os .Os
.Sh NAME .Sh NAME
@ -47,6 +47,7 @@
.Nm m_prepend , .Nm m_prepend ,
.Nm m_pulldown , .Nm m_pulldown ,
.Nm m_pullup , .Nm m_pullup ,
.Nm m_copyup ,
.Nm m_split , .Nm m_split ,
.Nm m_adj , .Nm m_adj ,
.Nm m_apply , .Nm m_apply ,
@ -101,6 +102,8 @@
.Ft struct mbuf * .Ft struct mbuf *
.Fn m_pullup "struct mbuf *n" "int len" .Fn m_pullup "struct mbuf *n" "int len"
.Ft struct mbuf * .Ft struct mbuf *
.Fn m_copyup "struct mbuf *m" "int len" "int dstoff"
.Ft struct mbuf *
.Fn m_split "struct mbuf *m0" "int len0" "int wait" .Fn m_split "struct mbuf *m0" "int len0" "int wait"
.Ft void .Ft void
.Fn m_adj "struct mbuf *mp" "int req_len" .Fn m_adj "struct mbuf *mp" "int req_len"
@ -485,6 +488,26 @@ contiguous region to possibly avoid being called again.
.Fa len .Fa len
must be smaller or equal than must be smaller or equal than
.Dv MHLEN . .Dv MHLEN .
.It Fn m_copyup "struct mbuf *m" "int len" "int dstoff"
Similar to
.Fn m_pullup
but copies
.Fa len
bytes of data into a new mbuf at
.Fa dstoff
bytes into the mbuf.
The
.Fa dstoff
argument aligns the data and leaves room for a link layer header.
Returns the new
mbuf chain on success, and frees the mbuf chain and returns
.Dv NULL
on failure.
Note that
the function does not allocate mbuf clusters, so
.Fa len + dstoff
must be less than
.Dv MHLEN .
.It Fn m_split "struct mbuf *m0" "int len0" "int wait" .It Fn m_split "struct mbuf *m0" "int len0" "int wait"
Partitions an mbuf chain in two pieces, returning the tail, Partitions an mbuf chain in two pieces, returning the tail,
which is all but the first which is all but the first