diff options
author | Christoph Lameter <clameter@sgi.com> | 2008-04-28 05:12:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:22 -0400 |
commit | f94a62e910840b3552c7adb7c57e0f8b3b345f6e (patch) | |
tree | 31444cdd24e640beea706d9b9f8da97f3a5c1639 /include/linux/page-flags.h | |
parent | 9223b4190fa1297a59f292f3419fc0285321d0ea (diff) |
pageflags: introduce macros to generate page flag functions
Introduce a set of macros that generate functions to handle page flags.
A page flag function group typically starts with either
SETPAGEFLAG(<part of function name>,<part of PG_ flagname>)
to create a set of page flag operations that are atomic. Or
__SETPAGEFLAG(<part of function name>,<part of PG_ flagname)
to create a set of page flag operations that are not atomic.
Then additional operations can be added using the following macros
TESTSCFLAG Create additional atomic test-and-set and
test-and-clear functions
TESTSETFLAG Create additional test and set function
TESTCLEARFLAG Create additional test and clear function
SETPAGEFLAG Create additional atomic set function
CLEARPAGEFLAG Create additional atomic clear function
__TESTPAGEFLAG Create additional non atomic set function
__SETPAGEFLAG Create additional non atomic clear function
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/page-flags.h')
-rw-r--r-- | include/linux/page-flags.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 00e55e23b777..e5bddbfcf7ae 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -109,6 +109,47 @@ enum pageflags { | |||
109 | #ifndef __GENERATING_BOUNDS_H | 109 | #ifndef __GENERATING_BOUNDS_H |
110 | 110 | ||
111 | /* | 111 | /* |
112 | * Macros to create function definitions for page flags | ||
113 | */ | ||
114 | #define TESTPAGEFLAG(uname, lname) \ | ||
115 | static inline int Page##uname(struct page *page) \ | ||
116 | { return test_bit(PG_##lname, &page->flags); } | ||
117 | |||
118 | #define SETPAGEFLAG(uname, lname) \ | ||
119 | static inline void SetPage##uname(struct page *page) \ | ||
120 | { set_bit(PG_##lname, &page->flags); } | ||
121 | |||
122 | #define CLEARPAGEFLAG(uname, lname) \ | ||
123 | static inline void ClearPage##uname(struct page *page) \ | ||
124 | { clear_bit(PG_##lname, &page->flags); } | ||
125 | |||
126 | #define __SETPAGEFLAG(uname, lname) \ | ||
127 | static inline void __SetPage##uname(struct page *page) \ | ||
128 | { __set_bit(PG_##lname, &page->flags); } | ||
129 | |||
130 | #define __CLEARPAGEFLAG(uname, lname) \ | ||
131 | static inline void __ClearPage##uname(struct page *page) \ | ||
132 | { __clear_bit(PG_##lname, &page->flags); } | ||
133 | |||
134 | #define TESTSETFLAG(uname, lname) \ | ||
135 | static inline int TestSetPage##uname(struct page *page) \ | ||
136 | { return test_and_set_bit(PG_##lname, &page->flags); } | ||
137 | |||
138 | #define TESTCLEARFLAG(uname, lname) \ | ||
139 | static inline int TestClearPage##uname(struct page *page) \ | ||
140 | { return test_and_clear_bit(PG_##lname, &page->flags); } | ||
141 | |||
142 | |||
143 | #define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ | ||
144 | SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname) | ||
145 | |||
146 | #define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ | ||
147 | __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname) | ||
148 | |||
149 | #define TESTSCFLAG(uname, lname) \ | ||
150 | TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname) | ||
151 | |||
152 | /* | ||
112 | * Manipulation of page state flags | 153 | * Manipulation of page state flags |
113 | */ | 154 | */ |
114 | #define PageLocked(page) \ | 155 | #define PageLocked(page) \ |