Commit cfe2f14c authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller

qdisc: constify meta_type_ops structures

The meta_type_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e178c8c2
...@@ -796,7 +796,7 @@ struct meta_type_ops { ...@@ -796,7 +796,7 @@ struct meta_type_ops {
int (*dump)(struct sk_buff *, struct meta_value *, int); int (*dump)(struct sk_buff *, struct meta_value *, int);
}; };
static struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX + 1] = { static const struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX + 1] = {
[TCF_META_TYPE_VAR] = { [TCF_META_TYPE_VAR] = {
.destroy = meta_var_destroy, .destroy = meta_var_destroy,
.compare = meta_var_compare, .compare = meta_var_compare,
...@@ -812,7 +812,7 @@ static struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX + 1] = { ...@@ -812,7 +812,7 @@ static struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX + 1] = {
} }
}; };
static inline struct meta_type_ops *meta_type_ops(struct meta_value *v) static inline const struct meta_type_ops *meta_type_ops(struct meta_value *v)
{ {
return &__meta_type_ops[meta_type(v)]; return &__meta_type_ops[meta_type(v)];
} }
...@@ -870,7 +870,7 @@ static int em_meta_match(struct sk_buff *skb, struct tcf_ematch *m, ...@@ -870,7 +870,7 @@ static int em_meta_match(struct sk_buff *skb, struct tcf_ematch *m,
static void meta_delete(struct meta_match *meta) static void meta_delete(struct meta_match *meta)
{ {
if (meta) { if (meta) {
struct meta_type_ops *ops = meta_type_ops(&meta->lvalue); const struct meta_type_ops *ops = meta_type_ops(&meta->lvalue);
if (ops && ops->destroy) { if (ops && ops->destroy) {
ops->destroy(&meta->lvalue); ops->destroy(&meta->lvalue);
...@@ -964,7 +964,7 @@ static int em_meta_dump(struct sk_buff *skb, struct tcf_ematch *em) ...@@ -964,7 +964,7 @@ static int em_meta_dump(struct sk_buff *skb, struct tcf_ematch *em)
{ {
struct meta_match *meta = (struct meta_match *) em->data; struct meta_match *meta = (struct meta_match *) em->data;
struct tcf_meta_hdr hdr; struct tcf_meta_hdr hdr;
struct meta_type_ops *ops; const struct meta_type_ops *ops;
memset(&hdr, 0, sizeof(hdr)); memset(&hdr, 0, sizeof(hdr));
memcpy(&hdr.left, &meta->lvalue.hdr, sizeof(hdr.left)); memcpy(&hdr.left, &meta->lvalue.hdr, sizeof(hdr.left));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment