Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Group initialization of rnd_samples and rnd_global.



details:   https://anonhg.NetBSD.org/src/rev/e34a6ab82a44
branches:  trunk
changeset: 807579:e34a6ab82a44
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Apr 14 13:26:58 2015 +0000

description:
Group initialization of rnd_samples and rnd_global.

diffstat:

 sys/kern/kern_rndq.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (46 lines):

diff -r 2413aa40a9c4 -r e34a6ab82a44 sys/kern/kern_rndq.c
--- a/sys/kern/kern_rndq.c      Tue Apr 14 13:23:25 2015 +0000
+++ b/sys/kern/kern_rndq.c      Tue Apr 14 13:26:58 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_rndq.c,v 1.58 2015/04/14 13:23:25 riastradh Exp $ */
+/*     $NetBSD: kern_rndq.c,v 1.59 2015/04/14 13:26:58 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.58 2015/04/14 13:23:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.59 2015/04/14 13:26:58 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -495,20 +495,22 @@
        if (rnd_ready)
                return;
 
-       mutex_init(&rnd_samples.lock, MUTEX_DEFAULT, IPL_VM);
-       rndsinks_init();
-
        /*
         * take a counter early, hoping that there's some variance in
         * the following operations
         */
        c = rnd_counter();
 
-       LIST_INIT(&rnd_global.sources);
+       rndsinks_init();
+
+       /* Initialize the sample queue.  */
+       mutex_init(&rnd_samples.lock, MUTEX_DEFAULT, IPL_VM);
        SIMPLEQ_INIT(&rnd_samples.q);
 
+       /* Initialize the global pool and sources list.  */
+       mutex_init(&rnd_global.lock, MUTEX_DEFAULT, IPL_VM);
        rndpool_init(&rnd_global.pool);
-       mutex_init(&rnd_global.lock, MUTEX_DEFAULT, IPL_VM);
+       LIST_INIT(&rnd_global.sources);
 
        rnd_mempc = pool_cache_init(sizeof(rnd_sample_t), 0, 0, 0,
                                    "rndsample", NULL, IPL_VM,



Home | Main Index | Thread Index | Old Index