ar71xx: add default LED configuration for the TL-MR3020
[openwrt.git] / target / linux / generic / patches-2.6.30 / 971-ocf_20110720.patch
1
2 --- a/drivers/char/random.c
3 +++ b/drivers/char/random.c
4 @@ -129,6 +129,9 @@
5 * unsigned int value);
6 * void add_interrupt_randomness(int irq);
7 *
8 + * void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
9 + * int random_input_wait(void);
10 + *
11 * add_input_randomness() uses the input layer interrupt timing, as well as
12 * the event type information from the hardware.
13 *
14 @@ -140,6 +143,13 @@
15 * a better measure, since the timing of the disk interrupts are more
16 * unpredictable.
17 *
18 + * random_input_words() just provides a raw block of entropy to the input
19 + * pool, such as from a hardware entropy generator.
20 + *
21 + * random_input_wait() suspends the caller until such time as the
22 + * entropy pool falls below the write threshold, and returns a count of how
23 + * much entropy (in bits) is needed to sustain the pool.
24 + *
25 * All of these routines try to estimate how many bits of randomness a
26 * particular randomness source. They do this by keeping track of the
27 * first and second order deltas of the event timings.
28 @@ -712,6 +722,61 @@ void add_disk_randomness(struct gendisk
29 }
30 #endif
31
32 +/*
33 + * random_input_words - add bulk entropy to pool
34 + *
35 + * @buf: buffer to add
36 + * @wordcount: number of __u32 words to add
37 + * @ent_count: total amount of entropy (in bits) to credit
38 + *
39 + * this provides bulk input of entropy to the input pool
40 + *
41 + */
42 +void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
43 +{
44 + mix_pool_bytes(&input_pool, buf, wordcount*4);
45 +
46 + credit_entropy_bits(&input_pool, ent_count);
47 +
48 + DEBUG_ENT("crediting %d bits => %d\n",
49 + ent_count, input_pool.entropy_count);
50 + /*
51 + * Wake up waiting processes if we have enough
52 + * entropy.
53 + */
54 + if (input_pool.entropy_count >= random_read_wakeup_thresh)
55 + wake_up_interruptible(&random_read_wait);
56 +}
57 +EXPORT_SYMBOL(random_input_words);
58 +
59 +/*
60 + * random_input_wait - wait until random needs entropy
61 + *
62 + * this function sleeps until the /dev/random subsystem actually
63 + * needs more entropy, and then return the amount of entropy
64 + * that it would be nice to have added to the system.
65 + */
66 +int random_input_wait(void)
67 +{
68 + int count;
69 +
70 + wait_event_interruptible(random_write_wait,
71 + input_pool.entropy_count < random_write_wakeup_thresh);
72 +
73 + count = random_write_wakeup_thresh - input_pool.entropy_count;
74 +
75 + /* likely we got woken up due to a signal */
76 + if (count <= 0) count = random_read_wakeup_thresh;
77 +
78 + DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n",
79 + count,
80 + input_pool.entropy_count, random_write_wakeup_thresh);
81 +
82 + return count;
83 +}
84 +EXPORT_SYMBOL(random_input_wait);
85 +
86 +
87 #define EXTRACT_SIZE 10
88
89 /*********************************************************************
90 --- a/fs/fcntl.c
91 +++ b/fs/fcntl.c
92 @@ -196,6 +196,7 @@ static int setfl(int fd, struct file * f
93 out:
94 return error;
95 }
96 +EXPORT_SYMBOL(sys_dup);
97
98 static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
99 uid_t uid, uid_t euid, int force)
100 --- a/include/linux/miscdevice.h
101 +++ b/include/linux/miscdevice.h
102 @@ -12,6 +12,7 @@
103 #define APOLLO_MOUSE_MINOR 7
104 #define PC110PAD_MINOR 9
105 /*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
106 +#define CRYPTODEV_MINOR 70 /* /dev/crypto */
107 #define WATCHDOG_MINOR 130 /* Watchdog timer */
108 #define TEMP_MINOR 131 /* Temperature Sensor */
109 #define RTC_MINOR 135
110 --- a/include/linux/random.h
111 +++ b/include/linux/random.h
112 @@ -50,6 +50,10 @@ extern void add_input_randomness(unsigne
113 unsigned int value);
114 extern void add_interrupt_randomness(int irq);
115
116 +extern void random_input_words(__u32 *buf, size_t wordcount, int ent_count);
117 +extern int random_input_wait(void);
118 +#define HAS_RANDOM_INPUT_WAIT 1
119 +
120 extern void get_random_bytes(void *buf, int nbytes);
121 void generate_random_uuid(unsigned char uuid_out[16]);
122
This page took 0.045117 seconds and 5 git commands to generate.