From 8f88de56d8ab22e6b34dba81ebf69e75929706ff Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 19 Dec 2010 02:09:19 +0100 Subject: kernel: do not mix const and __read_mostly It makes no sense to mix these two. Either it is writable-plus-read-mostly, or it is constant. --- kernel/ip_set_hash_netport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kernel/ip_set_hash_netport.c') diff --git a/kernel/ip_set_hash_netport.c b/kernel/ip_set_hash_netport.c index 2c42c5b..9c4767e 100644 --- a/kernel/ip_set_hash_netport.c +++ b/kernel/ip_set_hash_netport.c @@ -175,7 +175,7 @@ hash_netport4_kadt(struct ip_set *set, const struct sk_buff *skb, } static const struct nla_policy -hash_netport_adt_policy[IPSET_ATTR_ADT_MAX + 1] __read_mostly = { +hash_netport_adt_policy[IPSET_ATTR_ADT_MAX + 1] = { [IPSET_ATTR_IP] = { .type = NLA_NESTED }, [IPSET_ATTR_PORT] = { .type = NLA_U16 }, [IPSET_ATTR_PORT_TO] = { .type = NLA_U16 }, @@ -500,7 +500,7 @@ hash_netport6_uadt(struct ip_set *set, struct nlattr *head, int len, /* Create hash:ip type of sets */ static const struct nla_policy -hash_netport_create_policy[IPSET_ATTR_CREATE_MAX+1] __read_mostly = { +hash_netport_create_policy[IPSET_ATTR_CREATE_MAX+1] = { [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 }, [IPSET_ATTR_MAXELEM] = { .type = NLA_U32 }, [IPSET_ATTR_PROBES] = { .type = NLA_U8 }, -- cgit v1.2.3 From 7e476b3d15ae050137906a9e572d255e66c05d62 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 19 Dec 2010 02:48:32 +0100 Subject: kernel: use __read_mostly for registration-type structures Here is where __read_mostly goes :-) --- kernel/ip_set_hash_netport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/ip_set_hash_netport.c') diff --git a/kernel/ip_set_hash_netport.c b/kernel/ip_set_hash_netport.c index 9c4767e..c3f47a1 100644 --- a/kernel/ip_set_hash_netport.c +++ b/kernel/ip_set_hash_netport.c @@ -578,7 +578,7 @@ hash_netport_create(struct ip_set *set, struct nlattr *head, int len, u32 flags) return 0; } -static struct ip_set_type hash_netport_type = { +static struct ip_set_type hash_netport_type __read_mostly = { .name = "hash:net,port", .protocol = IPSET_PROTOCOL, .features = IPSET_TYPE_IP | IPSET_TYPE_PORT, -- cgit v1.2.3 From 3850182ab671a7726f02c495dd5422629e2520dd Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 19 Dec 2010 02:44:14 +0100 Subject: kernel: const annotations --- kernel/ip_set_hash_netport.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'kernel/ip_set_hash_netport.c') diff --git a/kernel/ip_set_hash_netport.c b/kernel/ip_set_hash_netport.c index c3f47a1..9233ce0 100644 --- a/kernel/ip_set_hash_netport.c +++ b/kernel/ip_set_hash_netport.c @@ -154,7 +154,7 @@ static int hash_netport4_kadt(struct ip_set *set, const struct sk_buff *skb, enum ipset_adt adt, u8 pf, u8 dim, u8 flags) { - struct ip_set_hash *h = set->data; + const struct ip_set_hash *h = set->data; ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_netport4_elem data = { .cidr = h->nets[0].cidr || HOST_MASK }; @@ -189,7 +189,7 @@ static int hash_netport4_uadt(struct ip_set *set, struct nlattr *head, int len, enum ipset_adt adt, u32 *lineno, u32 flags) { - struct ip_set_hash *h = set->data; + const struct ip_set_hash *h = set->data; struct nlattr *tb[IPSET_ATTR_ADT_MAX+1]; ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_netport4_elem data = { .cidr = HOST_MASK }; @@ -270,8 +270,8 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *head, int len, static bool hash_netport_same_set(const struct ip_set *a, const struct ip_set *b) { - struct ip_set_hash *x = a->data; - struct ip_set_hash *y = b->data; + const struct ip_set_hash *x = a->data; + const struct ip_set_hash *y = b->data; /* Resizing changes htable_bits, so we ignore it */ return x->maxelem == y->maxelem @@ -395,7 +395,7 @@ static int hash_netport6_kadt(struct ip_set *set, const struct sk_buff *skb, enum ipset_adt adt, u8 pf, u8 dim, u8 flags) { - struct ip_set_hash *h = set->data; + const struct ip_set_hash *h = set->data; ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_netport6_elem data = { .cidr = h->nets[0].cidr || HOST_MASK }; @@ -419,7 +419,7 @@ static int hash_netport6_uadt(struct ip_set *set, struct nlattr *head, int len, enum ipset_adt adt, u32 *lineno, u32 flags) { - struct ip_set_hash *h = set->data; + const struct ip_set_hash *h = set->data; struct nlattr *tb[IPSET_ATTR_ADT_MAX+1]; ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_netport6_elem data = { .cidr = HOST_MASK }; -- cgit v1.2.3