FreeBSD: Add const qualifier to members of struct opensolaris_utsname

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
This commit is contained in:
Zhenlei Huang 2024-05-31 00:58:20 +08:00 committed by GitHub
parent 5137c132a5
commit e2357561b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 9 deletions

View File

@ -45,11 +45,11 @@
#define F_SEEK_HOLE FIOSEEKHOLE #define F_SEEK_HOLE FIOSEEKHOLE
struct opensolaris_utsname { struct opensolaris_utsname {
char *sysname; const char *sysname;
char *nodename; const char *nodename;
char *release; const char *release;
char version[32]; char version[32];
char *machine; const char *machine;
}; };
#define task_io_account_read(n) #define task_io_account_read(n)

View File

@ -37,6 +37,9 @@
#include <sys/zfs_context.h> #include <sys/zfs_context.h>
static struct opensolaris_utsname hw_utsname = { static struct opensolaris_utsname hw_utsname = {
.sysname = ostype,
.nodename = prison0.pr_hostname,
.release = osrelease,
.machine = MACHINE .machine = MACHINE
}; };
@ -49,10 +52,6 @@ utsname(void)
static void static void
opensolaris_utsname_init(void *arg) 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), snprintf(hw_utsname.version, sizeof (hw_utsname.version),
"%d", osreldate); "%d", osreldate);
} }