]> granicus.if.org Git - ipset/commitdiff
Rename extension offset ids to extension ids
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 6 Sep 2013 20:31:40 +0000 (22:31 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 6 Sep 2013 20:31:40 +0000 (22:31 +0200)
kernel/include/linux/netfilter/ipset/ip_set.h
kernel/net/netfilter/ipset/ip_set_bitmap_gen.h
kernel/net/netfilter/ipset/ip_set_bitmap_ip.c
kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c
kernel/net/netfilter/ipset/ip_set_bitmap_port.c
kernel/net/netfilter/ipset/ip_set_hash_gen.h
kernel/net/netfilter/ipset/ip_set_list_set.c

index 03f99d61ae1e7623515b0d8c18d211fc2c895b63..72185d4f29fe015769364eadafd5c714f07001b1 100644 (file)
@@ -57,20 +57,20 @@ enum ip_set_extension {
        IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER),
 };
 
-/* Extension offsets */
-enum ip_set_offset {
-       IPSET_OFFSET_TIMEOUT = 0,
-       IPSET_OFFSET_COUNTER,
-       IPSET_OFFSET_MAX,
-};
-
 #define SET_WITH_TIMEOUT(s)    ((s)->extensions & IPSET_EXT_TIMEOUT)
 #define SET_WITH_COUNTER(s)    ((s)->extensions & IPSET_EXT_COUNTER)
 
+/* Extension id, in size order */
+enum ip_set_ext_id {
+       IPSET_EXT_ID_COUNTER = 0,
+       IPSET_EXT_ID_TIMEOUT,
+       IPSET_EXT_ID_MAX,
+};
+
 struct ip_set_ext {
-       u32 timeout;
        u64 packets;
        u64 bytes;
+       u32 timeout;
 };
 
 struct ip_set;
index d39905e7e8814be58e84cc2d078bdf9c505a4f1f..889a929b908f43fac0bc06903769dc12bd5958eb 100644 (file)
@@ -33,9 +33,9 @@
 #define mtype                  MTYPE
 
 #define ext_timeout(e, m)      \
-       (unsigned long *)((e) + (m)->offset[IPSET_OFFSET_TIMEOUT])
+       (unsigned long *)((e) + (m)->offset[IPSET_EXT_ID_TIMEOUT])
 #define ext_counter(e, m)      \
-       (struct ip_set_counter *)((e) + (m)->offset[IPSET_OFFSET_COUNTER])
+       (struct ip_set_counter *)((e) + (m)->offset[IPSET_EXT_ID_COUNTER])
 #define get_ext(map, id)       ((map)->extensions + (map)->dsize * (id))
 
 static void
