Date: Thu, 17 Oct 2013 19:56:50 +0000 (UTC) From: Andre Oppermann <andre@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256697 - in user/andre/mbuf_staging: kern sys Message-ID: <201310171956.r9HJuopc006020@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andre Date: Thu Oct 17 19:56:50 2013 New Revision: 256697 URL: http://svnweb.freebsd.org/changeset/base/256697 Log: Internalize struct mb_args from sys/mbuf.h into kern/kern_mbuf.c which is the only place where it used now. Be consequent and move m_last() to a real function as well. Move the MCHTYPE() macro and m_chtype() inline function together and decide later what to do with them. The warning in the comment doesn't seem to be true. Modified: user/andre/mbuf_staging/kern/kern_mbuf.c user/andre/mbuf_staging/sys/mbuf.h Modified: user/andre/mbuf_staging/kern/kern_mbuf.c ============================================================================== --- user/andre/mbuf_staging/kern/kern_mbuf.c Thu Oct 17 19:24:10 2013 (r256696) +++ user/andre/mbuf_staging/kern/kern_mbuf.c Thu Oct 17 19:56:50 2013 (r256697) @@ -300,6 +300,15 @@ static void mb_reclaim(void *); static void *mbuf_jumbo_alloc(uma_zone_t, int, uint8_t *, int); /* + * Argument structure passed to UMA routines during mbuf and packet + * allocations. + */ +struct mb_args { + int flags; /* Flags for mbuf being allocated */ + short type; /* Type of mbuf being allocated */ +}; + +/* * Initialize FreeBSD Network buffer allocation. */ static void Modified: user/andre/mbuf_staging/sys/mbuf.h ============================================================================== --- user/andre/mbuf_staging/sys/mbuf.h Thu Oct 17 19:24:10 2013 (r256696) +++ user/andre/mbuf_staging/sys/mbuf.h Thu Oct 17 19:56:50 2013 (r256697) @@ -75,15 +75,6 @@ */ #define mtod(m, t) ((t)((m)->m_data)) #define mtodo(m, o) ((void *)(((m)->m_data) + (o))) - -/* - * Argument structure passed to UMA routines during mbuf and packet - * allocations. - */ -struct mb_args { - int flags; /* Flags for mbuf being allocated */ - short type; /* Type of mbuf being allocated */ -}; #endif /* _KERNEL */ /* @@ -523,6 +514,14 @@ struct mbuf *m_get2(int, int, short, int struct mbuf *m_getjcl(int, short, int, int); struct mbuf *m_getm2(struct mbuf *, int, int, short, int); + + +/* + * Change mbuf to new type. This is a relatively expensive operation and + * should be avoided. + */ +#define MCHTYPE(m, t) m_chtype((m), (t)) + static __inline void m_chtype(struct mbuf *m, short new_type) { @@ -537,15 +536,6 @@ m_clrprotoflags(struct mbuf *m) m->m_flags &= ~M_PROTOFLAGS; } -static __inline struct mbuf * -m_last(struct mbuf *m) -{ - - while (m->m_next) - m = m->m_next; - return (m); -} - /* * mbuf, cluster, and external object allocation macros (for compatibility * purposes). @@ -613,12 +603,6 @@ int _m_trailingspace(const struct mbuf * */ #define M_PREPEND(m, plen, how) (m = m_prepend(m, plen, how)) -/* - * Change mbuf to new type. This is a relatively expensive operation and - * should be avoided. - */ -#define MCHTYPE(m, t) m_chtype((m), (t)) - /* Length to m_copy to copy all. */ #define M_COPYALL 1000000000 @@ -660,6 +644,7 @@ int m_dup_pkthdr(struct mbuf *, struct u_int m_fixhdr(struct mbuf *); struct mbuf *m_fragment(struct mbuf *, int, int); struct mbuf *m_getptr(struct mbuf *, int, int *); +struct mbuf *m_last(struct mbuf *); u_int m_length(struct mbuf *, struct mbuf **); int m_mbuftouio(struct uio *, struct mbuf *, int); void m_move_pkthdr(struct mbuf *, struct mbuf *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310171956.r9HJuopc006020>