svn commit: r252796 - stable/9/sys/kern
Andre Oppermann
andre at FreeBSD.org
Fri Jul 5 16:03:20 UTC 2013
Author: andre
Date: Fri Jul 5 16:03:19 2013
New Revision: 252796
URL: http://svnweb.freebsd.org/changeset/base/252796
Log:
MFC r242256:
Improve m_cat() by being able to also merge contents from M_EXT
mbuf's by doing proper testing with M_WRITABLE().
In m_collapse() replace an incomplete manual check for M_RDONLY
with the M_WRITABLE() macro that also tests for shared buffers
and other cases that make a particular mbuf immutable.
Modified:
stable/9/sys/kern/uipc_mbuf.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/kern/uipc_mbuf.c
==============================================================================
--- stable/9/sys/kern/uipc_mbuf.c Fri Jul 5 16:00:01 2013 (r252795)
+++ stable/9/sys/kern/uipc_mbuf.c Fri Jul 5 16:03:19 2013 (r252796)
@@ -911,8 +911,8 @@ m_cat(struct mbuf *m, struct mbuf *n)
while (m->m_next)
m = m->m_next;
while (n) {
- if (m->m_flags & M_EXT ||
- m->m_data + m->m_len + n->m_len >= &m->m_dat[MLEN]) {
+ if (!M_WRITABLE(m) ||
+ M_TRAILINGSPACE(m) < n->m_len) {
/* just join the two chains */
m->m_next = n;
return;
@@ -1584,7 +1584,7 @@ again:
n = m->m_next;
if (n == NULL)
break;
- if ((m->m_flags & M_RDONLY) == 0 &&
+ if (M_WRITABLE(m) &&
n->m_len < M_TRAILINGSPACE(m)) {
bcopy(mtod(n, void *), mtod(m, char *) + m->m_len,
n->m_len);
More information about the svn-src-stable-9
mailing list