From 9850cd0ff6a08945f57462fb33fbe785edbeb60f Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 9 Sep 2013 22:13:09 -0700 Subject: [PATCH] classifier: Allow CLS_CURSOR_FOR_EACH to use a const-qualified iterator. Signed-off-by: Ben Pfaff Acked-by: Ethan Jackson --- lib/classifier.c | 3 ++- lib/classifier.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/classifier.c b/lib/classifier.c index 93ee977bc..36eb1f0bf 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -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; diff --git a/lib/classifier.h b/lib/classifier.h index 5a454586e..ead087b9e 100644 --- a/lib/classifier.h +++ b/lib/classifier.h @@ -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); \ -- 2.47.0