index ce99d2652d4743858eb04339bc7088b81fe26079..2ee210ef49a29cc6733ac6dac880c65bd5285016 100644 (file)
@@ -45,7 +45,7 @@ struct bitmap_ip {
        u32 hosts;              /* number of hosts in a subnet */
        size_t memsize;         /* members size */
        size_t dsize;           /* extensions struct size */
-       size_t offset[IPSET_OFFSET_MAX]; /* Offsets to extensions */
+       size_t offset[IPSET_EXT_ID_MAX]; /* Offsets to extensions */
        u8 netmask;             /* subnet netmask */
        u32 timeout;            /* timeout parameter */
        struct timer_list gc;   /* garbage collection */
@@ -342,9 +342,9 @@ bitmap_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
                set->extensions |= IPSET_EXT_COUNTER;
                if (tb[IPSET_ATTR_TIMEOUT]) {
                        map->dsize = sizeof(struct bitmap_ipct_elem);
-                       map->offset[IPSET_OFFSET_TIMEOUT] =
+                       map->offset[IPSET_EXT_ID_TIMEOUT] =
                                offsetof(struct bitmap_ipct_elem, timeout);
-                       map->offset[IPSET_OFFSET_COUNTER] =
+                       map->offset[IPSET_EXT_ID_COUNTER] =
                                offsetof(struct bitmap_ipct_elem, counter);
 
                        if (!init_map_ip(set, map, first_ip, last_ip,
@@ -360,7 +360,7 @@ bitmap_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
                        bitmap_ip_gc_init(set, bitmap_ip_gc);
                } else {
                        map->dsize = sizeof(struct bitmap_ipc_elem);
-                       map->offset[IPSET_OFFSET_COUNTER] =
+                       map->offset[IPSET_EXT_ID_COUNTER] =
                                offsetof(struct bitmap_ipc_elem, counter);
 
                        if (!init_map_ip(set, map, first_ip, last_ip,
@@ -371,7 +371,7 @@ bitmap_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
                }
        } else if (tb[IPSET_ATTR_TIMEOUT]) {
                map->dsize = sizeof(struct bitmap_ipt_elem);
-               map->offset[IPSET_OFFSET_TIMEOUT] =
+               map->offset[IPSET_EXT_ID_TIMEOUT] =
                        offsetof(struct bitmap_ipt_elem, timeout);
 
                if (!init_map_ip(set, map, first_ip, last_ip,
index 6d5bad93026b1fff2d916d7b1866b43694ba5727..e711875ea452b84f179333249fa18d5e90eff3c5 100644 (file)
@@ -52,7 +52,7 @@ struct bitmap_ipmac {
        struct timer_list gc;   /* garbage collector */
        size_t memsize;         /* members size */
        size_t dsize;           /* size of element */
-       size_t offset[IPSET_OFFSET_MAX]; /* Offsets to extensions */
+       size_t offset[IPSET_EXT_ID_MAX]; /* Offsets to extensions */
 };
 
 /* ADT structure for generic function args */
@@ -405,9 +405,9 @@ bitmap_ipmac_create(struct ip_set *set, struct nlattr *tb[],
                set->extensions |= IPSET_EXT_COUNTER;
                if (tb[IPSET_ATTR_TIMEOUT]) {
                        map->dsize = sizeof(struct bitmap_ipmacct_elem);
-                       map->offset[IPSET_OFFSET_TIMEOUT] =
+                       map->offset[IPSET_EXT_ID_TIMEOUT] =
                                offsetof(struct bitmap_ipmacct_elem, timeout);
-                       map->offset[IPSET_OFFSET_COUNTER] =
+                       map->offset[IPSET_EXT_ID_COUNTER] =
                                offsetof(struct bitmap_ipmacct_elem, counter);
 
                        if (!init_map_ipmac(set, map, first_ip, last_ip,
@@ -421,7 +421,7 @@ bitmap_ipmac_create(struct ip_set *set, struct nlattr *tb[],
                        bitmap_ipmac_gc_init(set, bitmap_ipmac_gc);
                } else {
                        map->dsize = sizeof(struct bitmap_ipmacc_elem);
-                       map->offset[IPSET_OFFSET_COUNTER] =
+                       map->offset[IPSET_EXT_ID_COUNTER] =
                                offsetof(struct bitmap_ipmacc_elem, counter);
 
                        if (!init_map_ipmac(set, map, first_ip, last_ip,
@@ -432,7 +432,7 @@ bitmap_ipmac_create(struct ip_set *set, struct nlattr *tb[],
                }
        } else if (tb[IPSET_ATTR_TIMEOUT]) {
                map->dsize = sizeof(struct bitmap_ipmact_elem);
-               map->offset[IPSET_OFFSET_TIMEOUT] =
+               map->offset[IPSET_EXT_ID_TIMEOUT] =
                        offsetof(struct bitmap_ipmact_elem, timeout);
 
                if (!init_map_ipmac(set, map, first_ip, last_ip, elements)) {
index b22048965d2afb20694e6729e9bbe29e07d92e26..bebc137a573755b5fa39411195e7abfec1ef3eb4 100644 (file)
@@ -39,7 +39,7 @@ struct bitmap_port {
        u32 elements;           /* number of max elements in the set */
        size_t memsize;         /* members size */
        size_t dsize;           /* extensions struct size */
-       size_t offset[IPSET_OFFSET_MAX]; /* Offsets to extensions */
+       size_t offset[IPSET_EXT_ID_MAX]; /* Offsets to extensions */
        u32 timeout;            /* timeout parameter */
        struct timer_list gc;   /* garbage collection */
 };
@@ -282,9 +282,9 @@ bitmap_port_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
                set->extensions |= IPSET_EXT_COUNTER;
                if (tb[IPSET_ATTR_TIMEOUT]) {
                        map->dsize = sizeof(struct bitmap_portct_elem);
-                       map->offset[IPSET_OFFSET_TIMEOUT] =
+                       map->offset[IPSET_EXT_ID_TIMEOUT] =
                                offsetof(struct bitmap_portct_elem, timeout);
-                       map->offset[IPSET_OFFSET_COUNTER] =
+                       map->offset[IPSET_EXT_ID_COUNTER] =
                                offsetof(struct bitmap_portct_elem, counter);
                        if (!init_map_port(set, map, first_port, last_port)) {
                                kfree(map);
@@ -297,7 +297,7 @@ bitmap_port_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
                        bitmap_port_gc_init(set, bitmap_port_gc);
                } else {
                        map->dsize = sizeof(struct bitmap_portc_elem);
-                       map->offset[IPSET_OFFSET_COUNTER] =
+                       map->offset[IPSET_EXT_ID_COUNTER] =
                                offsetof(struct bitmap_portc_elem, counter);
                        if (!init_map_port(set, map, first_port, last_port)) {
                                kfree(map);
@@ -306,7 +306,7 @@ bitmap_port_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
                }
        } else if (tb[IPSET_ATTR_TIMEOUT]) {
                map->dsize = sizeof(struct bitmap_portt_elem);
-               map->offset[IPSET_OFFSET_TIMEOUT] =
+               map->offset[IPSET_EXT_ID_TIMEOUT] =
                        offsetof(struct bitmap_portt_elem, timeout);
                if (!init_map_port(set, map, first_port, last_port)) {
                        kfree(map);
index 596fcb6454bb1834b9af3da7a605733796a8a2bc..a33868090678e29d41b0e895e3cc613588ebdb15 100644 (file)
@@ -179,9 +179,9 @@ hbucket_elem_add(struct hbucket *n, u8 ahash_max, size_t dsize)
 #endif /* IP_SET_HASH_WITH_NETS */
 
 #define ext_timeout(e, h)      \
-(unsigned long *)(((void *)(e)) + (h)->offset[IPSET_OFFSET_TIMEOUT])
+(unsigned long *)(((void *)(e)) + (h)->offset[IPSET_EXT_ID_TIMEOUT])
 #define ext_counter(e, h)      \
-(struct ip_set_counter *)(((void *)(e)) + (h)->offset[IPSET_OFFSET_COUNTER])
+(struct ip_set_counter *)(((void *)(e)) + (h)->offset[IPSET_EXT_ID_COUNTER])
 
 #endif /* _IP_SET_HASH_GEN_H */
 
@@ -278,7 +278,7 @@ struct htype {
        u32 initval;            /* random jhash init value */
        u32 timeout;            /* timeout value, if enabled */
        size_t dsize;           /* data struct size */
-       size_t offset[IPSET_OFFSET_MAX]; /* Offsets to extensions */
+       size_t offset[IPSET_EXT_ID_MAX]; /* Offsets to extensions */
        struct timer_list gc;   /* garbage collection when timeout enabled */
        struct mtype_elem next; /* temporary storage for uadd */
 #ifdef IP_SET_HASH_WITH_MULTI
@@ -1055,11 +1055,11 @@ IPSET_TOKEN(HTYPE, _create)(struct ip_set *set, struct nlattr *tb[], u32 flags)
                        if (set->family == NFPROTO_IPV4) {
                                h->dsize = sizeof(struct
                                        IPSET_TOKEN(HTYPE, 4ct_elem));
-                               h->offset[IPSET_OFFSET_TIMEOUT] =
+                               h->offset[IPSET_EXT_ID_TIMEOUT] =
                                        offsetof(struct
                                                IPSET_TOKEN(HTYPE, 4ct_elem),
                                                timeout);
-                               h->offset[IPSET_OFFSET_COUNTER] =
+                               h->offset[IPSET_EXT_ID_COUNTER] =
                                        offsetof(struct
                                                IPSET_TOKEN(HTYPE, 4ct_elem),
                                                counter);
@@ -1068,11 +1068,11 @@ IPSET_TOKEN(HTYPE, _create)(struct ip_set *set, struct nlattr *tb[], u32 flags)
                        } else {
                                h->dsize = sizeof(struct
                                        IPSET_TOKEN(HTYPE, 6ct_elem));
-                               h->offset[IPSET_OFFSET_TIMEOUT] =
+                               h->offset[IPSET_EXT_ID_TIMEOUT] =
                                        offsetof(struct
                                                IPSET_TOKEN(HTYPE, 6ct_elem),
                                                timeout);
-                               h->offset[IPSET_OFFSET_COUNTER] =
+                               h->offset[IPSET_EXT_ID_COUNTER] =
                                        offsetof(struct
                                                IPSET_TOKEN(HTYPE, 6ct_elem),
                                                counter);
@@ -1084,7 +1084,7 @@ IPSET_TOKEN(HTYPE, _create)(struct ip_set *set, struct nlattr *tb[], u32 flags)
                                h->dsize =
                                        sizeof(struct
                                                IPSET_TOKEN(HTYPE, 4c_elem));
-                               h->offset[IPSET_OFFSET_COUNTER] =
+                               h->offset[IPSET_EXT_ID_COUNTER] =
                                        offsetof(struct
                                                IPSET_TOKEN(HTYPE, 4c_elem),
                                                counter);
@@ -1092,7 +1092,7 @@ IPSET_TOKEN(HTYPE, _create)(struct ip_set *set, struct nlattr *tb[], u32 flags)
                                h->dsize =
                                        sizeof(struct
                                                IPSET_TOKEN(HTYPE, 6c_elem));
-                               h->offset[IPSET_OFFSET_COUNTER] =
+                               h->offset[IPSET_EXT_ID_COUNTER] =
                                        offsetof(struct
                                                IPSET_TOKEN(HTYPE, 6c_elem),
                                                counter);
@@ -1103,14 +1103,14 @@ IPSET_TOKEN(HTYPE, _create)(struct ip_set *set, struct nlattr *tb[], u32 flags)
                set->extensions |= IPSET_EXT_TIMEOUT;
                if (set->family == NFPROTO_IPV4) {
                        h->dsize = sizeof(struct IPSET_TOKEN(HTYPE, 4t_elem));
-                       h->offset[IPSET_OFFSET_TIMEOUT] =
+                       h->offset[IPSET_EXT_ID_TIMEOUT] =
                                offsetof(struct IPSET_TOKEN(HTYPE, 4t_elem),
                                         timeout);
                        IPSET_TOKEN(HTYPE, 4_gc_init)(set,
                                IPSET_TOKEN(HTYPE, 4_gc));
                } else {
                        h->dsize = sizeof(struct IPSET_TOKEN(HTYPE, 6t_elem));
-                       h->offset[IPSET_OFFSET_TIMEOUT] =
+                       h->offset[IPSET_EXT_ID_TIMEOUT] =
                                offsetof(struct IPSET_TOKEN(HTYPE, 6t_elem),
                                         timeout);
                        IPSET_TOKEN(HTYPE, 6_gc_init)(set,
index a9e301f6e093832abaa9986739826080fb43a1b4..0ed19b5e675e62859845bbfcbd79a8ad011589a6 100644 (file)
@@ -59,7 +59,7 @@ struct set_adt_elem {
 /* Type structure */
 struct list_set {
        size_t dsize;           /* element size */
-       size_t offset[IPSET_OFFSET_MAX]; /* Offsets to extensions */
+       size_t offset[IPSET_EXT_ID_MAX]; /* Offsets to extensions */
        u32 size;               /* size of set list array */
        u32 timeout;            /* timeout value */
        struct timer_list gc;   /* garbage collection */
@@ -73,9 +73,9 @@ list_set_elem(const struct list_set *map, u32 id)
 }
 
 #define ext_timeout(e, m)      \
-(unsigned long *)((void *)(e) + (m)->offset[IPSET_OFFSET_TIMEOUT])
+(unsigned long *)((void *)(e) + (m)->offset[IPSET_EXT_ID_TIMEOUT])
 #define ext_counter(e, m)      \
-(struct ip_set_counter *)((void *)(e) + (m)->offset[IPSET_OFFSET_COUNTER])
+(struct ip_set_counter *)((void *)(e) + (m)->offset[IPSET_EXT_ID_COUNTER])
 
 static int
 list_set_ktest(struct ip_set *set, const struct sk_buff *skb,
@@ -667,9 +667,9 @@ list_set_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
                        if (!map)
                                return -ENOMEM;
                        set->extensions |= IPSET_EXT_TIMEOUT;
-                       map->offset[IPSET_OFFSET_TIMEOUT] =
+                       map->offset[IPSET_EXT_ID_TIMEOUT] =
                                offsetof(struct setct_elem, timeout);
-                       map->offset[IPSET_OFFSET_COUNTER] =
+                       map->offset[IPSET_EXT_ID_COUNTER] =
                                offsetof(struct setct_elem, counter);
                        list_set_gc_init(set, list_set_gc);
                } else {
@@ -677,7 +677,7 @@ list_set_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
                                            sizeof(struct setc_elem), 0);
                        if (!map)
                                return -ENOMEM;
-                       map->offset[IPSET_OFFSET_COUNTER] =
+                       map->offset[IPSET_EXT_ID_COUNTER] =
                                offsetof(struct setc_elem, counter);
                }
        } else if (tb[IPSET_ATTR_TIMEOUT]) {
@@ -686,7 +686,7 @@ list_set_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
                if (!map)
                        return -ENOMEM;
                set->extensions |= IPSET_EXT_TIMEOUT;
-               map->offset[IPSET_OFFSET_TIMEOUT] =
+               map->offset[IPSET_EXT_ID_TIMEOUT] =
                        offsetof(struct sett_elem, timeout);
                list_set_gc_init(set, list_set_gc);
        } else {