summaryrefslogtreecommitdiff
path: root/sysroot/usr/include/linux/init.h
blob: 846c4eb5e580ca1c90794f3e1c48135fd3beeedc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/****************************************************************************
 ****************************************************************************
 ***
 ***   This header was automatically generated from a Linux kernel header
 ***   of the same name, to make information necessary for userspace to
 ***   call into the kernel available to libc.  It contains only constants,
 ***   structures, and macros generated from the original header, and thus,
 ***   contains no copyrightable information.
 ***
 ****************************************************************************
 ****************************************************************************/
#ifndef _LINUX_INIT_H
#define _LINUX_INIT_H

#include <linux/compiler.h>

#define __init __attribute__ ((__section__ (".init.text")))
#define __initdata __attribute__ ((__section__ (".init.data")))
#define __exitdata __attribute__ ((__section__(".exit.data")))
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))

#ifdef MODULE
#define __exit __attribute__ ((__section__(".exit.text")))
#else
#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text")))
#endif

#define __INIT .section ".init.text","ax"
#define __FINIT .previous
#define __INITDATA .section ".init.data","aw"

#ifndef __ASSEMBLY__

typedef int (*initcall_t)(void);
typedef void (*exitcall_t)(void);

#endif

#ifndef MODULE

#ifndef __ASSEMBLY__

#define __define_initcall(level,fn)   static initcall_t __initcall_##fn __attribute_used__   __attribute__((__section__(".initcall" level ".init"))) = fn

#define core_initcall(fn) __define_initcall("1",fn)
#define postcore_initcall(fn) __define_initcall("2",fn)
#define arch_initcall(fn) __define_initcall("3",fn)
#define subsys_initcall(fn) __define_initcall("4",fn)
#define fs_initcall(fn) __define_initcall("5",fn)
#define device_initcall(fn) __define_initcall("6",fn)
#define late_initcall(fn) __define_initcall("7",fn)

#define __initcall(fn) device_initcall(fn)

#define __exitcall(fn)   static exitcall_t __exitcall_##fn __exit_call = fn

#define console_initcall(fn)   static initcall_t __initcall_##fn   __attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn

#define security_initcall(fn)   static initcall_t __initcall_##fn   __attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn

struct obs_kernel_param {
 const char *str;
 int (*setup_func)(char *);
 int early;
};

#define __setup_param(str, unique_id, fn, early)   static char __setup_str_##unique_id[] __initdata = str;   static struct obs_kernel_param __setup_##unique_id   __attribute_used__   __attribute__((__section__(".init.setup")))   __attribute__((aligned((sizeof(long)))))   = { __setup_str_##unique_id, fn, early }

#define __setup_null_param(str, unique_id)   __setup_param(str, unique_id, NULL, 0)

#define __setup(str, fn)   __setup_param(str, fn, fn, 0)

#define __obsolete_setup(str)   __setup_null_param(str, __LINE__)

#define early_param(str, fn)   __setup_param(str, fn, fn, 1)

#endif

#define module_init(x) __initcall(x);

#define module_exit(x) __exitcall(x);

#else

#define core_initcall(fn) module_init(fn)
#define postcore_initcall(fn) module_init(fn)
#define arch_initcall(fn) module_init(fn)
#define subsys_initcall(fn) module_init(fn)
#define fs_initcall(fn) module_init(fn)
#define device_initcall(fn) module_init(fn)
#define late_initcall(fn) module_init(fn)

#define security_initcall(fn) module_init(fn)

#define module_init(initfn)   static inline initcall_t __inittest(void)   { return initfn; }   int init_module(void) __attribute__((alias(#initfn)));

#define module_exit(exitfn)   static inline exitcall_t __exittest(void)   { return exitfn; }   void cleanup_module(void) __attribute__((alias(#exitfn)));

#define __setup_param(str, unique_id, fn)  
#define __setup_null_param(str, unique_id)  
#define __setup(str, func)  
#define __obsolete_setup(str)  
#endif

#define __nosavedata __attribute__ ((__section__ (".data.nosave")))

#define __init_or_module __init
#define __initdata_or_module __initdata

#define __devinit __init
#define __devinitdata __initdata
#define __devexit __exit
#define __devexitdata __exitdata

#define __cpuinit __init
#define __cpuinitdata __initdata
#define __cpuexit __exit
#define __cpuexitdata __exitdata

#define __meminit __init
#define __meminitdata __initdata
#define __memexit __exit
#define __memexitdata __exitdata

#ifdef MODULE
#define __devexit_p(x) x
#else
#define __devexit_p(x) NULL
#endif

#ifdef MODULE
#define __exit_p(x) x
#else
#define __exit_p(x) NULL
#endif

#endif