1#ifndef _LINUX_KERNEL_H 2#define _LINUX_KERNEL_H 3 4/* 5 * 'kernel.h' contains some often-used function prototypes etc 6 */ 7#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) 8#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) 9 10 11#define SI_LOAD_SHIFT 16 12struct sysinfo { 13 long uptime; /* Seconds since boot */ 14 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ 15 unsigned long totalram; /* Total usable main memory size */ 16 unsigned long freeram; /* Available memory size */ 17 unsigned long sharedram; /* Amount of shared memory */ 18 unsigned long bufferram; /* Memory used by buffers */ 19 unsigned long totalswap; /* Total swap space size */ 20 unsigned long freeswap; /* swap space still available */ 21 unsigned short procs; /* Number of current processes */ 22 unsigned short pad; /* explicit padding for m68k */ 23 unsigned long totalhigh; /* Total high memory size */ 24 unsigned long freehigh; /* Available high memory size */ 25 unsigned int mem_unit; /* Memory unit size in bytes */ 26 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 27}; 28 29/* Force a compilation error if condition is true */ 30#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition)) 31 32/* Force a compilation error if condition is constant and true */ 33#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) 34 35/* Force a compilation error if a constant expression is not a power of 2 */ 36#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ 37 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) 38 39/* Force a compilation error if condition is true, but also produce a 40 result (of value 0 and type size_t), so the expression can be used 41 e.g. in a structure initializer (or where-ever else comma expressions 42 aren't permitted). */ 43#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) 44#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) 45 46/* Trap pasters of __FUNCTION__ at compile-time */ 47#define __FUNCTION__ (__func__) 48 49/* This helps us to avoid #ifdef CONFIG_NUMA */ 50#ifdef CONFIG_NUMA 51#define NUMA_BUILD 1 52#else 53#define NUMA_BUILD 0 54#endif 55 56/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ 57#ifdef CONFIG_FTRACE_MCOUNT_RECORD 58# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 59#endif 60 61#endif 62