net: move net_get_random_once to lib
[deliverable/linux.git] / include / linux / once.h
CommitLineData
46234253
HFS
1#ifndef _LINUX_ONCE_H
2#define _LINUX_ONCE_H
3
4#include <linux/types.h>
5#include <linux/jump_label.h>
6
7bool __get_random_once(void *buf, int nbytes, bool *done,
8 struct static_key *once_key);
9
10#define get_random_once(buf, nbytes) \
11 ({ \
12 bool ___ret = false; \
13 static bool ___done = false; \
14 static struct static_key ___once_key = \
15 STATIC_KEY_INIT_TRUE; \
16 if (static_key_true(&___once_key)) \
17 ___ret = __get_random_once((buf), \
18 (nbytes), \
19 &___done, \
20 &___once_key); \
21 ___ret; \
22 })
23
24#endif /* _LINUX_ONCE_H */
This page took 0.033039 seconds and 5 git commands to generate.