xref: /haiku/headers/private/fs_shell/fssh_module.h (revision b6f76ebe7153b94820cf35f8db4facc158841abb)
1a38a92c9SIngo Weinhold /* Modules Definitions
2a38a92c9SIngo Weinhold **
3*b6f76ebeSAugustin Cavalier ** Distributed under the terms of the MIT License.
4a38a92c9SIngo Weinhold */
5a38a92c9SIngo Weinhold 
6a38a92c9SIngo Weinhold #ifndef _FSSH_MODULE_H
7a38a92c9SIngo Weinhold #define _FSSH_MODULE_H
8a38a92c9SIngo Weinhold 
9a38a92c9SIngo Weinhold 
10a38a92c9SIngo Weinhold #include "fssh_os.h"
11a38a92c9SIngo Weinhold 
12a38a92c9SIngo Weinhold 
13a38a92c9SIngo Weinhold /* Every module exports a list of module_info structures.
14a38a92c9SIngo Weinhold  * It defines the interface of the module and the name
15a38a92c9SIngo Weinhold  * that is used to access the interface.
16a38a92c9SIngo Weinhold  */
17a38a92c9SIngo Weinhold 
18a38a92c9SIngo Weinhold typedef struct fssh_module_info {
19a38a92c9SIngo Weinhold 	const char		*name;
20a38a92c9SIngo Weinhold 	uint32_t		flags;
21a38a92c9SIngo Weinhold 	fssh_status_t	(*std_ops)(int32_t, ...);
22a38a92c9SIngo Weinhold } fssh_module_info;
23a38a92c9SIngo Weinhold 
24a38a92c9SIngo Weinhold /* module standard operations */
25a38a92c9SIngo Weinhold #define	FSSH_B_MODULE_INIT		1
26a38a92c9SIngo Weinhold #define	FSSH_B_MODULE_UNINIT	2
27a38a92c9SIngo Weinhold 
28a38a92c9SIngo Weinhold /* module flags */
29a38a92c9SIngo Weinhold #define	FSSH_B_KEEP_LOADED	0x00000001
30a38a92c9SIngo Weinhold 
31a38a92c9SIngo Weinhold 
32a38a92c9SIngo Weinhold /* Use the module_dependency structure to let the
33a38a92c9SIngo Weinhold  * kernel automatically load modules yet depend on
34a38a92c9SIngo Weinhold  * before B_MODULE_INIT is called.
35a38a92c9SIngo Weinhold  */
36a38a92c9SIngo Weinhold 
37a38a92c9SIngo Weinhold typedef struct fssh_module_dependency {
38a38a92c9SIngo Weinhold 	const char			*name;
39a38a92c9SIngo Weinhold 	fssh_module_info	**info;
40a38a92c9SIngo Weinhold } fssh_module_dependency;
41a38a92c9SIngo Weinhold 
42a38a92c9SIngo Weinhold 
43a38a92c9SIngo Weinhold #ifdef __cplusplus
44a38a92c9SIngo Weinhold extern "C" {
45a38a92c9SIngo Weinhold #endif
46a38a92c9SIngo Weinhold 
4790c08768SIngo Weinhold extern fssh_status_t	fssh_get_module(const char *path,
4890c08768SIngo Weinhold 								fssh_module_info **_info);
4990c08768SIngo Weinhold extern fssh_status_t	fssh_put_module(const char *path);
50a38a92c9SIngo Weinhold 
51a38a92c9SIngo Weinhold #ifdef __cplusplus
52a38a92c9SIngo Weinhold }
53a38a92c9SIngo Weinhold #endif
54a38a92c9SIngo Weinhold 
55a38a92c9SIngo Weinhold #endif	/* _FSSH_MODULE_H */
56