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 00:44:49 +0000 (17:44 -0700)
commit49a0e0eb3f85502ae6bc91151e345e67eb79314c
tree02d9264f48cdd5ddb4a881a64d63e6fa86ae50d1
parent74e79b7c249f4a38fc6e36dd86cf6eef95f2f800
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