aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sys/kstat.h16
-rw-r--r--include/sys/sysmacros.h8
-rw-r--r--include/sys/thread.h7
-rw-r--r--include/sys/vmsystm.h34
-rw-r--r--modules/spl/spl-generic.c31
-rw-r--r--modules/spl/spl-thread.c2
-rw-r--r--modules/splat/splat-thread.c2
7 files changed, 88 insertions, 12 deletions
diff --git a/include/sys/kstat.h b/include/sys/kstat.h
index dea7987f5..0b6ce0583 100644
--- a/include/sys/kstat.h
+++ b/include/sys/kstat.h
@@ -131,7 +131,21 @@ kstat_delete(kstat_t *ksp)
}
/* FIXME - NONE OF THIS IS ATOMIC, IT SHOULD BE. For the moment this is
- * OK since it is only used for the noncritical kstat counters */
+ * OK since it is only used for the noncritical kstat counters, and we
+ * are only doing testing on x86_86 platform where the entire counter
+ * will be updated with one instruction. */
+static __inline__ void
+atomic_inc_64(volatile uint64_t *target)
+{
+ (*target)++;
+}
+
+static __inline__ void
+atomic_dec_64(volatile uint64_t *target)
+{
+ (*target)--;
+}
+
static __inline__ uint64_t
atomic_add_64(volatile uint64_t *target, uint64_t delta)
{
diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
index 65070d858..1927a060d 100644
--- a/include/sys/sysmacros.h
+++ b/include/sys/sysmacros.h
@@ -64,7 +64,7 @@ extern "C" {
#define bzero(ptr,size) memset(ptr,0,size)
#define bcopy(src,dest,size) memcpy(dest,src,size)
#define ASSERT(x) BUG_ON(!(x))
-#define VERIFY(x)
+#define VERIFY(x) ASSERT(x)
#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
const TYPE __left = (TYPE)(LEFT); \
@@ -103,10 +103,12 @@ extern "C" {
#endif /* DTRACE_PROBE4 */
#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0)
-/* Missing globals
- */
+/* Missing globals */
extern int p0;
+/* Missing misc functions */
+extern int highbit(unsigned long i);
+
#define makedevice(maj,min) makedev(maj,min)
/* XXX - Borrowed from zfs project libsolcompat/include/sys/sysmacros.h */
diff --git a/include/sys/thread.h b/include/sys/thread.h
index d1009ab6d..4532aee5b 100644
--- a/include/sys/thread.h
+++ b/include/sys/thread.h
@@ -31,14 +31,9 @@ extern "C" {
#define thread_exit() __thread_exit()
#define curthread get_current()
-/* We just need a valid type to pass around, it's unused */
-typedef struct proc_s {
- int foo;
-} proc_t;
-
extern kthread_t *__thread_create(caddr_t stk, size_t stksize,
void (*proc)(void *), void *args,
- size_t len, proc_t *pp, int state,
+ size_t len, int *pp, int state,
pri_t pri);
extern void __thread_exit(void);
diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h
index 5d1c385b0..e66872f0c 100644
--- a/include/sys/vmsystm.h
+++ b/include/sys/vmsystm.h
@@ -4,5 +4,39 @@
#include <linux/mm.h>
#define physmem num_physpages
+#define ptob(pages) (pages * PAGE_SIZE)
+#define membar_producer() smp_wmb()
+
+#if 0
+/* The approximate total number of free pages */
+#define freemem 0
+
+/* The average number of free pages over the last 5 seconds */
+#define avefree 0
+
+/* The average number of free pages over the last 30 seconds */
+#define avefree30 0
+
+/* A guess as to how much memory has been promised to
+ * processes but not yet allocated */
+#define deficit 0
+
+/* A guess as to how many page are needed to satisfy
+ * stalled page creation requests */
+#define needfree 0
+
+/* A bootlean the controls the setting of deficit */
+#define desperate
+
+/* When free memory is above this limit, no paging or swapping is done */
+#define lotsfree 0
+
+/* When free memory is above this limit, swapping is not performed */
+#define desfree 0
+
+/* Threshold for many low memory tests, e.g. swapping is
+ * more active below this limit */
+#define minfree 0
+#endif
#endif /* SPL_VMSYSTM_H */
diff --git a/modules/spl/spl-generic.c b/modules/spl/spl-generic.c
index 60bebfdc4..1f982f8bd 100644
--- a/modules/spl/spl-generic.c
+++ b/modules/spl/spl-generic.c
@@ -8,6 +8,37 @@
int p0 = 0;
EXPORT_SYMBOL(p0);
+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);
+
static int __init spl_init(void)
{
printk(KERN_INFO "spl: Loaded Solaris Porting Layer v%s\n", VERSION);
diff --git a/modules/spl/spl-thread.c b/modules/spl/spl-thread.c
index 40b1b316f..e6dca2300 100644
--- a/modules/spl/spl-thread.c
+++ b/modules/spl/spl-thread.c
@@ -60,7 +60,7 @@ EXPORT_SYMBOL(__thread_exit);
* style callers likely never check for... since it can't fail. */
kthread_t *
__thread_create(caddr_t stk, size_t stksize, void (*proc)(void *),
- void *args, size_t len, proc_t *pp, int state, pri_t pri)
+ void *args, size_t len, int *pp, int state, pri_t pri)
{
thread_priv_t tp;
DEFINE_WAIT(wait);
diff --git a/modules/splat/splat-thread.c b/modules/splat/splat-thread.c
index aff18cd5f..dec251efe 100644
--- a/modules/splat/splat-thread.c
+++ b/modules/splat/splat-thread.c
@@ -51,7 +51,7 @@ splat_thread_test1(struct file *file, void *arg)
spin_lock(&tp.tp_lock);
thr = (kthread_t *)thread_create(NULL, 0, splat_thread_work, &tp, 0,
- (proc_t *) &p0, TS_RUN, minclsyspri);
+ &p0, TS_RUN, minclsyspri);
/* Must never fail under Solaris, but we check anyway so we can
* report an error when this impossible thing happens */
if (thr == NULL) {