]> git.proxmox.com Git - mirror_zfs.git/commitdiff
FreeBSD: Add const qualifier to members of struct opensolaris_utsname
authorZhenlei Huang <zlei.huang@gmail.com>
Thu, 30 May 2024 16:58:20 +0000 (00:58 +0800)
committerGitHub <noreply@github.com>
Thu, 30 May 2024 16:58:20 +0000 (09:58 -0700)
These members have directly references to the global variables
exposed by the kernel. They are not going to be changed by this
kernel module.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Zhenlei Huang <zlei@FreeBSD.org>
Closes #16210

include/os/freebsd/spl/sys/misc.h
module/os/freebsd/spl/spl_misc.c

index 2e4efc60544a78119008efedfad25e97aa17529f..894ccd8bf9b1b2e84d1d5c00e531c70d79880928 100644 (file)
 #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;
 };
 
 #define        task_io_account_read(n)
index a5fc996b6550068f03d854c1677224c2d54fb842..2d0821417ad94ae025620b21472a43836dc94939 100644 (file)
@@ -37,6 +37,9 @@
 #include <sys/zfs_context.h>
 
 static struct opensolaris_utsname hw_utsname = {
+       .sysname = ostype,
+       .nodename = prison0.pr_hostname,
+       .release = osrelease,
        .machine = MACHINE
 };
 
@@ -49,10 +52,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);
 }