Deleted Added
full compact
33c33
< __FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 135904 2004-09-28 18:40:18Z jmg $");
---
> __FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 138541 2004-12-08 05:42:02Z sam $");
936a937,982
> * Append the specified data to the indicated mbuf chain,
> * Extend the mbuf chain if the new data does not fit in
> * existing space.
> *
> * Return 1 if able to complete the job; otherwise 0.
> */
> int
> m_append(struct mbuf *m0, int len, c_caddr_t cp)
> {
> struct mbuf *m, *n;
> int remainder, space;
>
> for (m = m0; m->m_next != NULL; m = m->m_next)
> ;
> remainder = len;
> space = M_TRAILINGSPACE(m);
> if (space > 0) {
> /*
> * Copy into available space.
> */
> if (space > remainder)
> space = remainder;
> bcopy(cp, mtod(m, caddr_t) + m->m_len, space);
> m->m_len += space;
> cp += space, remainder -= space;
> }
> while (remainder > 0) {
> /*
> * Allocate a new mbuf; could check space
> * and allocate a cluster instead.
> */
> n = m_get(M_DONTWAIT, m->m_type);
> if (n == NULL)
> break;
> n->m_len = min(MLEN, remainder);
> bcopy(cp, mtod(m, caddr_t), m->m_len);
> cp += m->m_len, remainder -= m->m_len;
> m->m_next = n;
> m = n;
> }
> if (m0->m_flags & M_PKTHDR)
> m0->m_pkthdr.len += len - remainder;
> return (remainder == 0);
> }
>
> /*