]> git.proxmox.com Git - mirror_spl.git/commitdiff
Lots of build fixes. This is turning out to be a very good
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Wed, 27 Feb 2008 19:09:51 +0000 (19:09 +0000)
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Wed, 27 Feb 2008 19:09:51 +0000 (19:09 +0000)
idea since it forcefully codifing the ABI.  Since the shim
layer is no longer linked at build time in to the test suite
we can;'t cut any corners and get away with it.

Everything is working now with the exception of sorting
setting Module.symvers properly.  This may take a little
Makefile reorg.

git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@5 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c

30 files changed:
include/linux-callb.h
include/linux-condvar.h
include/linux-cred.h
include/linux-generic.h
include/linux-kmem.h
include/linux-kstat.h
include/linux-mutex.h
include/linux-random.h
include/linux-rwlock.h
include/linux-taskq.h
include/linux-thread.h
include/linux-time.h
include/linux-timer.h
include/linux-types.h
include/splat-ctl.h
src/spl/Makefile.in
src/spl/linux-generic.c [new file with mode: 0644]
src/spl/linux-kmem.c
src/spl/linux-rwlock.c
src/spl/linux-taskq.c
src/spl/linux-thread.c
src/splat/splat-condvar.c
src/splat/splat-ctl.c
src/splat/splat-kmem.c
src/splat/splat-mutex.c
src/splat/splat-random.c
src/splat/splat-rwlock.c
src/splat/splat-taskq.c
src/splat/splat-thread.c
src/splat/splat-time.c

index 6ffcfb76ed64ae75592508425aa6e14487efd1c7..0a34ad2cfa0761ef6fcfe36bfc2434ab4a01c4bf 100644 (file)
@@ -1,10 +1,11 @@
-#ifndef _LINUX_CALLB_H
-#define _LINUX_CALLB_H
+#ifndef _SOLARIS_CALLB_H
+#define _SOLARIS_CALLB_H
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
+#include <linux/module.h>
 #include <linux-mutex.h>
 
 #define DEBUG_CALLB
@@ -41,5 +42,5 @@ typedef struct callb_cpr {
 }
 #endif
 
-#endif  /* _LINUX_CALLB_H */
+#endif  /* _SOLARIS_CALLB_H */
 
index e4a1779a5349f345ca8bd26e1c8f542f9d92b74a..8f5cb922a5834e9b4a6eded6ef327c0f5e7f7da3 100644 (file)
@@ -1,10 +1,11 @@
-#ifndef _LINUX_CONDVAR_H
-#define _LINUX_CONDVAR_H
+#ifndef _SOLARIS_CONDVAR_H
+#define _SOLARIS_CONDVAR_H
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
+#include <linux/module.h>
 #include <linux/wait.h>
 
 /* The kcondvar_t struct is protected by mutex taken externally before
@@ -198,4 +199,4 @@ cv_broadcast(kcondvar_t *cvp)
        if (atomic_read(&cvp->cv_waiters) > 0)
                wake_up_all(&cvp->cv_event);
 }
-#endif /* _LINUX_CONDVAR_H */
+#endif /* _SOLARIS_CONDVAR_H */
index d342aa016df89e5d79d89d74215352946ce69737..946810d5e1233d4902494edb003c16730eea8a66 100644 (file)
@@ -1,10 +1,11 @@
-#ifndef _LINUX_CRED_H
-#define _LINUX_CRED_H
+#ifndef _SOLARIS_CRED_H
+#define _SOLARIS_CRED_H
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
+#include <linux/module.h>
 #include <linux/types.h>
 
 /* XXX - Portions commented out because we really just want to have the type
@@ -36,5 +37,5 @@ typedef struct cred {
 }
 #endif
 
-#endif  /* _LINUX_CRED_H */
+#endif  /* _SOLARIS_CRED_H */
 
index e36baef0efab5f88b1c54a8e64313d87dd5f4b45..ee77cba573f0bbda9f4fd840aa258a1c0a7a16dd 100644 (file)
@@ -1,10 +1,12 @@
-#ifndef _LINUX_GENERIC_H
-#define _LINUX_GENERIC_H
+#ifndef _SOLARIS_GENERIC_H
+#define _SOLARIS_GENERIC_H
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
+#include <linux/module.h>
+
 /* Missing defines.
  */
 #define INT32_MAX                       INT_MAX
