]> git.proxmox.com Git - mirror_spl-debian.git/blob - include/linux-random.h
Initial commit. All spl source written up to this point wrapped
[mirror_spl-debian.git] / include / linux-random.h
1 #ifndef _SYS_LINUX_RANDOM_H
2 #define _SYS_LINUX_RANDOM_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #include <linux/random.h>
9
10 /* FIXME:
11 * Should add support for blocking in the future to
12 * ensure that proper entopy is collected. ZFS doesn't
13 * use it at the moment so this is good enough for now.
14 * Always will succeed by returning 0.
15 */
16 static __inline__ int
17 random_get_bytes(uint8_t *ptr, size_t len)
18 {
19 BUG_ON(len < 0);
20 get_random_bytes((void *)ptr,(int)len);
21 return 0;
22 }
23
24 /* Always will succeed by returning 0. */
25 static __inline__ int
26 random_get_pseudo_bytes(uint8_t *ptr, size_t len)
27 {
28 BUG_ON(len < 0);
29 get_random_bytes((void *)ptr,(int)len);
30 return 0;
31 }
32
33 #ifdef __cplusplus
34 }
35 #endif
36
37 #endif /* _SYS_LINUX_RANDOM_H */