diff options
| author | tls <tls@NetBSD.org> | 2012-02-02 19:42:57 +0000 |
|---|---|---|
| committer | tls <tls@NetBSD.org> | 2012-02-02 19:42:57 +0000 |
| commit | cc9ee3de3e25ef31d3a97dc35bedc36945e35d2a (patch) | |
| tree | 06a2889eb6b4b02bc8b8bba6b5cc3f9b1938d18b /sys/dev/ata | |
| parent | f622122a62827e27b444c2f95632d61f73357ced (diff) | |
Entropy-pool implementation move and cleanup.
1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.
2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.
3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.
4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.
5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.
ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
Diffstat (limited to 'sys/dev/ata')
| -rw-r--r-- | sys/dev/ata/ld_ataraid.c | 8 | ||||
| -rw-r--r-- | sys/dev/ata/wd.c | 14 | ||||
| -rw-r--r-- | sys/dev/ata/wdvar.h | 6 |
3 files changed, 8 insertions, 20 deletions
diff --git a/sys/dev/ata/ld_ataraid.c b/sys/dev/ata/ld_ataraid.c index 2243f83f628..3447f385d11 100644 --- a/sys/dev/ata/ld_ataraid.c +++ b/sys/dev/ata/ld_ataraid.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_ataraid.c,v 1.38 2011/06/12 03:35:52 rmind Exp $ */ +/* $NetBSD: ld_ataraid.c,v 1.39 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -47,10 +47,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.38 2011/06/12 03:35:52 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.39 2012/02/02 19:43:02 tls Exp $"); #include "bio.h" -#include "rnd.h" + #include <sys/param.h> #include <sys/systm.h> @@ -66,9 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.38 2011/06/12 03:35:52 rmind Exp $" #include <sys/malloc.h> #include <sys/vnode.h> #include <sys/kauth.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #if NBIO > 0 #include <dev/ata/atavar.h> #include <dev/ata/atareg.h> diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index 649f25e0a83..e253fded7eb 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.391 2012/01/24 20:04:07 jakllsch Exp $ */ +/* $NetBSD: wd.c,v 1.392 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -54,12 +54,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.391 2012/01/24 20:04:07 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.392 2012/02/02 19:43:02 tls Exp $"); #include "opt_ata.h" -#include "rnd.h" - #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -78,9 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.391 2012/01/24 20:04:07 jakllsch Exp $"); #include <sys/proc.h> #include <sys/reboot.h> #include <sys/vnode.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/intr.h> #include <sys/bus.h> @@ -391,10 +387,8 @@ wdattach(device_t parent, device_t self, void *aux) disk_init(&wd->sc_dk, device_xname(wd->sc_dev), &wddkdriver); disk_attach(&wd->sc_dk); wd->sc_wdc_bio.lp = wd->sc_dk.dk_label; -#if NRND > 0 rnd_attach_source(&wd->rnd_source, device_xname(wd->sc_dev), RND_TYPE_DISK, 0); -#endif /* Discover wedges on this disk. */ dkwedge_discover(&wd->sc_dk); @@ -462,10 +456,8 @@ wddetach(device_t self, int flags) pmf_device_deregister(self); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); -#endif callout_destroy(&sc->sc_restart_ch); @@ -829,9 +821,7 @@ noerror: if ((wd->sc_wdc_bio.flags & ATA_CORR) || wd->retries > 0) } disk_unbusy(&wd->sc_dk, (bp->b_bcount - bp->b_resid), (bp->b_flags & B_READ)); -#if NRND > 0 rnd_add_uint32(&wd->rnd_source, bp->b_blkno); -#endif /* XXX Yuck, but we don't want to increment openings in this case */ if (__predict_false(bp->b_iodone == wd_split_mod15_write)) biodone(bp); diff --git a/sys/dev/ata/wdvar.h b/sys/dev/ata/wdvar.h index fea02e9ffdd..e85b7ea5a45 100644 --- a/sys/dev/ata/wdvar.h +++ b/sys/dev/ata/wdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wdvar.h,v 1.39 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: wdvar.h,v 1.40 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -31,6 +31,8 @@ #include "opt_wd_softbadsect.h" #endif +#include <sys/rnd.h> + struct wd_softc { /* General disk infos */ device_t sc_dev; @@ -66,9 +68,7 @@ struct wd_softc { SLIST_HEAD(, disk_badsectors) sc_bslist; u_int sc_bscount; #endif -#if NRND > 0 krndsource_t rnd_source; -#endif }; #define sc_drive sc_wdc_bio.drive |