@@ -14,7 +16,7 @@ extern "C" {
 #define MAXNAMELEN                      256
 #define MAXPATHLEN                      PATH_MAX
 #define __va_list                       va_list
-#define _KERNEL                         1
+#define _KERNEL                         __KERNEL__
 #define max_ncpus                       64
 
 /* 0..MAX_PRIO-1:              Process priority
@@ -63,10 +65,10 @@ extern "C" {
 
 /* Missing globals
  */
-static int p0 = 0;
+extern int p0;
 
 #ifdef  __cplusplus
 }
 #endif
 
-#endif  /* _LINUX_GENERIC_H */
+#endif  /* _SOLARIS_GENERIC_H */
index f08590d1d2d0c70459bb226555095a046c97e718..3025e1a97d8d18ed736ab794c63d621df39c1f2a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _LINUX_KMEM_H
-#define        _LINUX_KMEM_H
+#ifndef _SOLARIS_KMEM_H
+#define        _SOLARIS_KMEM_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -8,6 +8,7 @@ extern "C" {
 #undef DEBUG_KMEM
 #undef DEBUG_KMEM_UNIMPLEMENTED
 
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
 #include <linux/spinlock.h>
@@ -147,15 +148,18 @@ typedef int (*kmem_constructor_t)(void *, void *, int);
 typedef void (*kmem_destructor_t)(void *, void *);
 typedef void (*kmem_reclaim_t)(void *);
 
-kmem_cache_t *
+extern kmem_cache_t *
 __kmem_cache_create(char *name, size_t size, size_t align,
-        int (*constructor)(void *, void *, int),
-        void (*destructor)(void *, void *),
-        void (*reclaim)(void *),
+        kmem_constructor_t constructor,
+        kmem_destructor_t destructor,
+        kmem_reclaim_t reclaim,
         void *priv, void *vmp, int flags);
 
 void
-__kmem_cache_destroy(kmem_cache_t *cache);
+extern __kmem_cache_destroy(kmem_cache_t *cache);
+
+void
+extern __kmem_reap(void);
 
 #define kmem_cache_create(name,size,align,ctor,dtor,rclm,priv,vmp,flags) \
         __kmem_cache_create(name,size,align,ctor,dtor,rclm,priv,vmp,flags)
@@ -163,11 +167,10 @@ __kmem_cache_destroy(kmem_cache_t *cache);
 #define kmem_cache_alloc(cache, flags)  kmem_cache_alloc(cache, flags)
 #define kmem_cache_free(cache, ptr)     kmem_cache_free(cache, ptr)
 #define kmem_cache_reap_now(cache)      kmem_cache_shrink(cache)
-#define kmem_reap()                    __kmem_reap()
-
+#define kmem_reap()                     __kmem_reap()
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* _LINUX_KMEM_H */
+#endif /* _SOLARIS_KMEM_H */
index 27aefdb9d6634daba7c77b113786994b9d3fee03..eb65811efeabcd9826122c05a00dfd3bb8743b32 100644 (file)
@@ -1,10 +1,11 @@
-#ifndef _LINUX_KSTAT_H
-#define _LINUX_KSTAT_H
+#ifndef _SOLARIS_KSTAT_H
+#define _SOLARIS_KSTAT_H
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
+#include <linux/module.h>
 #include <linux-types.h>
 
 /* XXX - The minimum functionality here is stubbed out but nothing works. */
@@ -132,5 +133,5 @@ kstat_delete(kstat_t *ksp)
 }
 #endif
 
-#endif  /* _LINUX_KSTAT_H */
+#endif  /* _SOLARIS_KSTAT_H */
 
