[PATCH 11/22] /dev/random: flag pools that need entropy reserve

From: Matt Mackall
Date: Thu Mar 25 2004 - 20:14:55 EST



/dev/random flag pools that need entropy reserve

Add flag for pools that need to leave an entropy reserve


tiny-mpm/drivers/char/random.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN drivers/char/random.c~reserved-in-struct drivers/char/random.c
--- tiny/drivers/char/random.c~reserved-in-struct 2004-03-20 13:38:27.000000000 -0600
+++ tiny-mpm/drivers/char/random.c 2004-03-20 13:38:27.000000000 -0600
@@ -497,6 +497,7 @@ struct entropy_store {
unsigned add_ptr;
int entropy_count;
int input_rotate;
+ int reserved;
struct poolinfo *poolinfo;
spinlock_t lock;
__u32 pool[0];
@@ -1277,13 +1278,14 @@ static inline void xfer_secondary_pool(s
if (r->entropy_count < nbytes * 8 &&
r->entropy_count < r->poolinfo->POOLBITS) {
int bytes = min_t(int, nbytes, TMP_BUF_SIZE);
+ int reserved = r->reserved ? random_read_wakeup_thresh/4 : 0;

DEBUG_ENT("going to reseed %s with %d bits "
"(%d of %d requested)\n", r->name,
bytes * 8, nbytes * 8, r->entropy_count);

bytes=extract_entropy(input_pool, tmp, bytes,
- random_read_wakeup_thresh / 8, 0,
+ random_read_wakeup_thresh/8, reserved,
EXTRACT_ENTROPY_LIMIT);
add_entropy_words(r, tmp, bytes);
credit_entropy_store(r, bytes*8);

_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/