2008-04-09 18:36:04 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2002-2008, Haiku Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-09-20 02:33:58 +04:00
|
|
|
#ifndef _MODULE_H
|
|
|
|
#define _MODULE_H
|
|
|
|
|
|
|
|
|
2002-11-29 11:27:25 +03:00
|
|
|
#include <OS.h>
|
2002-09-20 02:33:58 +04:00
|
|
|
|
|
|
|
|
2004-04-26 21:11:56 +04:00
|
|
|
/* Every module exports a list of module_info structures.
|
|
|
|
* It defines the interface of the module and the name
|
|
|
|
* that is used to access the interface.
|
2002-11-29 11:27:25 +03:00
|
|
|
*/
|
2002-09-20 02:33:58 +04:00
|
|
|
|
2002-11-29 11:27:25 +03:00
|
|
|
typedef struct module_info {
|
2002-09-20 02:33:58 +04:00
|
|
|
const char *name;
|
|
|
|
uint32 flags;
|
|
|
|
status_t (*std_ops)(int32, ...);
|
2002-11-29 11:27:25 +03:00
|
|
|
} module_info;
|
2002-09-20 02:33:58 +04:00
|
|
|
|
2002-11-29 11:27:25 +03:00
|
|
|
/* module standard operations */
|
2002-09-20 02:33:58 +04:00
|
|
|
#define B_MODULE_INIT 1
|
|
|
|
#define B_MODULE_UNINIT 2
|
|
|
|
|
2002-11-29 11:27:25 +03:00
|
|
|
/* module flags */
|
|
|
|
#define B_KEEP_LOADED 0x00000001
|
2002-09-20 02:33:58 +04:00
|
|
|
|
|
|
|
|
2004-04-26 21:11:56 +04:00
|
|
|
/* Use the module_dependency structure to let the
|
|
|
|
* kernel automatically load modules yet depend on
|
|
|
|
* before B_MODULE_INIT is called.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct module_dependency {
|
|
|
|
const char *name;
|
|
|
|
module_info **info;
|
|
|
|
} module_dependency;
|
|
|
|
|
|
|
|
|
2002-09-20 02:33:58 +04:00
|
|
|
#ifdef __cplusplus
|
2002-11-29 11:27:25 +03:00
|
|
|
extern "C" {
|
2002-09-20 02:33:58 +04:00
|
|
|
#endif
|
|
|
|
|
2002-11-29 11:27:25 +03:00
|
|
|
extern status_t get_module(const char *path, module_info **_info);
|
|
|
|
extern status_t put_module(const char *path);
|
2008-04-09 18:36:04 +04:00
|
|
|
extern status_t get_next_loaded_module_name(uint32 *cookie, char *buffer,
|
|
|
|
size_t *_bufferSize);
|
|
|
|
extern void *open_module_list_etc(const char *prefix, const char *suffix);
|
2002-11-29 11:27:25 +03:00
|
|
|
extern void *open_module_list(const char *prefix);
|
|
|
|
extern status_t close_module_list(void *cookie);
|
2008-04-09 18:36:04 +04:00
|
|
|
extern status_t read_next_module_name(void *cookie, char *buffer,
|
|
|
|
size_t *_bufferSize);
|
2002-11-29 11:27:25 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2002-09-20 02:33:58 +04:00
|
|
|
#endif
|
2002-11-29 11:27:25 +03:00
|
|
|
|
|
|
|
#endif /* _MODULE_H */
|