![]() | |||||||||||
Messages in this thread
Patch in this message |
[...] + * When freeing, reset page->mapping so free_pages_check won't complain.
+ */
+#define __pte_lockptr(page) ((spinlock_t *)&((page)->private)) +#define pte_lock_init(_page) do { \ + BUILD_BUG_ON((size_t)(__pte_lockptr((struct page *)0) + 1) > \ + sizeof(struct page)); \ + spin_lock_init(__pte_lockptr(_page)); \ +} while (0) Looking at this, I think BUILD_BUG_ON() should be defined in a way that allows it to be used outside of function scope too (see patch below, compile-tested). Nikita. -- Fix comment describing BUILD_BUG_ON: BUG_ON is not an assertion (unfortunately). Also implement BUILD_BUG_ON in a way that can be used outside of a function scope, so that compile time checks can be placed in convenient places (like in a header, close to the definition of related constants and data-types). Signed-off-by: Nikita Danilov <nikita@clusterfs.com> include/linux/kernel.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) [view this diff only] diff -puN include/linux/kernel.h~BUILD_BUG_ON-fix-comment include/linux/kernel.h
--- git-linux/include/linux/kernel.h~BUILD_BUG_ON-fix-comment 2005-10-23 20:09:33.000000000 +0400
+++ git-linux-nikita/include/linux/kernel.h 2005-10-23 20:44:03.000000000 +0400
@@ -307,8 +307,9 @@ struct sysinfo {
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
};
-/* Force a compilation error if condition is false */
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
+/* Force a compilation error if condition is true */
+#define BUILD_BUG_ON(x) \
+ void __dummy_build_bug_on(int __compile_time_assertion_failed_[-!!(x)])
#ifdef CONFIG_SYSCTL
extern int randomize_va_space;
_ | ||||||||||
![]() | |||||||||||
| Last update: 2005-10-23 16:59 [W:0.798 / U:0.000 seconds] ©2003-2005 Jasper Spaans | |||||||||||