git: 57f268ccfc66 - stable/13 - zfs: cherry-pick change from openzfs

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Sat, 21 Sep 2024 04:18:45 UTC
The branch stable/13 has been updated by zlei:

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

commit 57f268ccfc662d274d82cfc4e0e0ecb2db5d616e
Author:     Zhenlei Huang <zlei.huang@gmail.com>
AuthorDate: 2024-05-30 16:58:20 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-09-21 04:16:40 +0000

    zfs: cherry-pick change from openzfs
    
    Vendor PR:
      #16210 FreeBSD: Add const qualifier to members of struct
             opensolaris_utsname
    
    Obtained from:  OpenZFS
    OpenZFS commit: e2357561b9499296bff758afe4868dbc39735675
    
    Note: this is required by the following up MFC [1]. No functional change.
    
    1. 356be1348dac kernel: Make some compile time constant variables const
---
 sys/contrib/openzfs/include/os/freebsd/spl/sys/misc.h | 10 +++++-----
 sys/contrib/openzfs/module/os/freebsd/spl/spl_misc.c  |  7 +++----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/misc.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/misc.h
index 3481507d2c33..1c777f5fb91e 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/misc.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/misc.h
@@ -45,11 +45,11 @@
 #define	F_SEEK_HOLE	FIOSEEKHOLE
 
 struct opensolaris_utsname {
-	char	*sysname;
-	char	*nodename;
-	char	*release;
-	char	version[32];
-	char	*machine;
+	const char	*sysname;
+	const char	*nodename;
+	const char	*release;
+	char		version[32];
+	const char	*machine;
 };
 
 extern char hw_serial[11];
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_misc.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_misc.c
index 0354b986cd5f..0bd7764082b3 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_misc.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_misc.c
@@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/zfs_context.h>
 
 static struct opensolaris_utsname hw_utsname = {
+	.sysname = ostype,
+	.nodename = prison0.pr_hostname,
+	.release = osrelease,
 	.machine = MACHINE
 };
 
@@ -56,10 +59,6 @@ utsname(void)
 static void
 opensolaris_utsname_init(void *arg)
 {
-
-	hw_utsname.sysname = ostype;
-	hw_utsname.nodename = prison0.pr_hostname;
-	hw_utsname.release = osrelease;
 	snprintf(hw_utsname.version, sizeof (hw_utsname.version),
 	    "%d", osreldate);
 }