Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Omit needless state.



details:   https://anonhg.NetBSD.org/src/rev/2e0c71c11fff
branches:  trunk
changeset: 807402:2e0c71c11fff
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Apr 08 13:45:01 2015 +0000

description:
Omit needless state.

diffstat:

 sys/kern/kern_rndpool.c |  20 ++------------------
 sys/kern/kern_rndq.c    |  10 +++-------
 sys/sys/rnd.h           |   7 +------
 3 files changed, 6 insertions(+), 31 deletions(-)

diffs (130 lines):

diff -r da4e7fce4036 -r 2e0c71c11fff sys/kern/kern_rndpool.c
--- a/sys/kern/kern_rndpool.c   Wed Apr 08 13:31:42 2015 +0000
+++ b/sys/kern/kern_rndpool.c   Wed Apr 08 13:45:01 2015 +0000
@@ -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 @@
 #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 @@
        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 @@
        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 &&
diff -r da4e7fce4036 -r 2e0c71c11fff sys/kern/kern_rndq.c
--- a/sys/kern/kern_rndq.c      Wed Apr 08 13:31:42 2015 +0000
+++ b/sys/kern/kern_rndq.c      Wed Apr 08 13:45:01 2015 +0000
@@ -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 @@
 
        /*
         * 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_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 @@
        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)));
diff -r da4e7fce4036 -r 2e0c71c11fff sys/sys/rnd.h
--- a/sys/sys/rnd.h     Wed Apr 08 13:31:42 2015 +0000
+++ b/sys/sys/rnd.h     Wed Apr 08 13:45:01 2015 +0000
@@ -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 @@
        }
 }
 
-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 */



Home | Main Index | Thread Index | Old Index