The branch main has been updated by markj:

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

commit d5f55356a2fbf8222fb236fe509821e12f1ea456
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2025-08-19 14:06:02 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2025-08-19 14:06:02 +0000

    random: Make random_source definitions const
    
    We can do so trivially, so make these tables read-only.  No functional
    change intended.
    
    Reviewed by:    cem, emaste
    MFC after:      2 weeks
    Sponsored by:   Stormshield
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D52003
---
 sys/crypto/ccp/ccp.c                  | 2 +-
 sys/dev/psci/smccc_trng.c             | 2 +-
 sys/dev/qcom_rnd/qcom_rnd.c           | 2 +-
 sys/dev/random/armv8rng.c             | 2 +-
 sys/dev/random/darn.c                 | 2 +-
 sys/dev/random/ivy.c                  | 2 +-
 sys/dev/random/nehemiah.c             | 2 +-
 sys/dev/random/random_harvestq.c      | 6 +++---
 sys/dev/random/randomdev.h            | 4 ++--
 sys/dev/virtio/random/virtio_random.c | 2 +-
 10 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/sys/crypto/ccp/ccp.c b/sys/crypto/ccp/ccp.c
index 7db9a27ab059..c3d40f6e99ac 100644
--- a/sys/crypto/ccp/ccp.c
+++ b/sys/crypto/ccp/ccp.c
@@ -79,7 +79,7 @@ static struct pciid {
        { 0x15df1022, "AMD CCP-5a" },
 };
 
