* Concatenate mbuf chain n to m. * Both chains must be of the same type (e.g. MT_DATA). * Any m_pkthdr is not updated. */
| 746 | * Any m_pkthdr is not updated. |
| 747 | */ |
| 748 | void |
| 749 | m_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. |
no test coverage detected