[ovs-dev] [PATCH 08/14] datapath: Add compatibility code for inet_add_protocol().

Ben Pfaff blp at nicira.com
Thu Dec 2 23:50:23 UTC 2010


On Thu, Dec 02, 2010 at 12:36:57PM -0800, Jesse Gross wrote:
> Kernels earlier than 2.6.32 did not mark struct net_protocol as const
> in inet_add_protcol() and inet_del_protocol().  This provides compatibility
> code to cast away the constness on these kernels so we can have them be
> const on newer kernels.
> 
> Signed-off-by: Jesse Gross <jesse at nicira.com>

...

> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
> +#define inet_add_protocol(prot, num) inet_add_protocol((struct net_protocol *)prot, num)
> +#define inet_del_protocol(prot, num) inet_del_protocol((struct net_protocol *)prot, num)

Given that casts have a very high precedence it's a good idea to write
(prot) instead of prot in each expansion.  With that change applied:

Acked-by: Ben Pfaff <blp at nicira.com>




More information about the dev mailing list