-static struct random_source random_ccp = {
+static const struct random_source random_ccp = {
        .rs_ident = "AMD CCP TRNG",
        .rs_source = RANDOM_PURE_CCP,
        .rs_read = random_ccp_read,
diff --git a/sys/dev/psci/smccc_trng.c b/sys/dev/psci/smccc_trng.c
index ab98837d3841..8a2e5508ef48 100644
--- a/sys/dev/psci/smccc_trng.c
+++ b/sys/dev/psci/smccc_trng.c
@@ -58,7 +58,7 @@ static device_attach_t trng_attach;
 
 static unsigned trng_read(void *, unsigned);
 
-static struct random_source random_trng = {
+static const struct random_source random_trng = {
        .rs_ident = "Arm SMCCC TRNG",
        .rs_source = RANDOM_PURE_ARM_TRNG,
        .rs_read = trng_read,
diff --git a/sys/dev/qcom_rnd/qcom_rnd.c b/sys/dev/qcom_rnd/qcom_rnd.c
index fdd0b553523e..a5ece7e00f28 100644
--- a/sys/dev/qcom_rnd/qcom_rnd.c
+++ b/sys/dev/qcom_rnd/qcom_rnd.c
@@ -63,7 +63,7 @@ static int    qcom_rnd_detach(device_t);
 static int     qcom_rnd_harvest(struct qcom_rnd_softc *, void *, size_t *);
 static unsigned        qcom_rnd_read(void *, unsigned);
 
-static struct random_source random_qcom_rnd = {
+static const struct random_source random_qcom_rnd = {
        .rs_ident = "Qualcomm Entropy Adapter",
        .rs_source = RANDOM_PURE_QUALCOMM,
        .rs_read = qcom_rnd_read,
diff --git a/sys/dev/random/armv8rng.c b/sys/dev/random/armv8rng.c
index 61698bfff820..524d80317681 100644
--- a/sys/dev/random/armv8rng.c
+++ b/sys/dev/random/armv8rng.c
@@ -44,7 +44,7 @@
 static u_int random_rndr_read(void *, u_int);
 
 static bool has_rndr;
-static struct random_source random_armv8_rndr = {
+static const struct random_source random_armv8_rndr = {
        .rs_ident = "Armv8 rndr RNG",
        .rs_source = RANDOM_PURE_ARMV8,
        .rs_read = random_rndr_read,
diff --git a/sys/dev/random/darn.c b/sys/dev/random/darn.c
index a66754e095fb..9bb4991df82f 100644
--- a/sys/dev/random/darn.c
+++ b/sys/dev/random/darn.c
@@ -56,7 +56,7 @@
 
 static u_int random_darn_read(void *, u_int);
 
-static struct random_source random_darn = {
+static const struct random_source random_darn = {
        .rs_ident = "PowerISA DARN random number generator",
        .rs_source = RANDOM_PURE_DARN,
        .rs_read = random_darn_read
diff --git a/sys/dev/random/ivy.c b/sys/dev/random/ivy.c
index 05474d977276..fa1e4831f1b9 100644
--- a/sys/dev/random/ivy.c
+++ b/sys/dev/random/ivy.c
@@ -51,7 +51,7 @@
 static bool has_rdrand, has_rdseed;
 static u_int random_ivy_read(void *, u_int);
 
-static struct random_source random_ivy = {
+static const struct random_source random_ivy = {
        .rs_ident = "Intel Secure Key RNG",
        .rs_source = RANDOM_PURE_RDRAND,
        .rs_read = random_ivy_read
diff --git a/sys/dev/random/nehemiah.c b/sys/dev/random/nehemiah.c
index f76071290b8f..56f144169dae 100644
--- a/sys/dev/random/nehemiah.c
+++ b/sys/dev/random/nehemiah.c
@@ -44,7 +44,7 @@
 
 static u_int random_nehemiah_read(void *, u_int);
 
-static struct random_source random_nehemiah = {
+static const struct random_source random_nehemiah = {
        .rs_ident = "VIA Nehemiah Padlock RNG",
        .rs_source = RANDOM_PURE_NEHEMIAH,
        .rs_read = random_nehemiah_read
diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c
index ced15262457f..84ec174bd08e 100644
--- a/sys/dev/random/random_harvestq.c
+++ b/sys/dev/random/random_harvestq.c
@@ -110,7 +110,7 @@ __read_frequently u_int hc_source_mask;
 
 struct random_sources {
        CK_LIST_ENTRY(random_sources)    rrs_entries;
-       struct random_source            *rrs_source;
+       const struct random_source      *rrs_source;
 };
 
 static CK_LIST_HEAD(sources_head, random_sources) source_list =
@@ -849,7 +849,7 @@ random_harvest_deregister_source(enum random_entropy_source 
source)
 }
 
 void
-random_source_register(struct random_source *rsource)
+random_source_register(const struct random_source *rsource)
 {
        struct random_sources *rrs;
 
@@ -868,7 +868,7 @@ random_source_register(struct random_source *rsource)
 }
 
 void
-random_source_deregister(struct random_source *rsource)
+random_source_deregister(const struct random_source *rsource)
 {
        struct random_sources *rrs = NULL;
 
diff --git a/sys/dev/random/randomdev.h b/sys/dev/random/randomdev.h
index e1c9ac7b680d..6d742447ea8b 100644
--- a/sys/dev/random/randomdev.h
+++ b/sys/dev/random/randomdev.h
@@ -103,8 +103,8 @@ struct random_source {
        random_source_read_t            *rs_read;
 };
 
-void random_source_register(struct random_source *);
-void random_source_deregister(struct random_source *);
+void random_source_register(const struct random_source *);
+void random_source_deregister(const struct random_source *);
 
 #endif /* _KERNEL */
 
diff --git a/sys/dev/virtio/random/virtio_random.c 
b/sys/dev/virtio/random/virtio_random.c
index f938ba99ae53..3f30c8b68f4c 100644
--- a/sys/dev/virtio/random/virtio_random.c
+++ b/sys/dev/virtio/random/virtio_random.c
@@ -77,7 +77,7 @@ static struct virtio_feature_desc vtrnd_feature_desc[] = {
        { 0, NULL }
 };
 
-static struct random_source random_vtrnd = {
+static const struct random_source random_vtrnd = {
        .rs_ident = "VirtIO Entropy Adapter",
        .rs_source = RANDOM_PURE_VIRTIO,
        .rs_read = vtrnd_read,

Reply via email to