summaryrefslogtreecommitdiff
path: root/lib/classifier.h
diff options
context:
space:
mode:
authorJarno Rajahalme <jrajahalme@nicira.com>2014-11-06 14:55:29 -0800
committerJarno Rajahalme <jrajahalme@nicira.com>2014-11-06 14:55:29 -0800
commitdfea28b3b497cbf9efe4f12a0f742d486cdcc69f (patch)
treefe68e7f6769233c3567a34e7f38f99f73bf3ce3d /lib/classifier.h
parent059def1e2fa50223bee7dd04d4075d72bc5845a2 (diff)
downloadopenvswitch-dfea28b3b497cbf9efe4f12a0f742d486cdcc69f.tar.gz
classifier: Constify RCU pointers.
Returning const struct cls_rule pointers from the classifier API helps callers to remember that they should not modify the rules returned. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/classifier.h')
-rw-r--r--lib/classifier.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/classifier.h b/lib/classifier.h
index 92be5bf2f..a884e2469 100644
--- a/lib/classifier.h
+++ b/lib/classifier.h
@@ -288,21 +288,22 @@ bool classifier_set_prefix_fields(struct classifier *,
bool classifier_is_empty(const struct classifier *);
int classifier_count(const struct classifier *);
void classifier_insert(struct classifier *, struct cls_rule *);
-struct cls_rule *classifier_replace(struct classifier *, struct cls_rule *);
-
-struct cls_rule *classifier_remove(struct classifier *, struct cls_rule *);
-struct cls_rule *classifier_lookup(const struct classifier *,
- const struct flow *,
- struct flow_wildcards *);
+const struct cls_rule *classifier_replace(struct classifier *,
+ struct cls_rule *);
+const struct cls_rule *classifier_remove(struct classifier *,
+ const struct cls_rule *);
+const struct cls_rule *classifier_lookup(const struct classifier *,
+ const struct flow *,
+ struct flow_wildcards *);
bool classifier_rule_overlaps(const struct classifier *,
const struct cls_rule *);
-struct cls_rule *classifier_find_rule_exactly(const struct classifier *,
- const struct cls_rule *);
+const struct cls_rule *classifier_find_rule_exactly(const struct classifier *,
+ const struct cls_rule *);
-struct cls_rule *classifier_find_match_exactly(const struct classifier *,
- const struct match *,
- int priority);
+const struct cls_rule *classifier_find_match_exactly(const struct classifier *,
+ const struct match *,
+ int priority);
/* Iteration. */
@@ -312,7 +313,7 @@ struct cls_cursor {
const struct cls_rule *target;
struct cmap_cursor subtables;
struct cmap_cursor rules;
- struct cls_rule *rule;
+ const struct cls_rule *rule;
bool safe;
};