~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/um/include/shared/init.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_UML_INIT_H
  3 #define _LINUX_UML_INIT_H
  4 
  5 /* These macros are used to mark some functions or
  6  * initialized data (doesn't apply to uninitialized data)
  7  * as `initialization' functions. The kernel can take this
  8  * as hint that the function is used only during the initialization
  9  * phase and free up used memory resources after
 10  *
 11  * Usage:
 12  * For functions:
 13  *
 14  * You should add __init immediately before the function name, like:
 15  *
 16  * static void __init initme(int x, int y)
 17  * {
 18  *    extern int z; z = x * y;
 19  * }
 20  *
 21  * If the function has a prototype somewhere, you can also add
 22  * __init between closing brace of the prototype and semicolon:
 23  *
 24  * extern int initialize_foobar_device(int, int, int) __init;
 25  *
 26  * For initialized data:
 27  * You should insert __initdata between the variable name and equal
 28  * sign followed by value, e.g.:
 29  *
 30  * static int init_variable __initdata = 0;
 31  * static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
 32  *
 33  * Don't forget to initialize data not at file scope, i.e. within a function,
 34  * as gcc otherwise puts the data into the bss section and not into the init
 35  * section.
 36  *
 37  * Also note, that this data cannot be "const".
 38  */
 39 
 40 #ifndef _LINUX_INIT_H
 41 typedef int (*initcall_t)(void);
 42 typedef void (*exitcall_t)(void);
 43 
 44 #include <linux/compiler_types.h>
 45 
 46 /* These are for everybody (although not all archs will actually
 47    discard it in modules) */
 48 #define __init          __section(".init.text")
 49 #define __initdata      __section(".init.data")
 50 #define __exitdata      __section(".exit.data")
 51 #define __exit_call     __used __section(".exitcall.exit")
 52 
 53 #ifdef MODULE
 54 #define __exit          __section(".exit.text")
 55 #else
 56 #define __exit          __used __section(".exit.text")
 57 #endif
 58 
 59 #endif
 60 
 61 #ifndef MODULE
 62 struct uml_param {
 63         const char *str;
 64         int (*setup_func)(char *, int *);
 65 };
 66 
 67 extern initcall_t __uml_postsetup_start, __uml_postsetup_end;
 68 extern const char *__uml_help_start, *__uml_help_end;
 69 #endif
 70 
 71 #define __uml_exitcall(fn)                                              \
 72         static exitcall_t __uml_exitcall_##fn __uml_exit_call = fn
 73 
 74 extern struct uml_param __uml_setup_start, __uml_setup_end;
 75 
 76 #define __uml_postsetup(fn)                                             \
 77         static initcall_t __uml_postsetup_##fn __uml_postsetup_call = fn
 78 
 79 #define __non_empty_string(dummyname,string)                            \
 80         struct __uml_non_empty_string_struct_##dummyname                \
 81         {                                                               \
 82                 char _string[sizeof(string)-2];                         \
 83         }
 84 
 85 #ifndef MODULE
 86 #define __uml_setup(str, fn, help...)                                   \
 87         __non_empty_string(fn ##_setup, str);                           \
 88         __uml_help(fn, help);                                           \
 89         static char __uml_setup_str_##fn[] __initdata = str;            \
 90         static struct uml_param __uml_setup_##fn __uml_init_setup = { __uml_setup_str_##fn, fn }
 91 #else
 92 #define __uml_setup(str, fn, help...)                                   \
 93 
 94 #endif
 95 
 96 #define __uml_help(fn, help...)                                         \
 97         __non_empty_string(fn ##__help, help);                          \
 98         static char __uml_help_str_##fn[] __initdata = help;            \
 99         static const char *__uml_help_##fn __uml_setup_help = __uml_help_str_##fn
100 
101 /*
102  * Mark functions and data as being only used at initialization
103  * or exit time.
104  */
105 #define __uml_init_setup        __used __section(".uml.setup.init")
106 #define __uml_setup_help        __used __section(".uml.help.init")
107 #define __uml_postsetup_call    __used __section(".uml.postsetup.init")
108 #define __uml_exit_call         __used __section(".uml.exitcall.exit")
109 
110 #ifdef __UM_HOST__
111 
112 #define __define_initcall(level,fn) \
113         static initcall_t __initcall_##fn __used \
114         __attribute__((__section__(".initcall" level ".init"))) = fn
115 
116 /* Userspace initcalls shouldn't depend on anything in the kernel, so we'll
117  * make them run first.
118  */
119 #define __initcall(fn) __define_initcall("1", fn)
120 
121 #define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
122 
123 #define __init_call     __used __section(".initcall.init")
124 
125 #endif
126 
127 #endif /* _LINUX_UML_INIT_H */
128 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php