#include <linux/sysctl.h>
#include <linux/seq_file.h>
#include <sys/sysmacros.h>
+#include <sys/systeminfo.h>
#include <sys/kmem.h>
#include <sys/mutex.h>
#include <sys/kstat.h>
/* Missing misc functions */
extern int highbit(unsigned long i);
+extern uint32_t zone_get_hostid(void *zone);
#define makedevice(maj,min) makedev(maj,min)
#ifndef _SPL_SYSTEMINFO_H
#define _SPL_SYSTEMINFO_H
+#define HW_INVALID_HOSTID 0xFFFFFFFF /* an invalid hostid */
+#define HW_HOSTID_LEN 11 /* minimum buffer size needed */
+ /* to hold a decimal or hex */
+ /* hostid string */
+
#endif /* SPL_SYSTEMINFO_H */
*/
#include <sys/sysmacros.h>
+#include <sys/systeminfo.h>
#include <sys/vmsystm.h>
#include <sys/vnode.h>
#include <sys/kmem.h>
long spl_hostid = 0;
EXPORT_SYMBOL(spl_hostid);
-char hw_serial[11] = "<none>";
+char hw_serial[HW_HOSTID_LEN] = "<none>";
EXPORT_SYMBOL(hw_serial);
int p0 = 0;
return call_usermodehelper(sh_path, argv, envp, 1);
}
+uint32_t
+zone_get_hostid(void *zone)
+{
+ unsigned long hostid;
+
+ /* Only the global zone is supported */
+ ASSERT(zone == NULL);
+
+ if (ddi_strtoul(hw_serial, NULL, HW_HOSTID_LEN-1, &hostid) != 0)
+ return HW_INVALID_HOSTID;
+
+ return (uint32_t)hostid;
+}
+EXPORT_SYMBOL(zone_get_hostid);
+
static int __init spl_init(void)
{
int rc = 0;
RETURN(-EINVAL);
spl_hostid = (long)val;
- (void)snprintf(hw_serial, 11, "%u", (val >= 0) ? val : -val);
+ (void)snprintf(hw_serial, HW_HOSTID_LEN-1, "%u",
+ (val >= 0) ? val : -val);
*ppos += *lenp;
} else {
len = snprintf(str, sizeof(str), "%lx", spl_hostid);