From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 06/22] netfilter: ipset: Separate memsize calculation code into dedicated function
Date: Tue, 1 Nov 2016 20:23:17 +0100 [thread overview]
Message-ID: <20161101192317.GG18827@salvia> (raw)
In-Reply-To: <1477255075-15255-7-git-send-email-kadlec@blackhole.kfki.hu>
On Sun, Oct 23, 2016 at 10:37:39PM +0200, Jozsef Kadlecsik wrote:
> Hash types already has it's memsize calculation code in separate
> functions. Do the same for *bitmap* and *list* sets.
This is just a cleanup, right?
More comments below.
> 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>
> ---
> net/netfilter/ipset/ip_set_bitmap_gen.h | 13 ++++++++++++-
> net/netfilter/ipset/ip_set_list_set.c | 23 +++++++++++++++++------
> 2 files changed, 29 insertions(+), 7 deletions(-)
>
> diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h
> index 2e8e7e5..c22cdde 100644
> --- a/net/netfilter/ipset/ip_set_bitmap_gen.h
> +++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
> @@ -22,6 +22,7 @@
> #define mtype_kadt IPSET_TOKEN(MTYPE, _kadt)
> #define mtype_uadt IPSET_TOKEN(MTYPE, _uadt)
> #define mtype_destroy IPSET_TOKEN(MTYPE, _destroy)
> +#define mtype_memsize IPSET_TOKEN(MTYPE, _memsize)
> #define mtype_flush IPSET_TOKEN(MTYPE, _flush)
> #define mtype_head IPSET_TOKEN(MTYPE, _head)
> #define mtype_same_set IPSET_TOKEN(MTYPE, _same_set)
> @@ -84,12 +85,22 @@
> memset(map->members, 0, map->memsize);
> }
>
> +/* Calculate the actual memory size of the set data */
> +static size_t
> +mtype_memsize(const struct mtype *map, size_t dsize)
> +{
> + size_t memsize = sizeof(*map) +
> + map->memsize +
> + map->elements * dsize;
> + return memsize;
> +}
This fits into one line, so I don't see why we need to split it, look:
return sizeof(*map) + map->memsize + map->elements * dsize;
next prev parent reply other threads:[~2016-11-01 19:23 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-23 20:37 [PATCH 00/22] ipset patches for nf-next, v2 Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 01/22] netfilter: ipset: Correct rcu_dereference_bh_nfnl() usage Jozsef Kadlecsik
2016-11-01 19:13 ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 02/22] netfilter: ipset: Headers file cleanup Jozsef Kadlecsik
2016-11-01 19:14 ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 03/22] netfilter: ipset: Improve skbinfo get/init helpers Jozsef Kadlecsik
2016-11-01 19:15 ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 04/22] netfilter: ipset: Improve comment extension helpers Jozsef Kadlecsik
2016-11-01 19:16 ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 05/22] netfilter: ipset: Split extensions into separate files Jozsef Kadlecsik
2016-11-01 19:20 ` Pablo Neira Ayuso
2016-11-01 19:21 ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 06/22] netfilter: ipset: Separate memsize calculation code into dedicated function Jozsef Kadlecsik
2016-11-01 19:23 ` Pablo Neira Ayuso [this message]
2016-10-23 20:37 ` [PATCH 07/22] netfilter: ipset: Regroup ip_set_put_extensions and add extern Jozsef Kadlecsik
2016-11-01 19:24 ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 08/22] netfilter: ipset: Add element count to hash headers Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 09/22] netfilter: ipset: Add element count to all set types header Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 10/22] netfilter: ipset: Count non-static extension memory for userspace Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 11/22] netfilter: ipset: Simplify mtype_expire() for hash types Jozsef Kadlecsik
2016-11-01 19:25 ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 12/22] netfilter: ipset: Make NLEN compile time constant " Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 13/22] netfilter: ipset: Make sure element data size is a multiple of u32 Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 14/22] netfilter: ipset: Optimize hash creation routine Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 15/22] netfilter: ipset: Make struct htype per ipset family Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 16/22] netfilter: ipset: Collapse same condition body to a single one Jozsef Kadlecsik
2016-11-01 19:27 ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 17/22] netfilter: ipset: Fix reported memory size for hash:* types Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 18/22] netfilter: ipset: hash:ipmac type support added to ipset Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 19/22] netfilter: ipset: use setup_timer() and mod_timer() Jozsef Kadlecsik
2016-11-01 19:28 ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 20/22] " Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 21/22] " Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 22/22] netfilter: ipset: hash: fix boolreturn.cocci warnings Jozsef Kadlecsik
2016-10-27 16:53 ` [PATCH 00/22] ipset patches for nf-next, v2 Pablo Neira Ayuso
2016-11-01 19:06 ` Pablo Neira Ayuso
-- strict thread matches above, loose matches on Subject: below --
2016-10-17 12:51 [PATCH 00/22] ipset patches for nf-next Jozsef Kadlecsik
2016-10-17 12:51 ` [PATCH 06/22] netfilter: ipset: Separate memsize calculation code into dedicated function Jozsef Kadlecsik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161101192317.GG18827@salvia \
--to=pablo@netfilter.org \
--cc=kadlec@blackhole.kfki.hu \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.