ofproto: Mark immutable members of struct rule 'const'.
[sliver-openvswitch.git] / ofproto / ofproto-provider.h
index 4e5b0bf..a3640bd 100644 (file)
@@ -227,8 +227,13 @@ struct oftable {
  * With few exceptions, ofproto implementations may look at these fields but
  * should not modify them. */
 struct rule {
-    struct ofproto *ofproto;     /* The ofproto that contains this rule. */
-    struct cls_rule cr;          /* In owning ofproto's classifier. */
+    /* Where this rule resides in an OpenFlow switch.
+     *
+     * These are immutable once the rule is constructed, hence 'const'. */
+    struct ofproto *const ofproto; /* The ofproto that contains this rule. */
+    const struct cls_rule cr;      /* In owning ofproto's classifier. */
+    const uint8_t table_id;        /* Index in ofproto's 'tables' array. */
+
     atomic_uint ref_count;
 
     struct ofoperation *pending; /* Operation now in progress, if nonnull. */
@@ -240,10 +245,8 @@ struct rule {
     long long int created;       /* Creation time. */
     long long int modified;      /* Time of last modification. */
     long long int used;          /* Last use; time created if never used. */
-    uint8_t table_id;            /* Index in ofproto's 'tables' array. */
     enum ofputil_flow_mod_flags flags;
 
-    struct ovs_mutex timeout_mutex;
     uint16_t hard_timeout OVS_GUARDED; /* In seconds from ->modified. */
     uint16_t idle_timeout OVS_GUARDED; /* In seconds from ->used. */
 
@@ -342,16 +345,11 @@ void ofproto_rule_delete(struct ofproto *, struct classifier *cls,
                          struct rule *) OVS_REQ_WRLOCK(cls->rwlock);
 void ofproto_rule_reduce_timeouts(struct rule *rule, uint16_t idle_timeout,
                                   uint16_t hard_timeout)
-    OVS_EXCLUDED(ofproto_mutex, rule->timeout_mutex);
-
-bool ofproto_rule_has_out_port(const struct rule *, ofp_port_t out_port);
+    OVS_EXCLUDED(ofproto_mutex, rule->mutex);
 
 void ofoperation_complete(struct ofoperation *, enum ofperr);
 
 bool ofoperation_has_out_port(const struct ofoperation *, ofp_port_t out_port);
-bool ofproto_rule_has_out_group(const struct rule *, uint32_t group_id);
-
-bool ofproto_rule_is_hidden(const struct rule *);
 
 /* A group within a "struct ofproto".
  *