[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56154918.5070802@plumgrid.com>
Date: Wed, 7 Oct 2015 09:32:24 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: Daniel Borkmann <daniel@...earbox.net>, davem@...emloft.net
Cc: hannes@...essinduktion.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 4/5] random32: add prandom_init_once helper for
own rngs
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists