ofproto: Mark immutable members of struct rule 'const'.
authorBen Pfaff <blp@nicira.com>
Wed, 11 Sep 2013 04:31:59 +0000 (21:31 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 13 Sep 2013 04:29:29 +0000 (21:29 -0700)
commit88d4914da1ad3c85416305a9a6e68cc073acd407
tree44dbf79f76d793976f3fa6ee3a9eefde321e6182
parenta229146e6acfb0364e8e4149ca020c6900c9b630
ofproto: Mark immutable members of struct rule 'const'.

One difficult part of make flow_mods thread-safe is sorting out which
members of each structure can be modified under which locks and,
especially, documenting this in a way that makes it hard for programmers to
get it wrong later.  The compiler provides some tools for us, however, and
'const' is one of the nicer ones since it is standardized rather than part
of a compiler extension.

This commit makes use of 'const' to mark the immutable members of struct
rule, which is definitely the most confusing structure regarding thread
safety simply because it has so many members that use different forms of
synchronization.  It also adds a bunch of CONST_CASTs to allow these
members to be initialized and destroyed where necessary.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofproto/ofproto-dpif.c
ofproto/ofproto-provider.h
ofproto/ofproto.c