index 1fea2e7d1dd4c8d55edc219d455958087a0e9ded..46406cf5951348ad2c27e4c1e54366fd92aed0fa 100644 (file)
@@ -1,10 +1,12 @@
-#ifndef _LINUX_MUTEX_H
-#define        _LINUX_MUTEX_H
+#ifndef _SOLARIS_MUTEX_H
+#define        _SOLARIS_MUTEX_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#include <linux/module.h>
+
 /* See the "Big Theory Statement" in solaris mutex.c.
  *
  * Spin mutexes apparently aren't needed by zfs so we assert
@@ -19,7 +21,7 @@ extern "C" {
 
 #define KM_MAGIC               0x42424242
 #define KM_POISON              0x84
-       
+
 typedef struct {
        int km_magic;
        char *km_name;
@@ -115,4 +117,4 @@ mutex_owner(kmutex_t *mp)
 }
 #endif
 
-#endif /* _LINUX_MUTEX_H */
+#endif /* _SOLARIS_MUTEX_H */
index 78327d0f0e44b3b697a03eb2e1641109e4cdf0a3..68ca8dde747c2f96c78dc36f4f849de7db8f2f14 100644 (file)
@@ -1,10 +1,11 @@
-#ifndef _LINUX_RANDOM_H
-#define        _LINUX_RANDOM_H
+#ifndef _SOLARIS_RANDOM_H
+#define        _SOLARIS_RANDOM_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#include <linux/module.h>
 #include <linux/random.h>
 
 /* FIXME:
@@ -34,4 +35,4 @@ random_get_pseudo_bytes(uint8_t *ptr, size_t len)
 }
 #endif
 
-#endif /* _LINUX_RANDOM_H */
+#endif /* _SOLARIS_RANDOM_H */
index 6ceafddf8640304350a25d717c745a8884547030..d212059e7e71db16cfd5245c5ef9f6d63de94fbf 100644 (file)
@@ -1,6 +1,7 @@
-#ifndef _LINUX_RWLOCK_H
-#define        _LINUX_RWLOCK_H
+#ifndef _SOLARIS_RWLOCK_H
+#define        _SOLARIS_RWLOCK_H
 
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/rwsem.h>
 #include <asm/current.h>
@@ -32,7 +33,7 @@ typedef struct {
        int rw_magic;
        char *rw_name;
        struct rw_semaphore rw_sem;
-       struct task_struct *rw_owner;   /* holder of the write lock */
+       struct task_struct *rw_owner;   /* holder of the write lock */
 } krwlock_t;
 
 static __inline__ void
@@ -196,11 +197,11 @@ rw_tryupgrade(krwlock_t *rwlp)
         * read lock and reacquire it for writing since
         * we know there are no waiters */
        up_read(&rwlp->rw_sem);
-       
+
        /* returns 1 if success, 0 if contention */
        result = down_write_trylock(&rwlp->rw_sem);
-       
-       /* Check if upgrade failed.  Should not ever happen 
+
+       /* Check if upgrade failed.  Should not ever happen
         * if we got to this point */
        BUG_ON(!result);
        BUG_ON(rwlp->rw_owner != NULL);
@@ -220,4 +221,4 @@ rw_owner(krwlock_t *rwlp)
 }
 #endif
 
-#endif /* _LINUX_RWLOCK_H */
+#endif /* _SOLARIS_RWLOCK_H */
index 9680178df5dfe906dccd59c96324cc73ec41c637..90081b25ee411603992c5a0d25b9bf20a6802f0c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _LINUX_TASKQ_H
-#define _LINUX_TASKQ_H
+#ifndef _SOLARIS_TASKQ_H
+#define _SOLARIS_TASKQ_H
 
 #ifdef  __cplusplus
 extern "C" {
@@ -19,6 +19,7 @@ extern "C" {
  * forces us to implement dynamic workqueues.  Which is all very doable
  * with a little effort.
  */
+#include <linux/module.h>
 #include <linux/workqueue.h>
 #include <linux/gfp.h>
 #include <linux/slab.h>
@@ -83,4 +84,4 @@ extern taskq_t *__taskq_create(const char *, int, pri_t, int, int, uint_t);
 }
 #endif
 
-#endif  /* _LINUX_TASKQ_H */
+#endif  /* _SOLARIS_TASKQ_H */
index a1e1296a350471bb40306532397f9c03582109bf..bcee08e476b308070d7f1fe3ecec1accecce1b31 100644 (file)
@@ -1,10 +1,11 @@
-#ifndef _LINUX_THREAD_H
-#define _LINUX_THREAD_H
+#ifndef _SOLARIS_THREAD_H
+#define _SOLARIS_THREAD_H
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
+#include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/spinlock.h>
 #include <linux-types.h>
@@ -35,14 +36,15 @@ typedef struct proc_s {
        int foo;
 } proc_t;
 
-kthread_t * __thread_create(caddr_t stk, size_t  stksize,
+extern 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);
+extern void __thread_exit(void);
 
 #ifdef  __cplusplus
 }
 #endif
 
