Subject: Re: mbuf context
To: Iain Hibbert <plunky@rya-online.net>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 03/06/2006 14:16:27
Iain Hibbert wrote:
> Hi,
> 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: matt@3am-software.com
3am Software Foundry www: http://3am-software.com/bio/matt/
Cupertino, CA disclaimer: I avow all knowledge of this message.