summaryrefslogtreecommitdiffstats
path: root/modules/spl/spl-generic.c
blob: cae4223f33bf362879b7eb6beb3db2281de859fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <sys/sysmacros.h>
#include <sys/vmsystm.h>
#include <sys/vnode.h>
#include "config.h"

/*
 * Generic support
 */

int p0 = 0;
EXPORT_SYMBOL(p0);

char hw_serial[11];
EXPORT_SYMBOL(hw_serial);

vmem_t *zio_alloc_arena = NULL;
EXPORT_SYMBOL(zio_alloc_arena);

int
highbit(unsigned long i)
{
        register int h = 1;

        if (i == 0)
                return (0);
#if BITS_PER_LONG == 64
        if (i & 0xffffffff00000000ul) {
                h += 32; i >>= 32;
        }
#endif
        if (i & 0xffff0000) {
                h += 16; i >>= 16;
        }
        if (i & 0xff00) {
                h += 8; i >>= 8;
        }
        if (i & 0xf0) {
                h += 4; i >>= 4;
        }
        if (i & 0xc) {
                h += 2; i >>= 2;
        }
        if (i & 0x2) {
                h += 1;
        }
        return (h);
}
EXPORT_SYMBOL(highbit);

int
ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result)
{
        char *end;
        return (*result = simple_strtoul(str, &end, base));
}
EXPORT_SYMBOL(ddi_strtoul);

static int __init spl_init(void)
{
	int rc;

	rc = vn_init();
	if (rc)
		return rc;

	strcpy(hw_serial, "007f0100"); /* loopback */
        printk(KERN_INFO "spl: Loaded Solaris Porting Layer v%s\n", VERSION);

	return 0;
}

static void spl_fini(void)
{
	vn_fini();
	return;
}

module_init(spl_init);
module_exit(spl_fini);

MODULE_AUTHOR("Lawrence Livermore National Labs");
MODULE_DESCRIPTION("Solaris Porting Layer");
MODULE_LICENSE("GPL");