while (olen > 0) { if (mlen == 0) { if (m2->m_flags & M_PKTHDR) m_tag_delete_chain(m2, NULL); m2->m_flags &= ~M_PKTHDR; if (m2->m_flags & M_EXT) m2->m_data = m2->m_ext.ext_buf; else m2->m_data = m2->m_dat; m2->m_len = 0; mlen = M_TRAILINGSPACE(m2); tcp = mtod(m2, caddr_t); mnew = m2; m2 = m2->m_next; } siz = min(mlen, olen); if (tcp != fcp) bcopy(fcp, tcp, siz); mnew->m_len += siz; mlen -= siz; olen -= siz; tcp += siz; fcp += siz; }
m_copyback(n, off, m->m_len, mtod(m, caddr_t)); off += m->m_len;
nfs_realign(m, hsiz)	struct mbuf *m;	int hsiz;{	struct mbuf *m2;	int siz, mlen, olen;	caddr_t tcp, fcp;	struct mbuf *mnew;	while (m) {	    /*	     * This never happens for UDP, rarely happens for TCP	     * but frequently happens for iso transport.	     */	    if ((m->m_len & 0x3) || (mtod(m, long) & 0x3)) {		olen = m->m_len;		fcp = mtod(m, caddr_t);		if ((long)fcp & 0x3) {		        if (m->m_flags & M_PKTHDR)				m_tag_delete_chain(m, NULL);			m->m_flags &= ~M_PKTHDR;			if (m->m_flags & M_EXT)				m->m_data = m->m_ext.ext_buf +					((m->m_ext.ext_size - olen) & ~0x3);			else				m->m_data = m->m_dat;		}		m->m_len = 0;		tcp = mtod(m, caddr_t);		mnew = m;		m2 = m->m_next;			/*		 * If possible, only put the first invariant part		 * of the RPC header in the first mbuf.		 */		mlen = M_TRAILINGSPACE(m);		if (olen <= hsiz && mlen > hsiz)			mlen = hsiz;			/* Loop through the mbuf list consolidating data. */		while (m) {			while (olen > 0) {				if (mlen == 0) {				        if (m2->m_flags & M_PKTHDR)						m_tag_delete_chain(m2, NULL);					m2->m_flags &= ~M_PKTHDR;					if (m2->m_flags & M_EXT)						m2->m_data = m2->m_ext.ext_buf;					else						m2->m_data = m2->m_dat;					m2->m_len = 0;					mlen = M_TRAILINGSPACE(m2);					tcp = mtod(m2, caddr_t);					mnew = m2;					m2 = m2->m_next;				}				siz = min(mlen, olen);				if (tcp != fcp)					bcopy(fcp, tcp, siz);				mnew->m_len += siz;				mlen -= siz;				olen -= siz;				tcp += siz;				fcp += siz;			}			m = m->m_next;			if (m) {				olen = m->m_len;				fcp = mtod(m, caddr_t);			}		}			/*		 * Finally, set m_len == 0 for any trailing mbufs that have		 * been copied out of.		 */		while (m2) {			m2->m_len = 0;			m2 = m2->m_next;		}		return;	    }	    m = m->m_next;	}}