]> granicus.if.org Git - ipset/commitdiff
netfilter: ipset: Headers file cleanup
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 5 May 2015 14:59:50 +0000 (16:59 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 5 May 2015 14:59:50 +0000 (16:59 +0200)
Remove extra whitespace, group counter helper together. Mark some of
the helpers arguments as const.

Ported from a patch proposed by Sergey Popovich <popovich_sergei@mail.ua>.

Suggested-by: Sergey Popovich <popovich_sergei@mail.ua>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
kernel/include/linux/netfilter/ipset/ip_set.h
kernel/include/linux/netfilter/ipset/ip_set_comment.h
kernel/include/linux/netfilter/ipset/ip_set_timeout.h

index 88949043641dd3cf0b1fe9c3f54f6d662a144d52..4bb08e1bc7d1ad7ff0cac4e26d8fa8f9a11644fe 100644 (file)
@@ -331,18 +331,38 @@ ip_set_update_counter(struct ip_set_counter *counter,
        }
 }
 
+static inline bool
+ip_set_put_counter(struct sk_buff *skb, const struct ip_set_counter *counter)
+{
+       return nla_put_net64(skb, IPSET_ATTR_BYTES,
+                            cpu_to_be64(ip_set_get_bytes(counter))) ||
+              nla_put_net64(skb, IPSET_ATTR_PACKETS,
+                            cpu_to_be64(ip_set_get_packets(counter)));
+}
+
+static inline void
+ip_set_init_counter(struct ip_set_counter *counter,
+                   const struct ip_set_ext *ext)
+{
+       if (ext->bytes != ULLONG_MAX)
+               atomic64_set(&(counter)->bytes, (long long)(ext->bytes));
+       if (ext->packets != ULLONG_MAX)
+               atomic64_set(&(counter)->packets, (long long)(ext->packets));
+}
+
 static inline void
 ip_set_get_skbinfo(struct ip_set_skbinfo *skbinfo,
-                     const struct ip_set_ext *ext,
-                     struct ip_set_ext *mext, u32 flags)
+                  const struct ip_set_ext *ext,
+                  struct ip_set_ext *mext, u32 flags)
 {
-               mext->skbmark = skbinfo->skbmark;
-               mext->skbmarkmask = skbinfo->skbmarkmask;
-               mext->skbprio = skbinfo->skbprio;
-               mext->skbqueue = skbinfo->skbqueue;
+       mext->skbmark = skbinfo->skbmark;
+       mext->skbmarkmask = skbinfo->skbmarkmask;
+       mext->skbprio = skbinfo->skbprio;
+       mext->skbqueue = skbinfo->skbqueue;
 }
+
 static inline bool
-ip_set_put_skbinfo(struct sk_buff *skb, struct ip_set_skbinfo *skbinfo)
+ip_set_put_skbinfo(struct sk_buff *skb, const struct ip_set_skbinfo *skbinfo)
 {
        /* Send nonzero parameters only */
        return ((skbinfo->skbmark || skbinfo->skbmarkmask) &&
@@ -354,8 +374,7 @@ ip_set_put_skbinfo(struct sk_buff *skb, struct ip_set_skbinfo *skbinfo)
                              cpu_to_be32(skbinfo->skbprio))) ||
               (skbinfo->skbqueue &&
                nla_put_net16(skb, IPSET_ATTR_SKBQUEUE,
-                            cpu_to_be16(skbinfo->skbqueue)));
-
+                             cpu_to_be16(skbinfo->skbqueue)));
 }
 
 static inline void
@@ -368,25 +387,6 @@ ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo,
        skbinfo->skbqueue = ext->skbqueue;
 }
 
-static inline bool
-ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter)
-{
-       return nla_put_net64(skb, IPSET_ATTR_BYTES,
-                            cpu_to_be64(ip_set_get_bytes(counter))) ||
-              nla_put_net64(skb, IPSET_ATTR_PACKETS,
-                            cpu_to_be64(ip_set_get_packets(counter)));
-}
-
-static inline void
-ip_set_init_counter(struct ip_set_counter *counter,
-                   const struct ip_set_ext *ext)
-{
-       if (ext->bytes != ULLONG_MAX)
-               atomic64_set(&(counter)->bytes, (long long)(ext->bytes));
-       if (ext->packets != ULLONG_MAX)
-               atomic64_set(&(counter)->packets, (long long)(ext->packets));
-}
-
 /* Netlink CB args */
 enum {
        IPSET_CB_NET = 0,       /* net namespace */
index 8d024852595704fa67b0d5588c76fcca3ef67b9d..bae5c7609be2641453c2340ea0b54b05ec87b801 100644 (file)
@@ -43,7 +43,7 @@ ip_set_init_comment(struct ip_set_comment *comment,
 
 /* Used only when dumping a set, protected by rcu_read_lock_bh() */
 static inline int
-ip_set_put_comment(struct sk_buff *skb, struct ip_set_comment *comment)
+ip_set_put_comment(struct sk_buff *skb, const struct ip_set_comment *comment)
 {
        struct ip_set_comment_rcu *c = rcu_dereference_bh(comment->c);
 
index 1d6a935c1ac5f4becf782394a4c8e03f7a913eb8..bfb3531fd88a4f7811e6ef9fffbaff672dfa6c53 100644 (file)
@@ -40,7 +40,7 @@ ip_set_timeout_uget(struct nlattr *tb)
 }
 
 static inline bool
-ip_set_timeout_expired(unsigned long *t)
+ip_set_timeout_expired(const unsigned long *t)
 {
        return *t != IPSET_ELEM_PERMANENT && time_is_before_jiffies(*t);
 }
@@ -63,7 +63,7 @@ ip_set_timeout_set(unsigned long *timeout, u32 value)
 }
 
 static inline u32
-ip_set_timeout_get(unsigned long *timeout)
+ip_set_timeout_get(const unsigned long *timeout)
 {
        return *timeout == IPSET_ELEM_PERMANENT ? 0 :
                jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC;