git: edede7d79a26 - stable/12 - random(4): De-export random_sources list

From: David E. O'Brien <obrien_at_FreeBSD.org>
Date: Thu, 17 Feb 2022 05:06:00 UTC
The branch stable/12 has been updated by obrien:

URL: https://cgit.FreeBSD.org/src/commit/?id=edede7d79a26e747460586d0621a59fa7ed35f7e

commit edede7d79a26e747460586d0621a59fa7ed35f7e
Author:     Conrad Meyer <cem@FreeBSD.org>
AuthorDate: 2019-11-22 20:24:15 +0000
Commit:     David E. O'Brien <obrien@FreeBSD.org>
CommitDate: 2022-02-17 04:57:46 +0000

    random(4): De-export random_sources list
    
    The internal datastructures do not need to be visible outside of
    random_harvestq, and this helps ensure they are not misused.
    
    No functional change.
    
    (cherry picked from commit b6db1cc7100350790201bfa550ec47d9a5fbe781)
---
 sys/dev/random/random_harvestq.c | 8 ++++++++
 sys/dev/random/random_infra.c    | 2 --
 sys/dev/random/randomdev.h       | 8 --------
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c
index 0c6777ba9d0d..035b5c028fb6 100644
--- a/sys/dev/random/random_harvestq.c
+++ b/sys/dev/random/random_harvestq.c
@@ -87,6 +87,14 @@ volatile int random_kthread_control;
  */
 __read_frequently u_int hc_source_mask;
 
+struct random_sources {
+	LIST_ENTRY(random_sources)	 rrs_entries;
+	struct random_source		*rrs_source;
+};
+
+static LIST_HEAD(sources_head, random_sources) source_list =
+    LIST_HEAD_INITIALIZER(source_list);
+
 SYSCTL_NODE(_kern_random, OID_AUTO, harvest, CTLFLAG_RW, 0,
     "Entropy Device Parameters");
 
diff --git a/sys/dev/random/random_infra.c b/sys/dev/random/random_infra.c
index 9a40c35f12b7..19973ac4b46d 100644
--- a/sys/dev/random/random_infra.c
+++ b/sys/dev/random/random_infra.c
@@ -101,8 +101,6 @@ SYSCTL_BOOL(_kern_random_initial_seeding, OID_AUTO,
 
 MALLOC_DEFINE(M_ENTROPY, "entropy", "Entropy harvesting buffers and data structures");
 
-struct sources_head source_list = LIST_HEAD_INITIALIZER(source_list);
-
 #if defined(RANDOM_LOADABLE)
 struct random_algorithm *p_random_alg_context = NULL;
 #else /* !defined(RANDOM_LOADABLE) */
diff --git a/sys/dev/random/randomdev.h b/sys/dev/random/randomdev.h
index abed568fb215..896b31a5fea2 100644
--- a/sys/dev/random/randomdev.h
+++ b/sys/dev/random/randomdev.h
@@ -102,14 +102,6 @@ struct random_source {
 	random_source_read_t		*rs_read;
 };
 
-struct random_sources {
-	LIST_ENTRY(random_sources)	 rrs_entries;
-	struct random_source		*rrs_source;
-};
-
-LIST_HEAD(sources_head, random_sources);
-extern struct sources_head source_list;
-
 void random_source_register(struct random_source *);
 void random_source_deregister(struct random_source *);