o Remove the 'all' flag from m_demote(). Users can simply call it with

m_demote(m->m_next) if they wish to start at the second mbuf in chain.
o Test m_type with == instead of &.
o Check m_nextpkt against NULL instead of implicit 0.

Based on feedback from:	sam
This commit is contained in:
Andre Oppermann 2005-08-30 20:07:49 +00:00
parent 86330afe35
commit fbe816384a
2 changed files with 4 additions and 6 deletions

View File

@ -271,11 +271,9 @@ mb_free_ext(struct mbuf *m)
/*
* Clean up mbuf (chain) from any tags and packet headers.
* If "all" is set then the first mbuf in the chain will be
* cleaned too.
*/
void
m_demote(struct mbuf *m0, int all)
m_demote(struct mbuf *m0)
{
struct mbuf *m;
@ -285,9 +283,9 @@ m_demote(struct mbuf *m0, int all)
m->m_flags &= ~M_PKTHDR;
bzero(&m->m_pkthdr, sizeof(struct pkthdr));
}
if (m->m_type & MT_HEADER)
if (m->m_type == MT_HEADER)
m->m_type = MT_DATA;
if (m != m0 && m->m_nextpkt)
if (m != m0 && m->m_nextpkt != NULL)
m->m_nextpkt = NULL;
m->m_flags = m->m_flags & (M_EXT|M_EOR|M_RDONLY|M_FREELIST);
}

View File

@ -579,7 +579,7 @@ struct mbuf *m_copypacket(struct mbuf *, int);
void m_copy_pkthdr(struct mbuf *, struct mbuf *);
struct mbuf *m_copyup(struct mbuf *n, int len, int dstoff);
struct mbuf *m_defrag(struct mbuf *, int);
void m_demote(struct mbuf *, int);
void m_demote(struct mbuf *);
struct mbuf *m_devget(char *, int, int, struct ifnet *,
void (*)(char *, caddr_t, u_int));
struct mbuf *m_dup(struct mbuf *, int);