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 CURRENT_SECONDS get_seconds()
32 #elif defined(CONFIG_RH_2_4_20) /* RH 2.4.x */
34 # define SIGNAL_MASK_LOCK(task, flags) \
35 spin_lock_irqsave(&task->sighand->siglock, flags)
36 # define SIGNAL_MASK_UNLOCK(task, flags) \
37 spin_unlock_irqrestore(&task->sighand->siglock, flags)
38 # define USERMODEHELPER(path, argv, envp) \
39 call_usermodehelper(path, argv, envp)
40 # define RECALC_SIGPENDING recalc_sigpending()
41 # define CURRENT_SECONDS CURRENT_TIME
43 # define kernel_text_address(addr) is_kernel_text_address(addr)
44 extern int is_kernel_text_address(unsigned long addr);
48 # define SIGNAL_MASK_LOCK(task, flags) \
49 spin_lock_irqsave(&task->sigmask_lock, flags)
50 # define SIGNAL_MASK_UNLOCK(task, flags) \
51 spin_unlock_irqrestore(&task->sigmask_lock, flags)
52 # define USERMODEHELPER(path, argv, envp) \
53 call_usermodehelper(path, argv, envp)
54 # define RECALC_SIGPENDING recalc_sigpending(current)
55 # define CURRENT_SECONDS CURRENT_TIME
57 # define kernel_text_address(addr) is_kernel_text_address(addr)
58 extern int is_kernel_text_address(unsigned long addr);
62 #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
63 # define THREAD_NAME(comm, len, fmt, a...) \
64 snprintf(comm, len, fmt "|%d", ## a, current->thread.extern_pid)
65 #elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
66 # define THREAD_NAME(comm, len, fmt, a...) \
67 snprintf(comm, len,fmt"|%d", ## a,current->thread.mode.tt.extern_pid)
69 # define THREAD_NAME(comm, len, fmt, a...) \
70 snprintf(comm, len, fmt, ## a)
74 /* 2.4 alloc_page users can use page->list */
75 #define PAGE_LIST_ENTRY list
76 #define PAGE_LIST(page) ((page)->list)
78 /* 2.6 alloc_page users can use page->lru */
79 #define PAGE_LIST_ENTRY lru
80 #define PAGE_LIST(page) ((page)->lru)
83 #endif /* _PORTALS_COMPAT_H */