1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 #ifndef _PORTALS_COMPAT_H
5 #define _PORTALS_COMPAT_H
7 // XXX BUG 1511 -- remove this stanza and all callers when bug 1511 is resolved
9 # if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) || defined(CONFIG_RH_2_4_20)
10 # define SIGNAL_MASK_ASSERT() \
11 LASSERT(current->sighand->siglock.magic == SPINLOCK_MAGIC)
13 # define SIGNAL_MASK_ASSERT() \
14 LASSERT(current->sigmask_lock.magic == SPINLOCK_MAGIC)
17 # define SIGNAL_MASK_ASSERT()
19 // XXX BUG 1511 -- remove this stanza and all callers when bug 1511 is resolved
21 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
23 # define SIGNAL_MASK_LOCK(task, flags) \
24 spin_lock_irqsave(&task->sighand->siglock, flags)
25 # define SIGNAL_MASK_UNLOCK(task, flags) \
26 spin_unlock_irqrestore(&task->sighand->siglock, flags)
27 # define USERMODEHELPER(path, argv, envp) \
28 call_usermodehelper(path, argv, envp, 1)
29 # define RECALC_SIGPENDING recalc_sigpending()
30 # define CLEAR_SIGPENDING clear_tsk_thread_flag(current, \
32 # define CURRENT_SECONDS get_seconds()
33 # define smp_num_cpus num_online_cpus()
36 #elif defined(CONFIG_RH_2_4_20) /* RH 2.4.x */
38 # define SIGNAL_MASK_LOCK(task, flags) \
39 spin_lock_irqsave(&task->sighand->siglock, flags)
40 # define SIGNAL_MASK_UNLOCK(task, flags) \
41 spin_unlock_irqrestore(&task->sighand->siglock, flags)
42 # define USERMODEHELPER(path, argv, envp) \
43 call_usermodehelper(path, argv, envp)
44 # define RECALC_SIGPENDING recalc_sigpending()
45 # define CLEAR_SIGPENDING (current->sigpending = 0)
46 # define CURRENT_SECONDS CURRENT_TIME
50 # define SIGNAL_MASK_LOCK(task, flags) \
51 spin_lock_irqsave(&task->sigmask_lock, flags)
52 # define SIGNAL_MASK_UNLOCK(task, flags) \
53 spin_unlock_irqrestore(&task->sigmask_lock, flags)
54 # define USERMODEHELPER(path, argv, envp) \
55 call_usermodehelper(path, argv, envp)
56 # define RECALC_SIGPENDING recalc_sigpending(current)
57 # define CLEAR_SIGPENDING (current->sigpending = 0)
58 # define CURRENT_SECONDS CURRENT_TIME
62 #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
63 #define UML_PID(tsk) ((tsk)->thread.extern_pid)
64 #elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
65 #define UML_PID(tsk) ((tsk)->thread.mode.tt.extern_pid)
67 #define UML_PID(tsk) ((tsk)->pid)
70 #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
71 # define THREAD_NAME(comm, len, fmt, a...) \
72 snprintf(comm, len,fmt"|%d", ## a, UML_PID(current))
74 # define THREAD_NAME(comm, len, fmt, a...) \
75 snprintf(comm, len, fmt, ## a)
79 /* 2.4 alloc_page users can use page->list */
80 #define PAGE_LIST_ENTRY list
81 #define PAGE_LIST(page) ((page)->list)
83 /* 2.6 alloc_page users can use page->lru */
84 #define PAGE_LIST_ENTRY lru
85 #define PAGE_LIST(page) ((page)->lru)
88 #ifndef HAVE_CPU_ONLINE
89 #define cpu_online(cpu) (test_bit(cpu_online_map, &(cpu)))
91 #ifndef HAVE_CPUMASK_T
92 #define cpu_set(cpu, map) (set_bit(cpu, &(map)))
93 typedef unsigned long cpumask_t;
96 #endif /* _PORTALS_COMPAT_H */