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