use the -newos toolchain even if -elf is present.
[newos.git] / include / kernel / module.h
blobb1ed9f59ef4ae0ed040afdf2a98f171f0f2cb990
1 /*
2 ** Copyright 2001-2002, Thomas Kurschel. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
6 #ifndef _KERNEL_MODULE_H
7 #define _KERNEL_MODULE_H
9 #include <kernel/kernel.h>
10 #include <boot/stage2.h>
12 #define MODULE_CURR_VERSION 0x10000
13 // if set, module gets neither uninit'd nor unloaded
14 #define MODULE_KEEP_LOADED 1
16 // user function list and management function lists are separated
17 struct module_header {
18 const char *name; // with path (for clients convinience)
19 uint32 version;
20 uint32 flags;
21 void *interface; // pointer to function list
23 int ( *init )( void );
24 int ( *uninit )( void );
27 typedef struct modules_cookie {} *modules_cookie;
29 typedef struct module_header module_header;
31 // to become a module, export this symbol
32 // it has to be a null-terminated list of pointers to module headers
33 extern module_header *modules[];
35 // flags must be 0
36 extern int module_get( const char *name, int flags, void **interface );
37 extern int module_put( const char *name );
39 extern modules_cookie module_open_list( const char *prefix );
40 extern int read_next_module_name( modules_cookie cookie, char *buf, size_t *bufsize );
41 extern int close_module_list( modules_cookie cookie );
44 // boot init
45 // XXX this is very private, so move it away
46 extern int module_init( kernel_args *ka, module_header **sys_module_headers );
48 #endif