Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Nov 2014 20:23:44 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274252 - in head/sys: dev/random modules/random
Message-ID:  <201411072023.sA7KNiUG034940@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Nov  7 20:23:43 2014
New Revision: 274252
URL: https://svnweb.freebsd.org/changeset/base/274252

Log:
  Fix random.ko module.
  - Remove duplicated sources between standard part of the kernel and
    module.  In particular, it caused duplicated lock initialization and
    sysctl registration, both having bad consequences.
  - Add missed source files to module.
  - Static part of the kernel provides randomdev module, not
    random_adaptors.  Correct dependencies.
  - Use cdev modules declaration macros.
  
  Approved by:	secteam (delphij)
  Reviewed by:	markm

Modified:
  head/sys/dev/random/ivy.c
  head/sys/dev/random/nehemiah.c
  head/sys/dev/random/randomdev.c
  head/sys/dev/random/randomdev_soft.c
  head/sys/modules/random/Makefile

Modified: head/sys/dev/random/ivy.c
==============================================================================
--- head/sys/dev/random/ivy.c	Fri Nov  7 20:15:23 2014	(r274251)
+++ head/sys/dev/random/ivy.c	Fri Nov  7 20:23:43 2014	(r274252)
@@ -132,4 +132,4 @@ rdrand_modevent(module_t mod, int type, 
 
 DEV_MODULE(rdrand, rdrand_modevent, NULL);
 MODULE_VERSION(rdrand, 1);
-MODULE_DEPEND(rdrand, random_adaptors, 1, 1, 1);
+MODULE_DEPEND(rdrand, randomdev, 1, 1, 1);

Modified: head/sys/dev/random/nehemiah.c
==============================================================================
--- head/sys/dev/random/nehemiah.c	Fri Nov  7 20:15:23 2014	(r274251)
+++ head/sys/dev/random/nehemiah.c	Fri Nov  7 20:23:43 2014	(r274252)
@@ -157,4 +157,4 @@ nehemiah_modevent(module_t mod, int type
 
 DEV_MODULE(nehemiah, nehemiah_modevent, NULL);
 MODULE_VERSION(nehemiah, 1);
-MODULE_DEPEND(nehemiah, random_adaptors, 1, 1, 1);
+MODULE_DEPEND(nehemiah, randomdev, 1, 1, 1);

Modified: head/sys/dev/random/randomdev.c
==============================================================================
--- head/sys/dev/random/randomdev.c	Fri Nov  7 20:15:23 2014	(r274251)
+++ head/sys/dev/random/randomdev.c	Fri Nov  7 20:23:43 2014	(r274252)
@@ -159,15 +159,7 @@ randomdev_modevent(module_t mod __unused
 	return (error);
 }
 
-#define	EARLY_2_DEV_MODULE(name, evh, arg)	\
-static moduledata_t name##_mod = {		\
-    #name,					\
-    evh,					\
-    arg						\
-};						\
-DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND)
-
-EARLY_2_DEV_MODULE(randomdev, randomdev_modevent, NULL);
+DEV_MODULE_ORDERED(randomdev, randomdev_modevent, NULL, SI_ORDER_SECOND);
 MODULE_VERSION(randomdev, 1);
 
 /* ================

Modified: head/sys/dev/random/randomdev_soft.c
==============================================================================
--- head/sys/dev/random/randomdev_soft.c	Fri Nov  7 20:15:23 2014	(r274251)
+++ head/sys/dev/random/randomdev_soft.c	Fri Nov  7 20:23:43 2014	(r274252)
@@ -153,21 +153,13 @@ randomdev_soft_modevent(module_t mod __u
 	return (error);
 }
 
-#define	MID_DEV_MODULE(name, evh, arg)	\
-static moduledata_t name##_mod = {		\
-    #name,					\
-    evh,					\
-    arg						\
-};						\
-DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
-
 #if defined(RANDOM_YARROW)
-MID_DEV_MODULE(yarrow, randomdev_soft_modevent, NULL);
+DEV_MODULE(yarrow, randomdev_soft_modevent, NULL);
 MODULE_VERSION(yarrow, 1);
-MODULE_DEPEND(yarrow, random_adaptors, 1, 1, 1);
+MODULE_DEPEND(yarrow, randomdev, 1, 1, 1);
 #endif
 #if defined(RANDOM_FORTUNA)
-MID_DEV_MODULE(fortuna, randomdev_soft_modevent, NULL);
+DEV_MODULE(fortuna, randomdev_soft_modevent, NULL);
 MODULE_VERSION(fortuna, 1);
-MODULE_DEPEND(fortuna, random_adaptors, 1, 1, 1);
+MODULE_DEPEND(fortuna, randomdev, 1, 1, 1);
 #endif

Modified: head/sys/modules/random/Makefile
==============================================================================
--- head/sys/modules/random/Makefile	Fri Nov  7 20:15:23 2014	(r274251)
+++ head/sys/modules/random/Makefile	Fri Nov  7 20:23:43 2014	(r274252)
@@ -6,8 +6,7 @@
 
 KMOD=	random
 SRCS=	randomdev_soft.c
-SRCS+=	yarrow.c hash.c
-SRCS+=	random_harvestq.c live_entropy_sources.c
+SRCS+=	yarrow.c fortuna.c hash.c
 SRCS+=	rijndael-alg-fst.c rijndael-api-fst.c sha2.c sha256c.c
 SRCS+=	bus_if.h device_if.h vnode_if.h opt_cpu.h opt_random.h
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411072023.sA7KNiUG034940>