-#endif  /* _LINUX_THREAD_H */
+#endif  /* _SOLARIS_THREAD_H */
 
index 792811c697828adae2e0f60f438e83091731cf3a..2bbc7b257c014fb3997e75bd94da3f332fb33e39 100644 (file)
@@ -1,7 +1,5 @@
-#ifndef _TIME_H
-#define _TIME_H
-
-#pragma ident   "%Z%%M% %I%     %E% SMI"        /* SVr4.0 1.16  */
+#ifndef _SOLARIS_TIME_H
+#define _SOLARIS_TIME_H
 
 /*
  * Structure returned by gettimeofday(2) system call,
@@ -12,6 +10,7 @@
 extern "C" {
 #endif
 
+#include <linux/module.h>
 #include <linux/time.h>
 #include <linux-types.h>
 
@@ -61,4 +60,4 @@ gethrestime_sec(void)
 }
 #endif
 
-#endif  /* _TIME_H */
+#endif  /* _SOLARIS_TIME_H */
index 0ff296ede89369c3a66930270904f4bc7b34c3b6..faee64755f2deb31839a7f5dd703fd9e8a38f523 100644 (file)
@@ -1,10 +1,11 @@
-#ifndef _LINUX_TIMER_H
-#define _LINUX_TIMER_H
+#ifndef _SOLARIS_TIMER_H
+#define _SOLARIS_TIMER_H
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
+#include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/timer.h>
 
@@ -17,5 +18,5 @@ extern "C" {
 }
 #endif
 
-#endif  /* _LINUX_TIMER_H */
+#endif  /* _SOLARIS_TIMER_H */
 
index af692e364ec0c3e74a982a259cc2e0ebc01927e2..d61b2f21fc5c7f41e19796f94d1e0bce15c02e22 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _LINUX_TYPES_H
-#define        _LINUX_TYPES_H
+#ifndef _SOLARIS_TYPES_H
+#define        _SOLARIS_TYPES_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -24,4 +24,4 @@ typedef short                         pri_t;
 }
 #endif
 
-#endif /* _LINUX_TYPES_H */
+#endif /* _SOLARIS_TYPES_H */
index 89b8eb7b0ea82fd8f81813db4559cb0107d3d132..5cc7158797e6717cc935f2ed534a384c7a67ebb7 100644 (file)
@@ -1,11 +1,40 @@
 #ifndef _SPLAT_CTL_H
-#define _SPLAY_CTL_H
+#define _SPLAT_CTL_H
 
-#ifdef _KERNEL
+#ifdef __KERNEL__
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+#include <linux/elf.h>
+#include <linux/limits.h>
+#include <linux/version.h>
+#include <linux/vmalloc.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/list.h>
 #include <asm/ioctls.h>
 #include <asm/uaccess.h>
-#include <linux/list.h>
-#endif /* _KERNEL */
+#include <stdarg.h>
+
+#include <linux-generic.h>
+#include <linux-types.h>
+#include <linux-kmem.h>
+#include <linux-mutex.h>
+#include <linux-condvar.h>
+#include <linux-random.h>
+#include <linux-thread.h>
+#include <linux-taskq.h>
+#include <linux-rwlock.h>
+#include <linux-timer.h>
+#include <linux-time.h>
+#include <linux-cred.h>
+#include <linux-kstat.h>
+#include <linux-callb.h>
+
+#endif /* __KERNEL__ */
 
 #define KZT_VERSION                    "v1.0"
 #define KZT_VERSION_SIZE               64
