libata-link: separate out link initialization functions
[pv_ops_mirror.git] / include / linux / thread_info.h
blob1c4eb41dbd89df9182c3fcdbf9f418c5958cc5c6
1 /* thread_info.h: common low-level thread information accessors
3 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
4 * - Incorporating suggestions made by Linus Torvalds
5 */
7 #ifndef _LINUX_THREAD_INFO_H
8 #define _LINUX_THREAD_INFO_H
11 * System call restart block.
13 struct restart_block {
14 long (*fn)(struct restart_block *);
15 unsigned long arg0, arg1, arg2, arg3;
18 extern long do_no_restart_syscall(struct restart_block *parm);
20 #include <linux/bitops.h>
21 #include <asm/thread_info.h>
23 #ifdef __KERNEL__
26 * flag set/clear/test wrappers
27 * - pass TIF_xxxx constants to these functions
30 static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
32 set_bit(flag,&ti->flags);
35 static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
37 clear_bit(flag,&ti->flags);
40 static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag)
42 return test_and_set_bit(flag,&ti->flags);
45 static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag)
47 return test_and_clear_bit(flag,&ti->flags);
50 static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
52 return test_bit(flag,&ti->flags);
55 #define set_thread_flag(flag) \
56 set_ti_thread_flag(current_thread_info(), flag)
57 #define clear_thread_flag(flag) \
58 clear_ti_thread_flag(current_thread_info(), flag)
59 #define test_and_set_thread_flag(flag) \
60 test_and_set_ti_thread_flag(current_thread_info(), flag)
61 #define test_and_clear_thread_flag(flag) \
62 test_and_clear_ti_thread_flag(current_thread_info(), flag)
63 #define test_thread_flag(flag) \
64 test_ti_thread_flag(current_thread_info(), flag)
66 #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
67 #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
69 #endif
71 #endif /* _LINUX_THREAD_INFO_H */