mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-03-11 04:46:18 +03:00
libspl: move utsname() etc to sys/misc.h; initialise in libspl_init()
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17861
This commit is contained in:
parent
6cf6f091cf
commit
daff6b7e35
@ -113,7 +113,6 @@ extern "C" {
|
|||||||
#include <sys/sysevent/eventdefs.h>
|
#include <sys/sysevent/eventdefs.h>
|
||||||
#include <sys/sunddi.h>
|
#include <sys/sunddi.h>
|
||||||
#include <sys/debug.h>
|
#include <sys/debug.h>
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <sys/trace_zfs.h>
|
#include <sys/trace_zfs.h>
|
||||||
|
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
@ -131,6 +130,7 @@ extern "C" {
|
|||||||
#include <sys/callb.h>
|
#include <sys/callb.h>
|
||||||
#include <sys/trace.h>
|
#include <sys/trace.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
#include <sys/misc.h>
|
||||||
|
|
||||||
#include <sys/zfs_context_os.h>
|
#include <sys/zfs_context_os.h>
|
||||||
|
|
||||||
@ -267,9 +267,6 @@ extern uint32_t zone_get_hostid(void *zonep);
|
|||||||
extern int ddi_strtoull(const char *str, char **nptr, int base,
|
extern int ddi_strtoull(const char *str, char **nptr, int base,
|
||||||
u_longlong_t *result);
|
u_longlong_t *result);
|
||||||
|
|
||||||
typedef struct utsname utsname_t;
|
|
||||||
extern utsname_t *utsname(void);
|
|
||||||
|
|
||||||
/* ZFS Boot Related stuff. */
|
/* ZFS Boot Related stuff. */
|
||||||
|
|
||||||
struct _buf {
|
struct _buf {
|
||||||
|
|||||||
@ -43,6 +43,7 @@ libspl_sys_HEADERS = \
|
|||||||
%D%/sys/kstat.h \
|
%D%/sys/kstat.h \
|
||||||
%D%/sys/list.h \
|
%D%/sys/list.h \
|
||||||
%D%/sys/list_impl.h \
|
%D%/sys/list_impl.h \
|
||||||
|
%D%/sys/misc.h \
|
||||||
%D%/sys/mhd.h \
|
%D%/sys/mhd.h \
|
||||||
%D%/sys/mkdev.h \
|
%D%/sys/mkdev.h \
|
||||||
%D%/sys/mod.h \
|
%D%/sys/mod.h \
|
||||||
|
|||||||
40
lib/libspl/include/sys/misc.h
Normal file
40
lib/libspl/include/sys/misc.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// SPDX-License-Identifier: CDDL-1.0
|
||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or https://opensource.org/licenses/CDDL-1.0.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
||||||
|
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
|
||||||
|
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LIBSPL_SYS_MISC_H
|
||||||
|
#define _LIBSPL_SYS_MISC_H
|
||||||
|
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hostname information
|
||||||
|
*/
|
||||||
|
typedef struct utsname utsname_t;
|
||||||
|
extern utsname_t *utsname(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -28,14 +28,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libspl.h>
|
#include <libspl.h>
|
||||||
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/misc.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
uint64_t physmem;
|
uint64_t physmem;
|
||||||
|
struct utsname hw_utsname;
|
||||||
|
|
||||||
|
utsname_t *
|
||||||
|
utsname(void)
|
||||||
|
{
|
||||||
|
return (&hw_utsname);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
libspl_init(void)
|
libspl_init(void)
|
||||||
{
|
{
|
||||||
physmem = sysconf(_SC_PHYS_PAGES);
|
physmem = sysconf(_SC_PHYS_PAGES);
|
||||||
|
|
||||||
|
VERIFY0(uname(&hw_utsname));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@ -44,7 +44,6 @@
|
|||||||
#include <sys/systeminfo.h>
|
#include <sys/systeminfo.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/tsd.h>
|
#include <sys/tsd.h>
|
||||||
#include <sys/utsname.h>
|
|
||||||
|
|
||||||
#include <libspl.h>
|
#include <libspl.h>
|
||||||
#include <libzpool.h>
|
#include <libzpool.h>
|
||||||
@ -61,7 +60,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
uint32_t hostid;
|
uint32_t hostid;
|
||||||
struct utsname hw_utsname;
|
|
||||||
|
|
||||||
/* If set, all blocks read will be copied to the specified directory. */
|
/* If set, all blocks read will be copied to the specified directory. */
|
||||||
char *vn_dumpdir = NULL;
|
char *vn_dumpdir = NULL;
|
||||||
@ -405,12 +403,6 @@ ddi_strtoull(const char *str, char **nptr, int base, u_longlong_t *result)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
utsname_t *
|
|
||||||
utsname(void)
|
|
||||||
{
|
|
||||||
return (&hw_utsname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* =========================================================================
|
* =========================================================================
|
||||||
* kernel emulation setup & teardown
|
* kernel emulation setup & teardown
|
||||||
@ -515,8 +507,6 @@ kernel_init(int mode)
|
|||||||
|
|
||||||
random_init();
|
random_init();
|
||||||
|
|
||||||
VERIFY0(uname(&hw_utsname));
|
|
||||||
|
|
||||||
system_taskq_init();
|
system_taskq_init();
|
||||||
icp_init();
|
icp_init();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user