@@ -70,7 +99,7 @@ typedef struct kzt_cmd {
 #define KZT_TEST_UNKNOWN               0xFFF
 
 
-#ifdef _KERNEL
+#ifdef __KERNEL__
 #define KZT_SUBSYSTEM_INIT(type)                                        \
 ({      kzt_subsystem_t *_sub_;                                         \
                                                                         \
@@ -79,7 +108,7 @@ typedef struct kzt_cmd {
                 printk(KERN_ERR "Error initializing: " #type "\n");     \
         } else {                                                        \
                 spin_lock(&kzt_module_lock);                            \
-                list_add_tail(&(_sub_->subsystem_list),                \
+                list_add_tail(&(_sub_->subsystem_list),                \
                              &kzt_module_list);                        \
                 spin_unlock(&kzt_module_lock);                          \
         }                                                               \
@@ -92,10 +121,10 @@ typedef struct kzt_cmd {
        _id_ = kzt_##type##_id();                                       \
         spin_lock(&kzt_module_lock);                                    \
         list_for_each_entry_safe(_sub_, _tmp_,  &kzt_module_list,      \
-                                subsystem_list) {                      \
+                                subsystem_list) {                      \
                 if (_sub_->desc.id == _id_) {                           \
                         list_del_init(&(_sub_->subsystem_list));        \
-                       spin_unlock(&kzt_module_lock);                  \
+                        spin_unlock(&kzt_module_lock);                  \
                         kzt_##type##_fini(_sub_);                       \
                        spin_lock(&kzt_module_lock);                    \
                         _flag_ = 1;                                     \
@@ -128,7 +157,7 @@ typedef struct kzt_cmd {
 
 #define KZT_TEST_FINI(sub, tid)                                                \
 ({      kzt_test_t *_test_, *_tmp_;                                     \
-        int _flag_ = 0;                                                \
+        int _flag_ = 0;                                                        \
                                                                         \
         spin_lock(&((sub)->test_lock));                                        \
         list_for_each_entry_safe(_test_, _tmp_,                                \
@@ -141,7 +170,7 @@ typedef struct kzt_cmd {
         spin_unlock(&((sub)->test_lock));                              \
                                                                         \
        if (!_flag_)                                                    \
-                printk(KERN_ERR "Error finalizing: " #tid "\n");               \
+                printk(KERN_ERR "Error finalizing: " #tid "\n");       \
 })
 
 typedef int (*kzt_test_func_t)(struct file *, void *);
@@ -181,7 +210,7 @@ typedef struct kzt_info {
        spin_lock(&_info_->info_lock);                                  \
                                                                        \
        /* Don't allow the kernel to start a write in the red zone */   \
-       if ((int)(_info_->info_head - _info_->info_buffer) >            \
+       if ((int)(_info_->info_head - _info_->info_buffer) >            \
            (KZT_INFO_BUFFER_SIZE -KZT_INFO_BUFFER_REDZONE)) {          \
                _rc_ = -EOVERFLOW;                                      \
        } else {                                                        \
@@ -206,6 +235,24 @@ kzt_subsystem_t * kzt_taskq_init(void);
 kzt_subsystem_t * kzt_thread_init(void);
 kzt_subsystem_t * kzt_time_init(void);
 
-#endif /* _KERNEL */
+void kzt_condvar_fini(kzt_subsystem_t *);
+void kzt_kmem_fini(kzt_subsystem_t *);
+void kzt_mutex_fini(kzt_subsystem_t *);
+void kzt_krng_fini(kzt_subsystem_t *);
+void kzt_rwlock_fini(kzt_subsystem_t *);
+void kzt_taskq_fini(kzt_subsystem_t *);
+void kzt_thread_fini(kzt_subsystem_t *);
+void kzt_time_fini(kzt_subsystem_t *);
+
+int kzt_condvar_id(void);
+int kzt_kmem_id(void);
+int kzt_mutex_id(void);
+int kzt_krng_id(void);
+int kzt_rwlock_id(void);
+int kzt_taskq_id(void);
+int kzt_thread_id(void);
+int kzt_time_id(void);
+
+#endif /* __KERNEL__ */
 
-#endif /* _SPLAY_CTL_H */
+#endif /* _SPLAT_CTL_H */
index 2a77394d31462f8b7d0688156e2583e062650810..82b45a287ab5005cc80bf7d92c976d4730a3c5fc 100644 (file)
@@ -2,7 +2,8 @@
 
 MODULES := spl
 DISTFILES = Makefile.in \
-            linux-kmem.c linux-rwlock.c linux-taskq.c linux-thread.c
+            linux-kmem.c linux-rwlock.c linux-taskq.c \
+            linux-thread.c linux-generic.c
 CPPFLAGS += @KERNELCPPFLAGS@
 
 # Solaris porting layer module
diff --git a/src/spl/linux-generic.c b/src/spl/linux-generic.c
new file mode 100644 (file)
index 0000000..fa1ebab
--- /dev/null
@@ -0,0 +1,8 @@
+#include "linux-generic.h"
+
+/*
+ * Generic support
+ */
+
+int p0 = 0;
+EXPORT_SYMBOL(p0);
index e5ebdc17535e9d0e729a951075126eab4895341c..4dc7c01d8a4299f75115add54685a9e2e6e3c3d8 100644 (file)
@@ -172,9 +172,9 @@ kmem_cache_generic_shrinker(int nr_to_scan, unsigned int gfp_mask)
 
 kmem_cache_t *
 __kmem_cache_create(char *name, size_t size, size_t align,
-        int (*constructor)(void *, void *, int),
-        void (*destructor)(void *, void *),
-        void (*reclaim)(void *),
+        kmem_constructor_t constructor,
+       kmem_destructor_t destructor,
+       kmem_reclaim_t reclaim,
         void *priv, void *vmp, int flags)
 {
         kmem_cache_t *cache;
@@ -216,6 +216,7 @@ __kmem_cache_create(char *name, size_t size, size_t align,
 
         return cache;
 }
+EXPORT_SYMBOL(__kmem_cache_create);
 
 /* Return codes discarded because Solaris implementation has void return */
 void
@@ -239,11 +240,12 @@ __kmem_cache_destroy(kmem_cache_t *cache)
 
        spin_unlock(&kmem_cache_cb_lock);
 }
+EXPORT_SYMBOL(__kmem_cache_destroy);
 
-void 
+void
 __kmem_reap(void) {
-       /* Since there's no easy hook in to linux to force all the registered 
+       /* Since there's no easy hook in to linux to force all the registered
         * shrinkers to run we just run the ones registered for this shim */
        kmem_cache_generic_shrinker(KMC_REAP_CHUNK, GFP_KERNEL);
 }
-
+EXPORT_SYMBOL(__kmem_reap);
index e95ec15551059fe1f4def96ca419a3a7f4e99eeb..24775c4140105cf01ee04d368b084f1c77bc1c89 100644 (file)
@@ -1,4 +1,4 @@
-#include <sys/linux-rwlock.h>
+#include <linux-rwlock.h>
 
 int
 rw_lock_held(krwlock_t *rwlp)
@@ -12,7 +12,7 @@ rw_lock_held(krwlock_t *rwlp)
 #endif
                return 1;
        }
-       
+
        return 0;
 }
 
index 0babd239555d13617ef3e422d78b38c4fa18586d..ddcf57c3cdc21aa314e1b3d478761d1292aba930 100644 (file)
@@ -1,4 +1,4 @@
-#include <sys/linux-taskq.h>
+#include <linux-taskq.h>
 
 /*
  * Task queue interface
@@ -58,6 +58,7 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *priv, uint_t flags)
 
         return (taskqid_t)wq;
 }
+EXPORT_SYMBOL(__taskq_dispatch);
 
 /* XXX - Most args ignored until we decide if it's worth the effort
  *       to emulate the solaris notion of dynamic thread pools.  For
@@ -72,7 +73,8 @@ taskq_t *
 __taskq_create(const char *name, int nthreads, pri_t pri,
                int minalloc, int maxalloc, uint_t flags)
 {
-       /* NOTE: Linux workqueue names are limited to 10 chars */               
+       /* NOTE: Linux workqueue names are limited to 10 chars */
 
         return create_singlethread_workqueue(name);
 }
+EXPORT_SYMBOL(__taskq_create);
index f3caa6365e22952e70dd3d0d300697b95487714a..9785d50d34298e6a171df76c6a537d305cc8937c 100644 (file)
@@ -15,7 +15,7 @@ typedef struct thread_priv_s {
         wait_queue_head_t tp_waitq;    /* Syncronization wait queue */
 } thread_priv_t;
 
-int
+static int
 thread_generic_wrapper(void *arg)
 {
        thread_priv_t *tp = (thread_priv_t *)arg;
@@ -38,8 +38,8 @@ thread_generic_wrapper(void *arg)
         spin_unlock(&tp->tp_lock);
        wake_up(&tp->tp_waitq);
 
-       /* DO NOT USE 'ARG' AFTER THIS POINT, EVER, EVER, EVER! 
-        * Local variables are used here because after the calling thread 
+       /* DO NOT USE 'ARG' AFTER THIS POINT, EVER, EVER, EVER!
+        * Local variables are used here because after the calling thread
         * has been woken up it will exit and this memory will no longer
         * be safe to access since it was declared on the callers stack. */
        if (func)
@@ -53,6 +53,7 @@ __thread_exit(void)
 {
        return;
 }
+EXPORT_SYMBOL(__thread_exit);
 
 /* thread_create() may block forever if it cannot create a thread or
  * allocate memory.  This is preferable to returning a NULL which Solaris
@@ -63,7 +64,6 @@ __thread_create(caddr_t stk, size_t  stksize, void (*proc)(void *),
 {
        thread_priv_t tp;
        DEFINE_WAIT(wait);
-       kthread_t *task;
        long pid;
 
        /* Option pp is simply ignored */
@@ -106,8 +106,9 @@ __thread_create(caddr_t stk, size_t  stksize, void (*proc)(void *),
 
        /* Verify the pid retunred matches the pid in the task struct */
        BUG_ON(pid != (tp.tp_task)->pid);
-       
+
        spin_unlock(&tp.tp_lock);
 
        return (kthread_t *)tp.tp_task;
 }
+EXPORT_SYMBOL(__thread_create);
index eaab2ac0a036ae7f5511271084bc84aabbecc01a..7c9b557842b9169ad5972d316451fe62c32bd32e 100644 (file)
@@ -1,5 +1,4 @@
-#include <sys/zfs_context.h>
-#include <sys/splat-ctl.h>
+#include <splat-ctl.h>
 
 #define KZT_SUBSYSTEM_CONDVAR          0x0500
 #define KZT_CONDVAR_NAME               "condvar"
index 5292b0e605f1359eaf7c96fa975658ac6a0a716e..9bff58a650d0bc84c5b5840fe5a3fe177250dfd7 100644 (file)
  * Author: Brian Behlendorf
  */
 
-#include <sys/zfs_context.h>
-#include <sys/splat-ctl.h>
-
-#include <linux/version.h>
-#include <linux/vmalloc.h>
-#include <linux/module.h>
-#include <linux/device.h>
+#include <splat-ctl.h>
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
 #include <linux/devfs_fs_kernel.h>
@@ -233,7 +227,7 @@ kzt_test_count(kzt_cfg_t *kcfg, unsigned long arg)
 {
        kzt_subsystem_t *sub;
        kzt_test_t *test;
-       int rc, i = 0;
+       int i = 0;
 
        /* Subsystem ID passed as arg1 */
        sub = kzt_subsystem_find(kcfg->cfg_arg1);
@@ -259,7 +253,7 @@ kzt_test_list(kzt_cfg_t *kcfg, unsigned long arg)
        kzt_subsystem_t *sub;
        kzt_test_t *test;
        kzt_cfg_t *tmp;
-       int size, rc, i = 0;
+       int size, i = 0;
 
        /* Subsystem ID passed as arg1 */
        sub = kzt_subsystem_find(kcfg->cfg_arg1);
@@ -309,7 +303,6 @@ static int
 kzt_validate(struct file *file, kzt_subsystem_t *sub, int cmd, void *arg)
 {
         kzt_test_t *test;
-        int rc = 0;
 
         spin_lock(&(sub->test_lock));
         list_for_each_entry(test, &(sub->test_list), test_list) {
@@ -432,7 +425,8 @@ static int
 kzt_ioctl(struct inode *inode, struct file *file,
          unsigned int cmd, unsigned long arg)
 {
-       int minor, rc = 0;
+        unsigned int minor = iminor(file->f_dentry->d_inode);
+       int rc = 0;
 
        /* Ignore tty ioctls */
        if ((cmd & 0xffffff00) == ((int)'T') << 8)
@@ -588,7 +582,7 @@ static int __init
 kzt_init(void)
 {
        dev_t dev;
-       int i, rc;
+       int rc;
 
        spin_lock_init(&kzt_module_lock);
        INIT_LIST_HEAD(&kzt_module_list);
@@ -603,7 +597,7 @@ kzt_init(void)
        KZT_SUBSYSTEM_INIT(time);
 
        dev = MKDEV(KZT_MAJOR, 0);
-        if (rc = register_chrdev_region(dev, KZT_MINORS, "kztctl"))
+        if ((rc = register_chrdev_region(dev, KZT_MINORS, "kztctl")))
                goto error;
 
        /* Support for registering a character driver */
@@ -648,7 +642,6 @@ static void
 kzt_fini(void)
 {
        dev_t dev = MKDEV(KZT_MAJOR, 0);
-        int i;
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
         class_simple_device_remove(dev);
index fb40819b572eb9f6559c40eb8925c3e69cbde654..d0af3fc52f311e051304b896563bf441aa5e3272 100644 (file)
@@ -1,5 +1,4 @@
-#include <sys/zfs_context.h>
-#include <sys/splat-ctl.h>
+#include <splat-ctl.h>
 
 #define KZT_SUBSYSTEM_KMEM             0x0100
 #define KZT_KMEM_NAME                  "kmem"
@@ -229,7 +228,7 @@ kzt_kmem_test3(struct file *file, void *arg)
 out_free:
        if (kcd)
                kmem_cache_free(cache, kcd);
-out_destroy:
+
        kmem_cache_destroy(cache);
        return rc;
 }
@@ -279,7 +278,7 @@ kzt_kmem_test4(struct file *file, void *arg)
        kcp.kcp_cache = cache;
 
        for (i = 0; i < KZT_KMEM_OBJ_COUNT; i++) {
-               /* All allocations need not succeed */
+               /* All allocations need not succeed */
                kcp.kcp_kcd[i] = kmem_cache_alloc(cache, 0);
                if (!kcp.kcp_kcd[i]) {
                        kzt_vprint(file, KZT_KMEM_TEST4_NAME,
index 254a40de231d067bc9e866de5f2a73121a55242d..47a36308e250b3bfc23fb1fd8a3b3f3930ef4f9f 100644 (file)
@@ -1,5 +1,4 @@
-#include <sys/zfs_context.h>
-#include <sys/splat-ctl.h>
+#include <splat-ctl.h>
 
 #define KZT_SUBSYSTEM_MUTEX            0x0400
 #define KZT_MUTEX_NAME                 "mutex"
index abb6540631f4e58fba2594847775bc544669d93d..412c1d62a40ae28d60d318f904a1378df10235a9 100644 (file)
@@ -1,5 +1,4 @@
-#include <sys/zfs_context.h>
-#include <sys/splat-ctl.h>
+#include <splat-ctl.h>
 
 #define KZT_SUBSYSTEM_KRNG             0x0300
 #define KZT_KRNG_NAME                  "krng"
index 9820937c3cfb64d048efe87089960f36b2e6520a..df4585ea384c7f506bc3206a09f0731a1d49a1db 100644 (file)
@@ -1,5 +1,4 @@
-#include <sys/zfs_context.h>
-#include <sys/splat-ctl.h>
+#include <splat-ctl.h>
 
 #define KZT_SUBSYSTEM_RWLOCK           0x0700
 #define KZT_RWLOCK_NAME                        "rwlock"
index 614e7136c37af2a876730d2ae86c9b347ecc7710..3d5c075f45d5ec7630a0436906ec8a2c6e04d679 100644 (file)
@@ -1,5 +1,4 @@
-#include <sys/zfs_context.h>
-#include <sys/splat-ctl.h>
+#include <splat-ctl.h>
 
 #define KZT_SUBSYSTEM_TASKQ            0x0200
 #define KZT_TASKQ_NAME                 "taskq"
index 0741db1fa201da65b4d9bc79421ad3cc0c474aaa..34260c2d696ead9314552bc634001bbb7f89b66f 100644 (file)
@@ -1,5 +1,4 @@
-#include <sys/zfs_context.h>
-#include <sys/splat-ctl.h>
+#include <splat-ctl.h>
 
 #define KZT_SUBSYSTEM_THREAD           0x0600
 #define KZT_THREAD_NAME                        "thread"
index b7d4ce86ed16a70f93b9c841ea133df99adf8eea..3e8007a37d16877c4f20e8470d248dd4dad6375b 100644 (file)
@@ -1,5 +1,4 @@
-#include <sys/zfs_context.h>
-#include <sys/splat-ctl.h>
+#include <splat-ctl.h>
 
 #define KZT_SUBSYSTEM_TIME             0x0800
 #define KZT_TIME_NAME                  "time"