Module Name: src
Committed By: riastradh
Date: Wed Apr 8 13:45:01 UTC 2015
Modified Files:
src/sys/kern: kern_rndpool.c kern_rndq.c
src/sys/sys: rnd.h
Log Message:
Omit needless state.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/kern_rndpool.c
cvs rdiff -u -r1.38 -r1.39 src/sys/kern/kern_rndq.c
cvs rdiff -u -r1.43 -r1.44 src/sys/sys/rnd.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_rndpool.c
diff -u src/sys/kern/kern_rndpool.c:1.7 src/sys/kern/kern_rndpool.c:1.8
--- src/sys/kern/kern_rndpool.c:1.7 Mon Aug 11 13:59:24 2014
+++ src/sys/kern/kern_rndpool.c Wed Apr 8 13:45:01 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rndpool.c,v 1.7 2014/08/11 13:59:24 riastradh Exp $ */
+/* $NetBSD: kern_rndpool.c,v 1.8 2015/04/08 13:45:01 riastradh Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndpool.c,v 1.7 2014/08/11 13:59:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndpool.c,v 1.8 2015/04/08 13:45:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -49,16 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: kern_rndpool
#define TAP4 9
#define TAP5 7
-/*
- * Let others know: the pool is full.
- *
- * XXX these should be per-pool if we really mean to allow multiple pools.
- */
-int rnd_full = 0; /* Flag: is the pool full? */
-int rnd_filled = 0; /* Count: how many times filled? */
-int rnd_empty = 1; /* Flag: is the pool empty? */
-extern int rnd_initial_entropy; /* Have ever hit the "threshold" */
-
static inline void rndpool_add_one_word(rndpool_t *, u_int32_t);
void
@@ -237,8 +227,6 @@ rndpool_add_data(rndpool_t *rp,
if (rp->stats.curentropy > RND_POOLBITS) {
rp->stats.discarded += (rp->stats.curentropy - RND_POOLBITS);
rp->stats.curentropy = RND_POOLBITS;
- rnd_filled++;
- rnd_full = 1;
}
}
@@ -270,10 +258,6 @@ rndpool_extract_data(rndpool_t *rp, void
buf = p;
remain = len;
- if (rp->stats.curentropy < RND_POOLBITS / 2) {
- rnd_full = 0;
- }
-
KASSERT(RND_ENTROPY_THRESHOLD * 2 <= sizeof(digest));
while (remain != 0 && ! (mode == RND_EXTRACT_GOOD &&
Index: src/sys/kern/kern_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.38 src/sys/kern/kern_rndq.c:1.39
--- src/sys/kern/kern_rndq.c:1.38 Wed Apr 8 13:24:23 2015
+++ src/sys/kern/kern_rndq.c Wed Apr 8 13:45:01 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rndq.c,v 1.38 2015/04/08 13:24:23 riastradh Exp $ */
+/* $NetBSD: kern_rndq.c,v 1.39 2015/04/08 13:45:01 riastradh Exp $ */
/*-
* Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.38 2015/04/08 13:24:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.39 2015/04/08 13:45:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -308,13 +308,11 @@ rnd_wakeup_readers(void)
/*
* XXX This bookkeeping shouldn't be here -- this is not where
- * the rnd_empty/rnd_initial_entropy state change actually
- * happens.
+ * the rnd_initial_entropy state change actually happens.
*/
mutex_spin_enter(&rndpool_mtx);
const size_t entropy_count = rndpool_get_entropy_count(&rnd_pool);
if (entropy_count < RND_ENTROPY_THRESHOLD * 8) {
- rnd_empty = 1;
mutex_spin_exit(&rndpool_mtx);
return;
} else {
@@ -323,7 +321,6 @@ rnd_wakeup_readers(void)
rnd_printf_verbose("rnd: have initial entropy (%zu)\n",
entropy_count);
#endif
- rnd_empty = 0;
rnd_initial_entropy = 1;
}
mutex_spin_exit(&rndpool_mtx);
@@ -1125,7 +1122,6 @@ skip: SIMPLEQ_INSERT_TAIL(&df_samples,
if (pool_entropy > RND_ENTROPY_THRESHOLD * 8) {
wake++;
} else {
- rnd_empty = 1;
rnd_getmore(howmany((RND_POOLBITS - pool_entropy), NBBY));
rnd_printf_verbose("rnd: empty, asking for %d bytes\n",
(int)(howmany((RND_POOLBITS - pool_entropy), NBBY)));
Index: src/sys/sys/rnd.h
diff -u src/sys/sys/rnd.h:1.43 src/sys/sys/rnd.h:1.44
--- src/sys/sys/rnd.h:1.43 Sun Oct 26 18:22:32 2014
+++ src/sys/sys/rnd.h Wed Apr 8 13:45:01 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: rnd.h,v 1.43 2014/10/26 18:22:32 tls Exp $ */
+/* $NetBSD: rnd.h,v 1.44 2015/04/08 13:45:01 riastradh Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -228,16 +228,11 @@ rnd_add_uint64(krndsource_t *kr, uint64_
}
}
-extern int rnd_empty;
-extern int rnd_full;
-extern int rnd_filled;
extern int rnd_initial_entropy;
extern int rnd_ready;
extern int rnd_printing; /* XXX recursion through printf */
-extern int rnd_blockonce;
-
#endif /* _KERNEL */
#define RND_MAXSTATCOUNT 10 /* 10 sources at once max */