svn commit: r271088 - in head/sys: kern sys

Gleb Smirnoff glebius at FreeBSD.org
Thu Sep 4 09:07:14 UTC 2014


Author: glebius
Date: Thu Sep  4 09:07:14 2014
New Revision: 271088
URL: http://svnweb.freebsd.org/changeset/base/271088

Log:
  Provide m_catpkt(), a wrapper around m_cat() that deals with M_PKTHDR mbufs.
  
  Sponsored by:	Netflix
  Sponsored by:	Nginx, Inc.

Modified:
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/uipc_mbuf.c
==============================================================================
--- head/sys/kern/uipc_mbuf.c	Thu Sep  4 06:07:32 2014	(r271087)
+++ head/sys/kern/uipc_mbuf.c	Thu Sep  4 09:07:14 2014	(r271088)
@@ -990,6 +990,22 @@ m_cat(struct mbuf *m, struct mbuf *n)
 	}
 }
 
+/*
+ * Concatenate two pkthdr mbuf chains.
+ */
+void
+m_catpkt(struct mbuf *m, struct mbuf *n)
+{
+
+	M_ASSERTPKTHDR(m);
+	M_ASSERTPKTHDR(n);
+
+	m->m_pkthdr.len += n->m_pkthdr.len;
+	m_demote(n, 1);
+
+	m_cat(m, n);
+}
+
 void
 m_adj(struct mbuf *mp, int req_len)
 {

Modified: head/sys/sys/mbuf.h
==============================================================================
--- head/sys/sys/mbuf.h	Thu Sep  4 06:07:32 2014	(r271087)
+++ head/sys/sys/mbuf.h	Thu Sep  4 09:07:14 2014	(r271088)
@@ -915,6 +915,7 @@ int		 m_apply(struct mbuf *, int, int,
 		    int (*)(void *, void *, u_int), void *);
 int		 m_append(struct mbuf *, int, c_caddr_t);
 void		 m_cat(struct mbuf *, struct mbuf *);
+void		 m_catpkt(struct mbuf *, struct mbuf *);
 int		 m_extadd(struct mbuf *, caddr_t, u_int,
 		    void (*)(struct mbuf *, void *, void *), void *, void *,
 		    int, int, int);


More information about the svn-src-all mailing list