xref: /haiku/headers/os/drivers/module.h (revision 81f5654c124bf46fba0fd251f208e2d88d81e1ce)
1 /* Modules Definitions
2 **
3 ** Distributed under the terms of the OpenBeOS License.
4 */
5 
6 #ifndef _MODULE_H
7 #define _MODULE_H
8 
9 
10 #include <OS.h>
11 
12 
13 /* Every module exports a list of module_info structures.
14  * It defines the interface of the module and the name
15  * that is used to access the interface.
16  */
17 
18 typedef struct module_info {
19 	const char	*name;
20 	uint32		flags;
21 	status_t	(*std_ops)(int32, ...);
22 } module_info;
23 
24 /* module standard operations */
25 #define	B_MODULE_INIT	1
26 #define	B_MODULE_UNINIT	2
27 
28 /* module flags */
29 #define	B_KEEP_LOADED	0x00000001
30 
31 
32 /* Use the module_dependency structure to let the
33  * kernel automatically load modules yet depend on
34  * before B_MODULE_INIT is called.
35  */
36 
37 typedef struct module_dependency {
38 	const char	*name;
39 	module_info	**info;
40 } module_dependency;
41 
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 extern status_t get_module(const char *path, module_info **_info);
48 extern status_t put_module(const char *path);
49 extern status_t get_next_loaded_module_name(uint32 *cookie, char *buffer, size_t *_bufferSize);
50 extern void *open_module_list(const char *prefix);
51 extern status_t close_module_list(void *cookie);
52 extern status_t read_next_module_name(void *cookie, char *buffer, size_t *_bufferSize);
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 
58 #endif	/* _MODULE_H */
59