#define CFS_NR_CPUS 1
#endif
+#ifdef HAVE_SET_CPUS_ALLOWED
#define cfs_set_cpus_allowed(t, mask) set_cpus_allowed(t, mask)
+#else
+#define cfs_set_cpus_allowed(t, mask) set_cpus_allowed_ptr(t, &(mask))
+#endif
+
/*
* cache
*/
/*
* Symbol register
*/
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define cfs_symbol_register(s, p) inter_module_register(s, THIS_MODULE, p)
-#define cfs_symbol_unregister(s) inter_module_unregister(s)
-#define cfs_symbol_get(s) inter_module_get(s)
-#define cfs_symbol_put(s) inter_module_put(s)
-#define cfs_module_get() MOD_INC_USE_COUNT
-#else
#define cfs_symbol_register(s, p) do {} while(0)
#define cfs_symbol_unregister(s) do {} while(0)
#define cfs_symbol_get(s) symbol_get(s)
#define __cfs_module_get(m) __module_get(m)
#define cfs_module_put(m) module_put(m)
#define cfs_module_refcount(m) module_refcount(m)
-#endif
typedef struct module cfs_module_t;
/* Kernel thread */
typedef int (*cfs_thread_t)(void *);
-static inline int cfs_kernel_thread(int (*fn)(void *),
- void *arg, unsigned long flags)
-{
- void *orig_info = current->journal_info;
- int rc;
-
- current->journal_info = NULL;
- rc = kernel_thread(fn, arg, flags);
- current->journal_info = orig_info;
- return rc;
-}
-
+#define CFS_DAEMON_FLAGS (CLONE_VM | CLONE_FILES)
+extern int cfs_create_thread(int (*fn)(void *),
+ void *arg, unsigned long flags);
/*
* Task struct
ret = wait_event_timeout(wq, condition, timeout)
#endif
-#ifndef wait_event_interruptible_timeout /* Only for RHEL3 2.4.21 kernel */
-#define __wait_event_interruptible_timeout(wq, condition, timeout, ret) \
-do { \
- int __ret = 0; \
- if (!(condition)) { \
- wait_queue_t __wait; \
- unsigned long expire; \
- \
- init_waitqueue_entry(&__wait, current); \
- expire = timeout + jiffies; \
- add_wait_queue(&wq, &__wait); \
- for (;;) { \
- set_current_state(TASK_INTERRUPTIBLE); \
- if (condition) \
- break; \
- if (jiffies > expire) { \
- ret = jiffies - expire; \
- break; \
- } \
- if (!signal_pending(current)) { \
- schedule_timeout(timeout); \
- continue; \
- } \
- ret = -ERESTARTSYS; \
- break; \
- } \
- current->state = TASK_RUNNING; \
- remove_wait_queue(&wq, &__wait); \
- } \
-} while (0)
-
-/*
- retval == 0; condition met; we're good.
- retval < 0; interrupted by signal.
- retval > 0; timed out.
-*/
-#define cfs_waitq_wait_event_interruptible_timeout(wq, condition, timeout, ret)\
-do { \
- ret = 0; \
- if (!(condition)) \
- __wait_event_interruptible_timeout(wq, condition, \
- timeout, ret); \
-} while (0)
-#else
#define cfs_waitq_wait_event_interruptible_timeout(wq, c, timeout, ret) \
ret = wait_event_interruptible_timeout(wq, c, timeout)
-#endif
/*
* atomic