mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-22 07:20:00 +00:00
mbuf: provide m_freemp()
This function follows both m_nextpkt and m_next linkage freeing all mbufs. Note that existing m_freem() follows only m_next. Reviewed by: khng Differential Revision: https://reviews.freebsd.org/D45477
This commit is contained in:
parent
ef659a2d04
commit
badf44cc21
@ -1591,6 +1591,25 @@ m_freem(struct mbuf *mb)
|
||||
mb = m_free(mb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free an entire chain of mbufs and associated external buffers, following
|
||||
* both m_next and m_nextpkt linkage.
|
||||
* Note: doesn't support NULL argument.
|
||||
*/
|
||||
void
|
||||
m_freemp(struct mbuf *m)
|
||||
{
|
||||
struct mbuf *n;
|
||||
|
||||
MBUF_PROBE1(m__freemp, m);
|
||||
do {
|
||||
n = m->m_nextpkt;
|
||||
while (m != NULL)
|
||||
m = m_free(m);
|
||||
m = n;
|
||||
} while (m != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Temporary primitive to allow freeing without going through m_free.
|
||||
*/
|
||||
|
@ -111,6 +111,9 @@ SDT_PROBE_DEFINE1_XLATE(sdt, , , m__free,
|
||||
SDT_PROBE_DEFINE1_XLATE(sdt, , , m__freem,
|
||||
"struct mbuf *", "mbufinfo_t *");
|
||||
|
||||
SDT_PROBE_DEFINE1_XLATE(sdt, , , m__freemp,
|
||||
"struct mbuf *", "mbufinfo_t *");
|
||||
|
||||
#include <security/mac/mac_framework.h>
|
||||
|
||||
/*
|
||||
|
@ -65,6 +65,7 @@ SDT_PROBE_DECLARE(sdt, , , m__cljget);
|
||||
SDT_PROBE_DECLARE(sdt, , , m__cljset);
|
||||
SDT_PROBE_DECLARE(sdt, , , m__free);
|
||||
SDT_PROBE_DECLARE(sdt, , , m__freem);
|
||||
SDT_PROBE_DECLARE(sdt, , , m__freemp);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
@ -843,6 +844,7 @@ void m_extadd(struct mbuf *, char *, u_int, m_ext_free_t,
|
||||
u_int m_fixhdr(struct mbuf *);
|
||||
struct mbuf *m_fragment(struct mbuf *, int, int);
|
||||
void m_freem(struct mbuf *);
|
||||
void m_freemp(struct mbuf *);
|
||||
void m_free_raw(struct mbuf *);
|
||||
struct mbuf *m_get2(int, int, short, int);
|
||||
struct mbuf *m_get3(int, int, short, int);
|
||||
|
Loading…
Reference in New Issue
Block a user