diff options
| author | David S. Miller <davem@davemloft.net> | 2015-10-08 05:26:44 -0700 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-10-08 05:26:44 -0700 |
| commit | df718423250c000ca4323a767cedc2f3219b685c (patch) | |
| tree | 3afa13e8acbdf49a9f8c1a7993065c3836997a01 /include/linux/random.h | |
| parent | 28335a7445202a3d118145a07d9138e9881ebe18 (diff) | |
| parent | 3ad0040573b0c00f88488bc31958acd07a55ee2e (diff) | |
Merge branch 'bpf_random32'
Daniel Borkmann says:
====================
BPF/random32 updates
BPF update to split the prandom state apart, and to move the
*once helpers to the core. For details, please see individual
patches. Given the changes and since it's in the tree for
quite some time, net-next is a better choice in our opinion.
v1 -> v2:
- Make DO_ONCE() type-safe, remove the kvec helper. Credits
go to Alexei Starovoitov for the __VA_ARGS__ hint, thanks!
- Add a comment to the DO_ONCE() helper as suggested by Alexei.
- Rework prandom_init_once() helper to the new API.
- Keep Alexei's Acked-by on the last patch.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/random.h')
| -rw-r--r-- | include/linux/random.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/random.h b/include/linux/random.h index e651874df2c9..a75840c1aa71 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -7,6 +7,8 @@ #define _LINUX_RANDOM_H #include <linux/list.h> +#include <linux/once.h> + #include <uapi/linux/random.h> struct random_ready_callback { @@ -45,6 +47,10 @@ struct rnd_state { u32 prandom_u32_state(struct rnd_state *state); void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes); +void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state); + +#define prandom_init_once(pcpu_state) \ + DO_ONCE(prandom_seed_full_state, (pcpu_state)) /** * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) |
