File: plugins.h

package info (click to toggle)
criu 4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,500 kB
  • sloc: ansic: 139,280; python: 7,484; sh: 3,824; java: 2,799; makefile: 2,659; asm: 1,137; perl: 206; xml: 117; exp: 45
file content (33 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download | duplicates (3)
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
#ifndef UAPI_COMPEL_PLUGIN_H__
#define UAPI_COMPEL_PLUGIN_H__

#define __init __attribute__((__used__)) __attribute__((__section__(".compel.init")))
#define __exit __attribute__((__used__)) __attribute__((__section__(".compel.exit")))

#ifndef __ASSEMBLY__

typedef struct {
	const char *name;
	int (*init)(void);
	void (*exit)(void);
} plugin_init_t;

#define plugin_register(___desc) static const plugin_init_t *const ___ptr__##___desc __init = &___desc;

#define PLUGIN_REGISTER(___id, ___name, ___init, ___exit)    \
	static const plugin_init_t __plugin_desc_##___id = { \
		.name = ___name,                             \
		.init = ___init,                             \
		.exit = ___exit,                             \
	};                                                   \
	plugin_register(__plugin_desc_##___id);

#define PLUGIN_REGISTER_DUMMY(___id)                         \
	static const plugin_init_t __plugin_desc_##___id = { \
		.name = #___id,                              \
	};                                                   \
	plugin_register(__plugin_desc_##___id);

#endif /* __ASSEMBLY__ */

#endif /* UAPI_COMPEL_PLUGIN_H__ */