Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys move entropy gathering into dksubr.
details: https://anonhg.NetBSD.org/src/rev/d07f703d6811
branches: trunk
changeset: 340245:d07f703d6811
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Fri Aug 28 17:41:49 2015 +0000
description:
move entropy gathering into dksubr.
diffstat:
sys/arch/xen/xen/xbd_xenbus.c | 14 ++------------
sys/dev/dksubr.c | 15 ++++++++++-----
sys/dev/dkvar.h | 5 ++++-
sys/dev/ld.c | 12 ++----------
sys/dev/ldvar.h | 3 +--
5 files changed, 19 insertions(+), 30 deletions(-)
diffs (201 lines):
diff -r 1a9da4faff54 -r d07f703d6811 sys/arch/xen/xen/xbd_xenbus.c
--- a/sys/arch/xen/xen/xbd_xenbus.c Fri Aug 28 14:23:18 2015 +0000
+++ b/sys/arch/xen/xen/xbd_xenbus.c Fri Aug 28 17:41:49 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xbd_xenbus.c,v 1.73 2015/08/27 05:51:50 mlelstv Exp $ */
+/* $NetBSD: xbd_xenbus.c,v 1.74 2015/08/28 17:41:49 mlelstv Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.73 2015/08/27 05:51:50 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.74 2015/08/28 17:41:49 mlelstv Exp $");
#include "opt_xen.h"
@@ -73,8 +73,6 @@
#include <uvm/uvm.h>
-#include <sys/rndsource.h>
-
#include <xen/hypervisor.h>
#include <xen/evtchn.h>
#include <xen/granttables.h>
@@ -151,7 +149,6 @@
u_long sc_info; /* VDISK_* */
u_long sc_handle; /* from backend */
int sc_cache_flush; /* backend supports BLKIF_OP_FLUSH_DISKCACHE */
- krndsource_t sc_rnd_source;
};
#if 0
@@ -309,9 +306,6 @@
return;
}
- rnd_attach_source(&sc->sc_rnd_source, device_xname(self),
- RND_TYPE_DISK, RND_FLAG_DEFAULT);
-
if (!pmf_device_register(self, xbd_xenbus_suspend, xbd_xenbus_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
@@ -371,8 +365,6 @@
disk_detach(&sc->sc_dksc.sc_dkdev);
disk_destroy(&sc->sc_dksc.sc_dkdev);
dk_detach(&sc->sc_dksc);
- /* Unhook the entropy source. */
- rnd_detach_source(&sc->sc_rnd_source);
}
hypervisor_mask_event(sc->sc_evtchn);
@@ -700,8 +692,6 @@
if (bp->b_data != xbdreq->req_data)
xbd_unmap_align(xbdreq);
- rnd_add_uint32(&sc->sc_rnd_source,
- bp->b_blkno);
dk_done(&sc->sc_dksc, bp);
SLIST_INSERT_HEAD(&sc->sc_xbdreq_head, xbdreq, req_next);
diff -r 1a9da4faff54 -r d07f703d6811 sys/dev/dksubr.c
--- a/sys/dev/dksubr.c Fri Aug 28 14:23:18 2015 +0000
+++ b/sys/dev/dksubr.c Fri Aug 28 17:41:49 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.75 2015/08/28 05:49:31 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.76 2015/08/28 17:41:49 mlelstv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.75 2015/08/28 05:49:31 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.76 2015/08/28 17:41:49 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -96,11 +96,18 @@
#ifdef DIAGNOSTIC
dksc->sc_flags |= DKF_WARNLABEL | DKF_LABELSANITY;
#endif
+
+ /* Attach the device into the rnd source list. */
+ rnd_attach_source(&dksc->sc_rnd_source, dksc->sc_xname,
+ RND_TYPE_DISK, RND_FLAG_DEFAULT);
}
void
dk_detach(struct dk_softc *dksc)
{
+ /* Unhook the entropy source. */
+ rnd_detach_source(&dksc->sc_rnd_source);
+
dksc->sc_flags &= ~DKF_INITED;
mutex_destroy(&dksc->sc_iolock);
}
@@ -367,9 +374,7 @@
if (lock)
mutex_exit(&dksc->sc_iolock);
-#ifdef notyet
- rnd_add_uint(&dksc->sc_rnd_source, bp->b_rawblkno);
-#endif
+ rnd_add_uint32(&dksc->sc_rnd_source, bp->b_rawblkno);
biodone(bp);
}
diff -r 1a9da4faff54 -r d07f703d6811 sys/dev/dkvar.h
--- a/sys/dev/dkvar.h Fri Aug 28 14:23:18 2015 +0000
+++ b/sys/dev/dkvar.h Fri Aug 28 17:41:49 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dkvar.h,v 1.23 2015/08/28 05:49:31 mlelstv Exp $ */
+/* $NetBSD: dkvar.h,v 1.24 2015/08/28 17:41:49 mlelstv Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/rndsource.h>
+
struct pathbuf; /* from namei.h */
/* literally this is not a softc, but is intended to be included in
@@ -49,6 +51,7 @@
int sc_dtype; /* disk type */
struct buf *sc_deferred; /* retry after start failed */
bool sc_busy; /* processing buffers */
+ krndsource_t sc_rnd_source; /* entropy source */
};
/* sc_flags:
diff -r 1a9da4faff54 -r d07f703d6811 sys/dev/ld.c
--- a/sys/dev/ld.c Fri Aug 28 14:23:18 2015 +0000
+++ b/sys/dev/ld.c Fri Aug 28 17:41:49 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld.c,v 1.92 2015/08/27 05:51:50 mlelstv Exp $ */
+/* $NetBSD: ld.c,v 1.93 2015/08/28 17:41:49 mlelstv Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.92 2015/08/27 05:51:50 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.93 2015/08/28 17:41:49 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -54,7 +54,6 @@
#include <sys/vnode.h>
#include <sys/syslog.h>
#include <sys/mutex.h>
-#include <sys/rndsource.h>
#include <dev/ldvar.h>
@@ -139,10 +138,6 @@
dk_init(dksc, self, DKTYPE_LD);
disk_init(&dksc->sc_dkdev, dksc->sc_xname, &lddkdriver);
- /* Attach the device into the rnd source list. */
- rnd_attach_source(&sc->sc_rnd_source, dksc->sc_xname,
- RND_TYPE_DISK, RND_FLAG_DEFAULT);
-
if (sc->sc_maxxfer > MAXPHYS)
sc->sc_maxxfer = MAXPHYS;
@@ -248,9 +243,6 @@
dk_detach(dksc);
- /* Unhook the entropy source. */
- rnd_detach_source(&sc->sc_rnd_source);
-
/* Deregister with PMF */
pmf_device_deregister(dksc->sc_dev);
diff -r 1a9da4faff54 -r d07f703d6811 sys/dev/ldvar.h
--- a/sys/dev/ldvar.h Fri Aug 28 14:23:18 2015 +0000
+++ b/sys/dev/ldvar.h Fri Aug 28 17:41:49 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldvar.h,v 1.26 2015/08/17 19:47:21 jakllsch Exp $ */
+/* $NetBSD: ldvar.h,v 1.27 2015/08/28 17:41:49 mlelstv Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,6 @@
struct dk_softc sc_dksc;
kmutex_t sc_mutex;
kcondvar_t sc_drain;
- krndsource_t sc_rnd_source;
int sc_queuecnt; /* current h/w queue depth */
int sc_ncylinders; /* # cylinders */
Home |
Main Index |
Thread Index |
Old Index