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