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