]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Add some typedefs to make it clearer when we passing a function,
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Mon, 10 Mar 2008 19:25:20 +0000 (19:25 +0000)
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Mon, 10 Mar 2008 19:25:20 +0000 (19:25 +0000)
Add fm_panic define
Add another bad atomic hack (need to do this right)

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

include/sys/atomic.h
include/sys/cmn_err.h
include/sys/taskq.h
include/sys/thread.h
modules/spl/spl-thread.c

index ae2130331fe740c45bdb917f42bcd19ae1354ec0..1f2a4780b51ea8e66bb73220e28d7f3781cf89e8 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
  * get by for now since I'm only working on real 64bit systems but
  * this will need to be addressed properly.
  */
+
 static __inline__ void
 atomic_inc_64(volatile uint64_t *target)
 {
@@ -22,6 +23,14 @@ atomic_dec_64(volatile uint64_t *target)
        (*target)--;
 }
 
+static __inline__ uint32_t
+atomic_add_32(volatile uint32_t *target, int32_t delta)
+{
+       uint32_t rc = *target;
+       *target += delta;
+       return rc;
+}
+
 static __inline__ uint64_t
 atomic_add_64(volatile uint64_t *target, uint64_t delta)
 {
index c76e4f465c43203d8a521ef8a40f1cf4dd24c189..62417e83ec8983afb4b4d1248ab92b5a370c0056 100644 (file)
@@ -13,4 +13,6 @@ extern void cmn_err(int, const char *, ...);
 extern void vcmn_err(int, const char *, __va_list);
 extern void vpanic(const char *, __va_list);
 
+#define fm_panic       panic
+
 #endif /* SPL_CMN_ERR_H */
index fd4af1232ed03a9cc303f95b892b33272e713cca..811b9955706e7c72a19830904820e01ffd396025 100644 (file)
@@ -75,7 +75,7 @@ extern taskq_t *__taskq_create(const char *, int, pri_t, int, int, uint_t);
 #define taskq_create(name, thr, pri, min, max, flags) \
        __taskq_create(name, thr, pri, min, max, flags)
 #define taskq_dispatch(tq, func, priv, flags)         \
-       __taskq_dispatch(tq, func, priv, flags)
+       __taskq_dispatch(tq, (task_func_t)func, priv, flags)
 #define taskq_destroy(tq)                             destroy_workqueue(tq)
 #define taskq_wait(tq)                                flush_workqueue(tq)
 #define taskq_member(tq, kthr)                        1 /* XXX -Just be true */
index 44e2902a65ab32acc19d6e09aa75418ad1fc4c76..c7b10437433f662a2901eda809b6b196f4e9adf7 100644 (file)
@@ -26,14 +26,16 @@ extern "C" {
 #define TS_WAIT                                0x20    /* No clean linux mapping */
 #endif
 
+typedef void (*thread_func_t)(void *);
+
 #define thread_create(stk, stksize, func, arg, len, pp, state, pri)      \
-       __thread_create(stk, stksize, (void (*)(void *))func,            \
+       __thread_create(stk, stksize, (thread_func_t)func,               \
                        arg, len, pp, state, pri)
 #define thread_exit()                  __thread_exit()
 #define curthread                      get_current()
 
 extern kthread_t *__thread_create(caddr_t stk, size_t  stksize,
-                            void (*func)(void *), void *args,
+                            thread_func_t func, void *args,
                             size_t len, int *pp, int state,
                             pri_t pri);
 extern void __thread_exit(void);
index e6dca2300ea4a88f22a49def5ef98dc918952770..a2c72f05161d4258908a165f027725187a95d17b 100644 (file)
@@ -59,7 +59,7 @@ EXPORT_SYMBOL(__thread_exit);
  * allocate memory.  This is preferable to returning a NULL which Solaris
  * style callers likely never check for... since it can't fail. */
 kthread_t *
-__thread_create(caddr_t stk, size_t  stksize, void (*proc)(void *),
+__thread_create(caddr_t stk, size_t  stksize, thread_func_t func,
                void *args, size_t len, int *pp, int state, pri_t pri)
 {
        thread_priv_t tp;
@@ -77,7 +77,7 @@ __thread_create(caddr_t stk, size_t  stksize, void (*proc)(void *),
         * we're passing a stack address to a new thread but correct locking was
         * added to ensure the callee can use the data safely until wake_up(). */
        tp.tp_magic = TP_MAGIC;
-       tp.tp_func  = proc;
+       tp.tp_func  = func;
        tp.tp_args  = args;
        tp.tp_len   = len;
        tp.tp_state = state;