diff options
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 27ca156..ea8f16d 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -62,72 +62,6 @@ SYSCTL_INT(_kern_ipc, KIPC_MAX_HDR, max_hdr, CTLFLAG_RW, &max_hdr, 0, ""); SYSCTL_INT(_kern_ipc, KIPC_MAX_DATALEN, max_datalen, CTLFLAG_RW, &max_datalen, 0, ""); -/* - * struct mbuf * - * m_getm(m, len, how, type) - * - * This will allocate len-worth of mbufs and/or mbuf clusters (whatever fits - * best) and return a pointer to the top of the allocated chain. If m is - * non-null, then we assume that it is a single mbuf or an mbuf chain to - * which we want len bytes worth of mbufs and/or clusters attached, and so - * if we succeed in allocating it, we will just return a pointer to m. - * - * If we happen to fail at any point during the allocation, we will free - * up everything we have already allocated and return NULL. - * - */ -struct mbuf * -m_getm(struct mbuf *m, int len, int how, int type) -{ - struct mbuf *top, *tail, *mp, *mtail = NULL; - - KASSERT(len >= 0, ("len is < 0 in m_getm")); - - MGET(mp, how, type); - if (mp == NULL) - return (NULL); - else if (len > MINCLSIZE) { - MCLGET(mp, how); - if ((mp->m_flags & M_EXT) == 0) { - m_free(mp); - return (NULL); - } - } - mp->m_len = 0; - len -= M_TRAILINGSPACE(mp); - - if (m != NULL) - for (mtail = m; mtail->m_next != NULL; mtail = mtail->m_next); - else - m = mp; - - top = tail = mp; - while (len > 0) { - MGET(mp, how, type); - if (mp == NULL) - goto failed; - - tail->m_next = mp; - tail = mp; - if (len > MINCLSIZE) { - MCLGET(mp, how); - if ((mp->m_flags & M_EXT) == 0) - goto failed; - } - - mp->m_len = 0; - len -= M_TRAILINGSPACE(mp); - } - - if (mtail != NULL) - mtail->m_next = top; - return (m); - -failed: - m_freem(top); - return (NULL); -} - void m_freem(struct mbuf *m) { |