aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/os/freebsd/spl/sys/misc.h2
-rw-r--r--include/os/freebsd/spl/sys/sunddi.h1
-rw-r--r--include/os/linux/spl/sys/sunddi.h1
-rw-r--r--include/sys/zfs_context.h4
-rw-r--r--lib/libzpool/kernel.c19
-rw-r--r--module/os/freebsd/spl/spl_misc.c4
-rw-r--r--module/os/freebsd/spl/spl_sunddi.c13
-rw-r--r--module/os/linux/spl/spl-generic.c12
8 files changed, 9 insertions, 47 deletions
diff --git a/include/os/freebsd/spl/sys/misc.h b/include/os/freebsd/spl/sys/misc.h
index 3481507d2..2e4efc605 100644
--- a/include/os/freebsd/spl/sys/misc.h
+++ b/include/os/freebsd/spl/sys/misc.h
@@ -52,8 +52,6 @@ struct opensolaris_utsname {
char *machine;
};
-extern char hw_serial[11];
-
#define task_io_account_read(n)
#define task_io_account_write(n)
diff --git a/include/os/freebsd/spl/sys/sunddi.h b/include/os/freebsd/spl/sys/sunddi.h
index bfbc3e10a..28d40121d 100644
--- a/include/os/freebsd/spl/sys/sunddi.h
+++ b/include/os/freebsd/spl/sys/sunddi.h
@@ -48,7 +48,6 @@ typedef int ddi_devid_t;
#define ddi_prop_free(x) (void)0
#define ddi_root_node() (void)0
-extern int ddi_strtoul(const char *, char **, int, unsigned long *);
extern int ddi_strtol(const char *, char **, int, long *);
extern int ddi_strtoull(const char *, char **, int, unsigned long long *);
extern int ddi_strtoll(const char *, char **, int, long long *);
diff --git a/include/os/linux/spl/sys/sunddi.h b/include/os/linux/spl/sys/sunddi.h
index 8524ec9c3..df6a204d5 100644
--- a/include/os/linux/spl/sys/sunddi.h
+++ b/include/os/linux/spl/sys/sunddi.h
@@ -46,7 +46,6 @@ typedef int ddi_devid_t;
#define ddi_prop_free(x) (void)0
#define ddi_root_node() (void)0
-extern int ddi_strtoul(const char *, char **, int, unsigned long *);
extern int ddi_strtol(const char *, char **, int, long *);
extern int ddi_strtoull(const char *, char **, int, unsigned long long *);
extern int ddi_strtoll(const char *, char **, int, long long *);
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index 944acdcfb..50257f1d6 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -692,10 +692,6 @@ extern char *kmem_asprintf(const char *fmt, ...);
/*
* Hostname information
*/
-extern char hw_serial[]; /* for userland-emulated hostid access */
-extern int ddi_strtoul(const char *str, char **nptr, int base,
- unsigned long *result);
-
extern int ddi_strtoull(const char *str, char **nptr, int base,
u_longlong_t *result);
diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c
index 89151f70e..011f9d211 100644
--- a/lib/libzpool/kernel.c
+++ b/lib/libzpool/kernel.c
@@ -53,7 +53,7 @@
*/
uint64_t physmem;
-char hw_serial[HW_HOSTID_LEN];
+uint32_t hostid;
struct utsname hw_utsname;
/* If set, all blocks read will be copied to the specified directory. */
@@ -299,7 +299,7 @@ zone_get_hostid(void *zonep)
* We're emulating the system's hostid in userland.
*/
(void) zonep;
- return (strtoul(hw_serial, NULL, 10));
+ return (hostid);
}
int
@@ -767,18 +767,6 @@ random_get_pseudo_bytes(uint8_t *ptr, size_t len)
}
int
-ddi_strtoul(const char *hw_serial, char **nptr, int base, unsigned long *result)
-{
- (void) nptr;
- char *end;
-
- *result = strtoul(hw_serial, &end, base);
- if (*result == 0)
- return (errno);
- return (0);
-}
-
-int
ddi_strtoull(const char *str, char **nptr, int base, u_longlong_t *result)
{
(void) nptr;
@@ -823,8 +811,7 @@ kernel_init(int mode)
dprintf("physmem = %llu pages (%.2f GB)\n", (u_longlong_t)physmem,
(double)physmem * sysconf(_SC_PAGE_SIZE) / (1ULL << 30));
- (void) snprintf(hw_serial, sizeof (hw_serial), "%ld",
- (mode & SPA_MODE_WRITE) ? get_system_hostid() : 0);
+ hostid = (mode & SPA_MODE_WRITE) ? get_system_hostid() : 0;
random_init();
diff --git a/module/os/freebsd/spl/spl_misc.c b/module/os/freebsd/spl/spl_misc.c
index 0354b986c..e46271a03 100644
--- a/module/os/freebsd/spl/spl_misc.c
+++ b/module/os/freebsd/spl/spl_misc.c
@@ -43,15 +43,11 @@ static struct opensolaris_utsname hw_utsname = {
.machine = MACHINE
};
-#ifndef KERNEL_STATIC
-char hw_serial[11] = "0";
-
utsname_t *
utsname(void)
{
return (&hw_utsname);
}
-#endif
static void
opensolaris_utsname_init(void *arg)
diff --git a/module/os/freebsd/spl/spl_sunddi.c b/module/os/freebsd/spl/spl_sunddi.c
index ebec77bdb..2a3c027c9 100644
--- a/module/os/freebsd/spl/spl_sunddi.c
+++ b/module/os/freebsd/spl/spl_sunddi.c
@@ -46,19 +46,6 @@ ddi_strtol(const char *str, char **nptr, int base, long *result)
}
int
-ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result)
-{
-
- if (str == hw_serial) {
- *result = prison0.pr_hostid;
- return (0);
- }
-
- *result = strtoul(str, nptr, base);
- return (0);
-}
-
-int
ddi_strtoull(const char *str, char **nptr, int base, unsigned long long *result)
{
diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c
index 143f34598..6fa564b85 100644
--- a/module/os/linux/spl/spl-generic.c
+++ b/module/os/linux/spl/spl-generic.c
@@ -425,13 +425,13 @@ EXPORT_SYMBOL(__aeabi_ldivmod);
* functions against their Solaris counterparts. It is possible that I
* may have misinterpreted the man page or the man page is incorrect.
*/
-int ddi_strtoul(const char *, char **, int, unsigned long *);
+static int ddi_strtoul(const char *, char **, int, unsigned long *);
int ddi_strtol(const char *, char **, int, long *);
int ddi_strtoull(const char *, char **, int, unsigned long long *);
int ddi_strtoll(const char *, char **, int, long long *);
-#define define_ddi_strtoux(type, valtype) \
-int ddi_strtou##type(const char *str, char **endptr, \
+#define define_ddi_strtoux(type, valtype, ...) \
+__VA_ARGS__ int ddi_strtou##type(const char *str, char **endptr, \
int base, valtype *result) \
{ \
valtype last_value, value = 0; \
@@ -508,12 +508,12 @@ int ddi_strto##type(const char *str, char **endptr, \
return (rc); \
}
-define_ddi_strtoux(l, unsigned long)
+#define blank
+define_ddi_strtoux(l, unsigned long, static)
define_ddi_strtox(l, long)
-define_ddi_strtoux(ll, unsigned long long)
+define_ddi_strtoux(ll, unsigned long long, blank)
define_ddi_strtox(ll, long long)
-EXPORT_SYMBOL(ddi_strtoul);
EXPORT_SYMBOL(ddi_strtol);
EXPORT_SYMBOL(ddi_strtoll);
EXPORT_SYMBOL(ddi_strtoull);