diff options
author | H. Peter Anvin <hpa@zytor.com> | 2003-11-24 22:09:04 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2003-11-24 22:09:04 +0000 |
commit | 94a47c241fe5f4d00a14b5fc45c3d07cb99603ea (patch) | |
tree | d32f6aa71d16dc536e361c4b96eef07b14f9652c | |
parent | 2c7dabc54464a513a4dd13ccb7958597fded231d (diff) | |
download | klibc-94a47c241fe5f4d00a14b5fc45c3d07cb99603ea.tar.gz |
Switch to new 2.6 module interface -- much cleanerklibc-0.87
-rw-r--r-- | klibc/SYSCALLS | 5 | ||||
-rw-r--r-- | klibc/include/sys/module.h | 158 | ||||
-rw-r--r-- | klibc/syscommon.h | 1 |
3 files changed, 2 insertions, 162 deletions
diff --git a/klibc/SYSCALLS b/klibc/SYSCALLS index 0e4a32cf331e3..0be1b4425abfb 100644 --- a/klibc/SYSCALLS +++ b/klibc/SYSCALLS @@ -139,9 +139,8 @@ int mprotect(const void *, size_t, int) int uname(struct utsname *) int setdomainname(const char *, size_t) int sethostname(const char *, size_t) -int init_module(const char *, struct module *) -<!ia64> void * create_module(const char *, size_t) -int delete_module(const char *) +long init_module(void *, unsigned long, const char *) +long delete_module(const char *, unsigned int) <!ia64> int query_module(const char *, int, void *, size_t, size_t) int reboot::__reboot(int, int, int, void *) int syslog::klogctl(int, char *, int) diff --git a/klibc/include/sys/module.h b/klibc/include/sys/module.h deleted file mode 100644 index 96b3b5994502b..0000000000000 --- a/klibc/include/sys/module.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * sys/module.h - * - * This is a bastardized version of linux/module.h, since the latter - * doesn't have __KERNEL__ guards where it needs them... - */ - -#ifndef _SYS_MODULE_H -#define _SYS_MODULE_H - -/* - * Dynamic loading of modules into the kernel. - * - * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996 - */ - -#include <asm/atomic.h> - -/* Don't need to bring in all of uaccess.h just for this decl. */ -struct exception_table_entry; - -/* Used by get_kernel_syms, which is obsolete. */ -struct kernel_sym -{ - unsigned long value; - char name[60]; /* should have been 64-sizeof(long); oh well */ -}; - -struct module_symbol -{ - unsigned long value; - const char *name; -}; - -struct module_ref -{ - struct module *dep; /* "parent" pointer */ - struct module *ref; /* "child" pointer */ - struct module_ref *next_ref; -}; - -/* TBD */ -struct module_persist; - -struct module -{ - unsigned long size_of_struct; /* == sizeof(module) */ - struct module *next; - const char *name; - unsigned long size; - - union - { - atomic_t usecount; - long pad; - } uc; /* Needs to keep its size - so says rth */ - - unsigned long flags; /* AUTOCLEAN et al */ - - unsigned nsyms; - unsigned ndeps; - - struct module_symbol *syms; - struct module_ref *deps; - struct module_ref *refs; - int (*init)(void); - void (*cleanup)(void); - const struct exception_table_entry *ex_table_start; - const struct exception_table_entry *ex_table_end; -#ifdef __alpha__ - unsigned long gp; -#endif - /* Members past this point are extensions to the basic - module support and are optional. Use mod_member_present() - to examine them. */ - const struct module_persist *persist_start; - const struct module_persist *persist_end; - int (*can_unload)(void); - int runsize; /* In modutils, not currently used */ - const char *kallsyms_start; /* All symbols for kernel debugging */ - const char *kallsyms_end; - const char *archdata_start; /* arch specific data for module */ - const char *archdata_end; - const char *kernel_data; /* Reserved for kernel internal use */ -}; - -struct module_info -{ - unsigned long addr; - unsigned long size; - unsigned long flags; - long usecount; -}; - -/* Bits of module.flags. */ - -#define MOD_UNINITIALIZED 0 -#define MOD_RUNNING 1 -#define MOD_DELETED 2 -#define MOD_AUTOCLEAN 4 -#define MOD_VISITED 8 -#define MOD_USED_ONCE 16 -#define MOD_JUST_FREED 32 -#define MOD_INITIALIZING 64 - -/* Values for query_module's which. */ - -#define QM_MODULES 1 -#define QM_DEPS 2 -#define QM_REFS 3 -#define QM_SYMBOLS 4 -#define QM_INFO 5 - -/* Can the module be queried? */ -#define MOD_CAN_QUERY(mod) (((mod)->flags & (MOD_RUNNING | MOD_INITIALIZING)) && !((mod)->flags & MOD_DELETED)) - -/* When struct module is extended, we must test whether the new member - is present in the header received from insmod before we can use it. - This function returns true if the member is present. */ - -#define mod_member_present(mod,member) \ - ((unsigned long)(&((struct module *)0L)->member + 1) \ - <= (mod)->size_of_struct) - -/* - * Ditto for archdata. Assumes mod->archdata_start and mod->archdata_end - * are validated elsewhere. - */ -#define mod_archdata_member_present(mod, type, member) \ - (((unsigned long)(&((type *)0L)->member) + \ - sizeof(((type *)0L)->member)) <= \ - ((mod)->archdata_end - (mod)->archdata_start)) - - -/* Check if an address p with number of entries n is within the body of module m */ -#define mod_bound(p, n, m) ((unsigned long)(p) >= ((unsigned long)(m) + ((m)->size_of_struct)) && \ - (unsigned long)((p)+(n)) <= (unsigned long)(m) + (m)->size) - -/* Backwards compatibility definition. */ - -#define GET_USE_COUNT(module) (atomic_read(&(module)->uc.usecount)) - -/* Poke the use count of a module. */ - -#define __MOD_INC_USE_COUNT(mod) \ - (atomic_inc(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED|MOD_USED_ONCE) -#define __MOD_DEC_USE_COUNT(mod) \ - (atomic_dec(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED) -#define __MOD_IN_USE(mod) \ - (mod_member_present((mod), can_unload) && (mod)->can_unload \ - ? (mod)->can_unload() : atomic_read(&(mod)->uc.usecount)) - -/* Indirect stringification. */ - -#define __MODULE_STRING_1(x) #x -#define __MODULE_STRING(x) __MODULE_STRING_1(x) - -#endif /* _SYS_MODULE_H */ diff --git a/klibc/syscommon.h b/klibc/syscommon.h index 224e240e3831f..916d4eb0c02af 100644 --- a/klibc/syscommon.h +++ b/klibc/syscommon.h @@ -15,7 +15,6 @@ #include <sys/dirent.h> #include <sys/klog.h> #include <sys/mman.h> -#include <sys/module.h> #include <sys/resource.h> #include <sys/select.h> #include <sys/stat.h> |