mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
netfilter: ipset: Headers file cleanup
Group counter helper functions together. Ported from a patch proposed by Sergey Popovich <[email protected]>. Suggested-by: Sergey Popovich <[email protected]> Signed-off-by: Jozsef Kadlecsik <[email protected]>
This commit is contained in:
parent
da9fbfa76f
commit
7ffea37957
1 changed files with 21 additions and 21 deletions
|
|
@ -334,6 +334,27 @@ 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)),
|
||||
IPSET_ATTR_PAD) ||
|
||||
nla_put_net64(skb, IPSET_ATTR_PACKETS,
|
||||
cpu_to_be64(ip_set_get_packets(counter)),
|
||||
IPSET_ATTR_PAD);
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
@ -372,27 +393,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, const struct ip_set_counter *counter)
|
||||
{
|
||||
return nla_put_net64(skb, IPSET_ATTR_BYTES,
|
||||
cpu_to_be64(ip_set_get_bytes(counter)),
|
||||
IPSET_ATTR_PAD) ||
|
||||
nla_put_net64(skb, IPSET_ATTR_PACKETS,
|
||||
cpu_to_be64(ip_set_get_packets(counter)),
|
||||
IPSET_ATTR_PAD);
|
||||
}
|
||||
|
||||
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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue