]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
kernel: const annotations
authorJan Engelhardt <jengelh@medozas.de>
Sun, 19 Dec 2010 01:44:14 +0000 (02:44 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Sun, 19 Dec 2010 02:05:59 +0000 (03:05 +0100)
13 files changed:
kernel/include/linux/netfilter/ipset/ip_set.h
kernel/include/linux/netfilter/ipset/ip_set_ahash.h
kernel/ip_set.c
kernel/ip_set_bitmap_ip.c
kernel/ip_set_bitmap_ipmac.c
kernel/ip_set_bitmap_port.c
kernel/ip_set_hash_ip.c
kernel/ip_set_hash_ipport.c
kernel/ip_set_hash_ipportip.c
kernel/ip_set_hash_ipportnet.c
kernel/ip_set_hash_net.c
kernel/ip_set_hash_netport.c
kernel/ip_set_list_set.c

index 23661c4a89ee70e12e06e1a583a3fe408d760121..a3e4bb9bc055a81f1e542d1a12606eee591a1af6 100644 (file)
@@ -240,7 +240,7 @@ struct ip_set_type_variant {
        /* List set header data */
        int (*head)(struct ip_set *set, struct sk_buff *skb);
        /* List elements */
-       int (*list)(struct ip_set *set, struct sk_buff *skb,
+       int (*list)(const struct ip_set *set, struct sk_buff *skb,
                    struct netlink_callback *cb);
 
        /* Return true if "b" set is the same as "a"
index 589b157b25b93789e9216d64aaae740529638141..7e0af3d89fcec4b7a9f388d97e8babfb5e8400f9 100644 (file)
@@ -530,7 +530,7 @@ nla_put_failure:
 
 /* Reply a LIST/SAVE request: dump the elements of the specified set */
 static int
-type_pf_list(struct ip_set *set,
+type_pf_list(const struct ip_set *set,
             struct sk_buff *skb, struct netlink_callback *cb)
 {
        const struct ip_set_hash *h = set->data;
@@ -931,7 +931,7 @@ type_pf_ttest(struct ip_set *set, void *value, u32 timeout)
 }
 
 static int
-type_pf_tlist(struct ip_set *set,
+type_pf_tlist(const struct ip_set *set,
              struct sk_buff *skb, struct netlink_callback *cb)
 {
        const struct ip_set_hash *h = set->data;
index 038a70eec97d0b4fbf87df2bdc5276eec762d1da..c778670fb163b2cea6470e5744a4b8d5cd385d8c 100644 (file)
@@ -623,7 +623,7 @@ EXPORT_SYMBOL(ip_set_put_byindex);
 const char *
 ip_set_name_byindex(ip_set_id_t index)
 {
-       struct ip_set *set = ip_set_list[index];
+       const struct ip_set *set = ip_set_list[index];
 
        BUG_ON(set == NULL);
        BUG_ON(atomic_read(&set->ref) == 0);
@@ -762,7 +762,7 @@ static ip_set_id_t
 find_set_id(const char *name)
 {
        ip_set_id_t i, index = IPSET_INVALID_ID;
-       struct ip_set *set;
+       const struct ip_set *set;
 
        for (i = 0; index == IPSET_INVALID_ID && i < ip_set_max; i++) {
                set = ip_set_list[i];
@@ -1141,7 +1141,7 @@ ip_set_dump_done(struct netlink_callback *cb)
 static inline void
 dump_attrs(struct nlmsghdr *nlh)
 {
-       struct nlattr *attr;
+       const struct nlattr *attr;
        int rem;
 
        pr_debug("dump nlmsg");
@@ -1472,7 +1472,7 @@ ip_set_header(struct sock *ctnl, struct sk_buff *skb,
              NFNL_CB_CONST struct nlmsghdr *nlh,
              NFNL_CB_CONST struct nlattr * NFNL_CB_CONST attr[])
 {
-       struct ip_set *set;
+       const struct ip_set *set;
        struct sk_buff *skb2;
        struct nlmsghdr *nlh2;
        ip_set_id_t index;
index 2f124ec5673c9c62bbdda5e51d0a2d019871729f..99480808523b3d640fe64084962834db918ad10b 100644 (file)
@@ -220,7 +220,7 @@ nla_put_failure:
 }
 
 static int
-bitmap_ip_list(struct ip_set *set,
+bitmap_ip_list(const struct ip_set *set,
               struct sk_buff *skb, struct netlink_callback *cb)
 {
        const struct bitmap_ip *map = set->data;
@@ -260,8 +260,8 @@ nla_put_failure:
 static bool
 bitmap_ip_same_set(const struct ip_set *a, const struct ip_set *b)
 {
-       struct bitmap_ip *x = a->data;
-       struct bitmap_ip *y = b->data;
+       const struct bitmap_ip *x = a->data;
+       const struct bitmap_ip *y = b->data;
 
        return x->first_ip == y->first_ip
               && x->last_ip == y->last_ip
@@ -462,13 +462,13 @@ nla_put_failure:
 }
 
 static int
-bitmap_ip_timeout_list(struct ip_set *set,
+bitmap_ip_timeout_list(const struct ip_set *set,
                       struct sk_buff *skb, struct netlink_callback *cb)
 {
        const struct bitmap_ip_timeout *map = set->data;
        struct nlattr *adt, *nested;
        u32 id, first = cb->args[2];
-       unsigned long *table = map->members;
+       const unsigned long *table = map->members;
 
        adt = ipset_nest_start(skb, IPSET_ATTR_ADT);
        if (!adt)
@@ -507,8 +507,8 @@ nla_put_failure:
 static bool
 bitmap_ip_timeout_same_set(const struct ip_set *a, const struct ip_set *b)
 {
-       struct bitmap_ip_timeout *x = a->data;
-       struct bitmap_ip_timeout *y = b->data;
+       const struct bitmap_ip_timeout *x = a->data;
+       const struct bitmap_ip_timeout *y = b->data;
 
        return x->first_ip == y->first_ip
               && x->last_ip == y->last_ip
index 0bd9a89d5ea4f9cb4599ed5775eae5f9b64e6135..1fae7820560ccfb6516ca7d79637f2ae70d52476 100644 (file)
@@ -164,7 +164,7 @@ bitmap_ipmac_del(struct ip_set *set, void *value, u32 timeout)
 }
 
 static int
-bitmap_ipmac_list(struct ip_set *set,
+bitmap_ipmac_list(const struct ip_set *set,
                  struct sk_buff *skb, struct netlink_callback *cb)
 {
        const struct bitmap_ipmac *map = set->data;
@@ -287,7 +287,7 @@ bitmap_ipmac_tdel(struct ip_set *set, void *value, u32 timeout)
 }
 
 static int
-bitmap_ipmac_tlist(struct ip_set *set,
+bitmap_ipmac_tlist(const struct ip_set *set,
                   struct sk_buff *skb, struct netlink_callback *cb)
 {
        const struct bitmap_ipmac *map = set->data;
@@ -369,7 +369,7 @@ static int
 bitmap_ipmac_uadt(struct ip_set *set, struct nlattr *head, int len,
                  enum ipset_adt adt, u32 *lineno, u32 flags)
 {
-       struct bitmap_ipmac *map = set->data;
+       const struct bitmap_ipmac *map = set->data;
        struct nlattr *tb[IPSET_ATTR_ADT_MAX+1];
        ipset_adtfn adtfn = set->variant->adt[adt];
        struct ipmac data;
@@ -460,8 +460,8 @@ nla_put_failure:
 static bool
 bitmap_ipmac_same_set(const struct ip_set *a, const struct ip_set *b)
 {
-       struct bitmap_ipmac *x = a->data;
-       struct bitmap_ipmac *y = b->data;
+       const struct bitmap_ipmac *x = a->data;
+       const struct bitmap_ipmac *y = b->data;
 
        return x->first_ip == y->first_ip
               && x->last_ip == y->last_ip
index eccef082fc1900856588bdfb69f8e1015cbdfa2f..c7f402a41050da1288502f519636d4c53c726498 100644 (file)
@@ -181,7 +181,7 @@ bitmap_port_flush(struct ip_set *set)
 static int
 bitmap_port_head(struct ip_set *set, struct sk_buff *skb)
 {
-       struct bitmap_port *map = set->data;
+       const struct bitmap_port *map = set->data;
        struct nlattr *nested;
 
        nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
@@ -201,10 +201,10 @@ nla_put_failure:
 }
 
 static int
-bitmap_port_list(struct ip_set *set,
+bitmap_port_list(const struct ip_set *set,
                 struct sk_buff *skb, struct netlink_callback *cb)
 {
-       struct bitmap_port *map = set->data;
+       const struct bitmap_port *map = set->data;
        struct nlattr *atd, *nested;
        u16 id, first = cb->args[2];
        u16 last = map->last_port - map->first_port;
@@ -243,8 +243,8 @@ nla_put_failure:
 static bool
 bitmap_port_same_set(const struct ip_set *a, const struct ip_set *b)
 {
-       struct bitmap_port *x = a->data;
-       struct bitmap_port *y = b->data;
+       const struct bitmap_port *x = a->data;
+       const struct bitmap_port *y = b->data;
 
        return x->first_port == y->first_port
               && x->last_port == y->last_port;
@@ -413,7 +413,7 @@ bitmap_port_timeout_flush(struct ip_set *set)
 static int
 bitmap_port_timeout_head(struct ip_set *set, struct sk_buff *skb)
 {
-       struct bitmap_port_timeout *map = set->data;
+       const struct bitmap_port_timeout *map = set->data;
        struct nlattr *nested;
 
        nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
@@ -434,14 +434,14 @@ nla_put_failure:
 }
 
 static int
-bitmap_port_timeout_list(struct ip_set *set,
+bitmap_port_timeout_list(const struct ip_set *set,
                         struct sk_buff *skb, struct netlink_callback *cb)
 {
-       struct bitmap_port_timeout *map = set->data;
+       const struct bitmap_port_timeout *map = set->data;
        struct nlattr *adt, *nested;
        u16 id, first = cb->args[2];
        u16 last = map->last_port - map->first_port;
-       unsigned long *table = map->members;
+       const unsigned long *table = map->members;
 
        adt = ipset_nest_start(skb, IPSET_ATTR_ADT);
        if (!adt)
@@ -480,8 +480,8 @@ nla_put_failure:
 static bool
 bitmap_port_timeout_same_set(const struct ip_set *a, const struct ip_set *b)
 {
-       struct bitmap_port_timeout *x = a->data;
-       struct bitmap_port_timeout *y = b->data;
+       const struct bitmap_port_timeout *x = a->data;
+       const struct bitmap_port_timeout *y = b->data;
 
        return x->first_port == y->first_port
               && x->last_port == y->last_port
index 6859ac8a569457bd1f9415c18af85ff2fccbaa0e..baacf4c3d398a605deda4623d947836f19594ae7 100644 (file)
@@ -121,7 +121,7 @@ static int
 hash_ip4_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];
        u32 ip;
 
@@ -145,7 +145,7 @@ static int
 hash_ip4_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];
        u32 ip, nip, ip_to, hosts, timeout = h->timeout;
@@ -210,8 +210,8 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *head, int len,
 static bool
 hash_ip_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
@@ -310,7 +310,7 @@ static int
 hash_ip6_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];
        union nf_inet_addr ip;
 
@@ -332,7 +332,7 @@ static int
 hash_ip6_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];
        union nf_inet_addr ip;
index f9db93ddd7b10434c7e44e1db8d9ee28a06c8093..f9826a2cea00bcfceecca4d011ed6107bef12bea 100644 (file)
@@ -140,7 +140,7 @@ static int
 hash_ipport4_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_ipport4_elem data = { };
 
@@ -169,7 +169,7 @@ static int
 hash_ipport4_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_ipport4_elem data = { };
@@ -268,8 +268,8 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *head, int len,
 static bool
 hash_ipport_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
@@ -374,7 +374,7 @@ static int
 hash_ipport6_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_ipport6_elem data = { };
 
@@ -391,7 +391,7 @@ static int
 hash_ipport6_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_ipport6_elem data = { };
index 5511bbf3b2e93b9298f3dbb72262c785df90fe87..a047c0ec4c5c74085a909be3bb9fc8a3f27f93ca 100644 (file)
@@ -145,7 +145,7 @@ static int
 hash_ipportip4_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_ipportip4_elem data = { };
 
@@ -176,7 +176,7 @@ static int
 hash_ipportip4_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_ipportip4_elem data = { };
@@ -279,8 +279,8 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *head, int len,
 static bool
 hash_ipportip_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
@@ -390,7 +390,7 @@ static int
 hash_ipportip6_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_ipportip6_elem data = { };
 
@@ -408,7 +408,7 @@ static int
 hash_ipportip6_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_ipportip6_elem data = { };
index 5775c5753896d23fa0aa17028d3d70ca9d540ced..08e0de96a68be69d3a828bf382ab2be8be0679b3 100644 (file)
@@ -158,7 +158,7 @@ static int
 hash_ipportnet4_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_ipportnet4_elem data =
                { .cidr = h->nets[0].cidr || HOST_MASK };
@@ -197,7 +197,7 @@ static int
 hash_ipportnet4_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_ipportnet4_elem data = { .cidr = HOST_MASK };
@@ -308,8 +308,8 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *head, int len,
 static bool
 hash_ipportnet_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
@@ -438,7 +438,7 @@ static int
 hash_ipportnet6_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_ipportnet6_elem data =
                { .cidr = h->nets[0].cidr || HOST_MASK };
@@ -463,7 +463,7 @@ static int
 hash_ipportnet6_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_ipportnet6_elem data = { .cidr = HOST_MASK };
index 5e3086ba131267590face277371820931d51cca5..499f80564f1fb9245f2d5c301ef8c613d9d6ca94 100644 (file)
@@ -140,7 +140,7 @@ static int
 hash_net4_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_net4_elem data = { .cidr = h->nets[0].cidr || HOST_MASK };
 
@@ -165,7 +165,7 @@ static int
 hash_net4_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_net4_elem data = { .cidr = HOST_MASK };
@@ -205,8 +205,8 @@ hash_net4_uadt(struct ip_set *set, struct nlattr *head, int len,
 static bool
 hash_net_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
@@ -322,7 +322,7 @@ static int
 hash_net6_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_net6_elem data = { .cidr = h->nets[0].cidr || HOST_MASK };
 
@@ -341,7 +341,7 @@ static int
 hash_net6_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_net6_elem data = { .cidr = HOST_MASK };
index c3f47a1dc5e1d020b9dba41e0d325f87f2b72bd6..9233ce0d39af79ddabf4e39c25b16648544fddea 100644 (file)
@@ -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 };
index 07d992910b300eb37794894233448057d07b0b66..8c3e9b33b46ad2af3f81462395b4e4fe09fe6d57 100644 (file)
@@ -169,7 +169,7 @@ static int
 list_set_add(struct list_set *map, u32 i, ip_set_id_t id,
             unsigned long timeout)
 {
-       struct set_elem *e = list_set_elem(map, i);
+       const struct set_elem *e = list_set_elem(map, i);
 
        if (i == map->size - 1 && e->id != IPSET_INVALID_ID)
                /* Last element replaced: e.g. add new,before,last */
@@ -214,7 +214,7 @@ list_set_uadt(struct ip_set *set, struct nlattr *head, int len,
        int before = 0;
        u32 timeout = map->timeout;
        ip_set_id_t id, refid = IPSET_INVALID_ID;
-       struct set_elem *elem;
+       const struct set_elem *elem;
        struct ip_set *s;
        u32 i;
        int ret = 0;
@@ -395,7 +395,7 @@ nla_put_failure:
 }
 
 static int
-list_set_list(struct ip_set *set,
+list_set_list(const struct ip_set *set,
              struct sk_buff *skb, struct netlink_callback *cb)
 {
        const struct list_set *map = set->data;
@@ -446,8 +446,8 @@ nla_put_failure:
 static bool
 list_set_same_set(const struct ip_set *a, const struct ip_set *b)
 {
-       struct list_set *x = a->data;
-       struct list_set *y = b->data;
+       const struct list_set *x = a->data;
+       const struct list_set *y = b->data;
 
        return x->size == y->size
               && x->timeout == y->timeout;