MCPcopy Create free account
hub / github.com/F-Stack/f-stack / m_cat

Function m_cat

freebsd/kern/uipc_mbuf.c:748–767  ·  view source on GitHub ↗

* Concatenate mbuf chain n to m. * Both chains must be of the same type (e.g. MT_DATA). * Any m_pkthdr is not updated. */

Source from the content-addressed store, hash-verified

746 * Any m_pkthdr is not updated.
747 */
748void
749m_cat(struct mbuf *m, struct mbuf *n)
750{
751 while (m->m_next)
752 m = m->m_next;
753 while (n) {
754 if (!M_WRITABLE(m) ||
755 (n->m_flags & M_EXTPG) != 0 ||
756 M_TRAILINGSPACE(m) < n->m_len) {
757 /* just join the two chains */
758 m->m_next = n;
759 return;
760 }
761 /* splat the data from one into the other */
762 bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len,
763 (u_int)n->m_len);
764 m->m_len += n->m_len;
765 n = m_free(n);
766 }
767}
768
769/*
770 * Concatenate two pkthdr mbuf chains.

Callers 15

pf_join_fragmentFunction · 0.85
ip_reassFunction · 0.85
frag6_inputFunction · 0.85
ip6_fragmentFunction · 0.85
soreceive_streamFunction · 0.85
m_catpktFunction · 0.85
m_defragFunction · 0.85
debugnet_sendFunction · 0.85
firewire_input_fragmentFunction · 0.85
ng_l2cap_lp_receiveFunction · 0.85
key_gather_mbufFunction · 0.85

Calls 1

m_freeFunction · 0.50

Tested by

no test coverage detected