Subject: Re: mbuf context
To: Iain Hibbert <firstname.lastname@example.org>
From: Matt Thomas <email@example.com>
Date: 03/06/2006 14:16:27
Iain Hibbert wrote:
> 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..
It prevents M_GETCTX to be used as an lvalue.
Matt Thomas email: firstname.lastname@example.org
3am Software Foundry www: http://3am-software.com/bio/matt/
Cupertino, CA disclaimer: I avow all knowledge of this message.