classifier: Allow CLS_CURSOR_FOR_EACH to use a const-qualified iterator.
authorBen Pfaff <blp@nicira.com>
Tue, 10 Sep 2013 05:13:09 +0000 (22:13 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 13 Sep 2013 04:18:45 +0000 (21:18 -0700)
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
lib/classifier.c
lib/classifier.h

index 93ee977..36eb1f0 100644 (file)
@@ -500,8 +500,9 @@ cls_cursor_first(struct cls_cursor *cursor)
 /* Returns the next matching cls_rule in 'cursor''s iteration, or a null
  * pointer if there are no more matches. */
 struct cls_rule *
-cls_cursor_next(struct cls_cursor *cursor, struct cls_rule *rule)
+cls_cursor_next(struct cls_cursor *cursor, const struct cls_rule *rule_)
 {
+    struct cls_rule *rule = CONST_CAST(struct cls_rule *, rule_);
     const struct cls_table *table;
     struct cls_rule *next;
 
index 5a45458..ead087b 100644 (file)
@@ -140,7 +140,7 @@ struct cls_cursor {
 void cls_cursor_init(struct cls_cursor *cursor, const struct classifier *cls,
                      const struct cls_rule *match) OVS_REQ_RDLOCK(cls->rwlock);
 struct cls_rule *cls_cursor_first(struct cls_cursor *cursor);
-struct cls_rule *cls_cursor_next(struct cls_cursor *cursor, struct cls_rule *);
+struct cls_rule *cls_cursor_next(struct cls_cursor *cursor, const struct cls_rule *);
 
 #define CLS_CURSOR_FOR_EACH(RULE, MEMBER, CURSOR)                       \
     for (ASSIGN_CONTAINER(RULE, cls_cursor_first(CURSOR), MEMBER);      \