code style scripts/checkpatch.pl (linux-3.9-rc1) formatting
[linux-2.6.32.60-moxart.git] / include / linux / random.h
blob1864957af85064e84f200a0378f632249abf6f9f
1 /*
2 * include/linux/random.h
4 * Include file for the random number generator.
5 */
7 #ifndef _LINUX_RANDOM_H
8 #define _LINUX_RANDOM_H
10 #include <linux/types.h>
11 #include <linux/ioctl.h>
12 #include <linux/irqnr.h>
14 /* ioctl()'s for the random number generator */
16 /* Get the entropy count. */
17 #define RNDGETENTCNT _IOR( 'R', 0x00, int )
19 /* Add to (or subtract from) the entropy count. (Superuser only.) */
20 #define RNDADDTOENTCNT _IOW( 'R', 0x01, int )
22 /* Get the contents of the entropy pool. (Superuser only.) */
23 #define RNDGETPOOL _IOR( 'R', 0x02, int [2] )
25 /*
26 * Write bytes into the entropy pool and add to the entropy count.
27 * (Superuser only.)
29 #define RNDADDENTROPY _IOW( 'R', 0x03, int [2] )
31 /* Clear entropy count to 0. (Superuser only.) */
32 #define RNDZAPENTCNT _IO( 'R', 0x04 )
34 /* Clear the entropy pool and associated counters. (Superuser only.) */
35 #define RNDCLEARPOOL _IO( 'R', 0x06 )
37 struct rand_pool_info {
38 int entropy_count;
39 int buf_size;
40 __u32 buf[0];
43 /* Exported functions */
45 #ifdef __KERNEL__
47 extern void add_device_randomness(const void *, unsigned int);
48 extern void add_input_randomness(unsigned int type, unsigned int code,
49 unsigned int value);
50 extern void add_interrupt_randomness(int irq, int irq_flags);
52 extern void get_random_bytes(void *buf, int nbytes);
53 extern void get_random_bytes_arch(void *buf, int nbytes);
54 void generate_random_uuid(unsigned char uuid_out[16]);
56 #ifndef MODULE
57 extern const struct file_operations random_fops, urandom_fops;
58 #endif
60 unsigned int get_random_int(void);
61 unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
63 u32 random32(void);
64 void srandom32(u32 seed);
66 #ifdef CONFIG_ARCH_RANDOM
67 # include <asm/archrandom.h>
68 #else
69 static inline int arch_get_random_long(unsigned long *v)
71 return 0;
73 static inline int arch_get_random_int(unsigned int *v)
75 return 0;
77 #endif
79 #endif /* __KERNEL___ */
81 #endif /* _LINUX_RANDOM_H */