diff options
author | pjd <pjd@FreeBSD.org> | 2007-04-08 16:29:25 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-04-08 16:29:25 +0000 |
commit | 2b260dcd5e356a3d85c66dff3715260105c412f7 (patch) | |
tree | 414979d8bf91ece25474dc6b933621fc94bb051b /cddl/contrib/opensolaris/lib/libzpool/common/kernel.c | |
parent | 4b06e89211feda93bee19a93c165c0d4b9911622 (diff) | |
download | FreeBSD-src-2b260dcd5e356a3d85c66dff3715260105c412f7.zip FreeBSD-src-2b260dcd5e356a3d85c66dff3715260105c412f7.tar.gz |
MFp4: Synchronize with recent OpenSolaris changes.
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libzpool/common/kernel.c')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzpool/common/kernel.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c b/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c index 086f33e..1fafe5f 100644 --- a/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c +++ b/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c @@ -37,6 +37,7 @@ #include <sys/processor.h> #include <sys/zfs_context.h> #include <sys/zmod.h> +#include <sys/utsname.h> /* * Emulation of kernel services in userland. @@ -45,6 +46,11 @@ int hz = 119; /* frequency when using gethrtime() >> 23 for lbolt */ uint64_t physmem; vnode_t *rootdir = (vnode_t *)0xabcd1234; +char hw_serial[11]; + +struct utsname utsname = { + "userland", "libzpool", "1", "1", "na" +}; /* * ========================================================================= @@ -770,6 +776,17 @@ random_get_pseudo_bytes(uint8_t *ptr, size_t len) return (random_get_bytes_common(ptr, len, "/dev/urandom")); } +int +ddi_strtoul(const char *hw_serial, char **nptr, int base, unsigned long *result) +{ + char *end; + + *result = strtoul(hw_serial, &end, base); + if (*result == 0) + return (errno); + return (0); +} + /* * ========================================================================= * kernel emulation setup & teardown @@ -795,6 +812,8 @@ kernel_init(int mode) dprintf("physmem = %llu pages (%.2f GB)\n", physmem, (double)physmem * sysconf(_SC_PAGE_SIZE) / (1ULL << 30)); + snprintf(hw_serial, sizeof (hw_serial), "%ld", gethostid()); + spa_init(mode); } |