Subject: mbuf context
To: None <firstname.lastname@example.org>
From: Iain Hibbert <email@example.com>
Date: 03/06/2006 19:30:14
in sys/mbuf.h there exists some macros to store/extract private context
information in a mbuf, so.
* Allow drivers and/or protocols to use the rcvif member of
* PKTHDR mbufs to store private context information.
#define M_GETCTX(m, t) ((t) (m)->m_pkthdr.rcvif + 0)
#define M_SETCTX(m, c) ((void) ((m)->m_pkthdr.rcvif = (void *) (c)))
is there a good reason for the '+ 0' in M_GETCTX? I get compiler
complaints extracting a 'void *' because of the pointer arithmetic..
The type is actually irrelevant for me since all I am doing is passing
unknown context information to a far away function which knows what the
type is. I ended up using
void *arg = M_GETCTX(m, uint8_t *);
which looks .. strange.