aboutsummaryrefslogtreecommitdiffstats
path: root/module/spl/spl-proc.c
diff options
context:
space:
mode:
authorDarik Horn <[email protected]>2011-04-11 14:49:50 -0500
committerBrian Behlendorf <[email protected]>2011-04-21 09:41:01 -0700
commitfa6f7d8f9d4760975ea5fe116a7366604f286195 (patch)
tree7089dfa04e86d507330ee7e67e30014ded19e2ab /module/spl/spl-proc.c
parent3dfc591ac4003d1c92159b5dfe8970f24e008f81 (diff)
Import spl_hostid as a module parameter.
Provide a call_usermodehelper() alternative by letting the hostid be passed as a module parameter like this: $ modprobe spl spl_hostid=0x12345678 Internally change the spl_hostid variable to unsigned long because that is the type that the coreutils /usr/bin/hostid returns. Move the hostid command into GET_HOSTID_CMD for consistency with the similar GET_KALLSYMS_ADDR_CMD invocation. Use argv[0] instead of sh_path for consistency internally and with other Linux drivers. Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module/spl/spl-proc.c')
-rw-r--r--module/spl/spl-proc.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c
index d2b295ce0..fa0d1fb3d 100644
--- a/module/spl/spl-proc.c
+++ b/module/spl/spl-proc.c
@@ -487,7 +487,6 @@ SPL_PROC_HANDLER(proc_doslab)
SPL_PROC_HANDLER(proc_dohostid)
{
int len, rc = 0;
- int32_t val;
char *end, str[32];
SENTRY;
@@ -499,17 +498,15 @@ SPL_PROC_HANDLER(proc_dohostid)
if (rc < 0)
SRETURN(rc);
- val = simple_strtol(str, &end, 16);
+ spl_hostid = simple_strtoul(str, &end, 16);
if (str == end)
SRETURN(-EINVAL);
- spl_hostid = (long) val;
- (void) snprintf(hw_serial, HW_HOSTID_LEN, "%u",
- (val >= 0) ? val : -val);
+ (void) snprintf(hw_serial, HW_HOSTID_LEN, "%lu", spl_hostid);
hw_serial[HW_HOSTID_LEN - 1] = '\0';
*ppos += *lenp;
} else {
- len = snprintf(str, sizeof(str), "%lx", spl_hostid);
+ len = snprintf(str, sizeof(str), "%lux", spl_hostid);
if (*ppos >= len)
rc = 0;
else