From: Alexei Starovoitov <ast@plumgrid.com>
To: Daniel Borkmann <daniel@iogearbox.net>, davem@davemloft.net
Cc: hannes@stressinduktion.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 4/5] random32: add prandom_init_once helper for own rngs
Date: Wed, 7 Oct 2015 09:32:24 -0700 [thread overview]
Message-ID: <56154918.5070802@plumgrid.com> (raw)
In-Reply-To: <b96539c3efda908e3a347ff15de5eaf894548a5c.1444224502.git.daniel@iogearbox.net>
On 10/7/15 6:43 AM, Daniel Borkmann wrote:
> +void prandom_init_state_once(void *pcpu_state);
> +
> +#define prandom_init_once(pcpu_state) \
> + ({ do_once(prandom_init_state_once, (pcpu_state)); })
>
> /**
> * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)
> diff --git a/lib/random32.c b/lib/random32.c
> index 36c09fb..b166237 100644
> --- a/lib/random32.c
> +++ b/lib/random32.c
> @@ -256,6 +256,11 @@ static void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state)
> }
> }
>
> +void prandom_init_state_once(void *pcpu_state)
> +{
> + prandom_seed_full_state((struct rnd_state __percpu *)pcpu_state);
> +}
> +
prandom_seed_full_state() is likely not inlined in the above.
Why introduce this helper instead of making prandom_seed_full_state()
global? with my other suggestion the void cast will be avoided as well
and compiler will do type checking.
next prev parent reply other threads:[~2015-10-07 16:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-07 13:43 [PATCH net-next 0/5] BPF/random32 updates Daniel Borkmann
2015-10-07 13:43 ` [PATCH net-next 1/5] net: move net_get_random_once to lib Daniel Borkmann
2015-10-07 13:43 ` [PATCH net-next 2/5] once: make helper generic for calling function once Daniel Borkmann
2015-10-07 16:16 ` Alexei Starovoitov
2015-10-07 21:00 ` Daniel Borkmann
2015-10-07 13:43 ` [PATCH net-next 3/5] random32: add prandom_seed_full_state helper Daniel Borkmann
2015-10-07 13:43 ` [PATCH net-next 4/5] random32: add prandom_init_once helper for own rngs Daniel Borkmann
2015-10-07 16:32 ` Alexei Starovoitov [this message]
2015-10-07 13:43 ` [PATCH net-next 5/5] bpf: split state from prandom_u32() and consolidate {c,e}BPF prngs Daniel Borkmann
2015-10-07 16:38 ` Alexei Starovoitov
2015-10-07 21:01 ` Daniel Borkmann
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=56154918.5070802@plumgrid.com \
--to=ast@plumgrid.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hannes@stressinduktion.org \
--cc=netdev@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.