Remove hw_serial, ddi_strtoul()
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13434
This commit is contained in:
parent
0c11a2738d
commit
c25b281378
@ -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)
|
||||
|
||||
|
@ -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 *);
|
||||
|
@ -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 *);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
@ -766,18 +766,6 @@ random_get_pseudo_bytes(uint8_t *ptr, size_t len)
|
||||
return (random_get_bytes_common(ptr, len, urandom_fd));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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();
|
||||
|
||||
|
@ -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)
|
||||
|
@ -45,19 +45,6 @@ ddi_strtol(const char *str, char **nptr, int base, long *result)
|
||||
return (0);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user