⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module.h

📁 自己做的交叉编译工具!gcc-3.4.5,glibc-2.3.6在ubuntu8.04上做的面向kernel-2.6.28的交叉编译工具
💻 H
📖 第 1 页 / 共 2 页
字号:
	/* Section attributes */	struct module_sect_attrs *sect_attrs;#endif	/* Per-cpu data. */	void *percpu;	/* The command line arguments (may be mangled).  People like	   keeping pointers to this stuff */	char *args;};/* FIXME: It'd be nice to isolate modules during init, too, so they   aren't used before they (may) fail.  But presently too much code   (IDE & SCSI) require entry into the module during init.*/static inline int module_is_live(struct module *mod){	return mod->state != MODULE_STATE_GOING;}/* Is this address in a module? (second is with no locks, for oops) */struct module *module_text_address(unsigned long addr);struct module *__module_text_address(unsigned long addr);/* Returns module and fills in value, defined and namebuf, or NULL if   symnum out of range. */struct module *module_get_kallsym(unsigned int symnum,				  unsigned long *value,				  char *type,				  char namebuf[128]);/* Look for this name: can be of form module:name. */unsigned long module_kallsyms_lookup_name(const char *name);int is_exported(const char *name, const struct module *mod);extern void __module_put_and_exit(struct module *mod, long code)	__attribute__((noreturn));#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code);#ifdef CONFIG_MODULE_UNLOADunsigned int module_refcount(struct module *mod);void __symbol_put(const char *symbol);#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)void symbol_put_addr(void *addr);/* Sometimes we know we already have a refcount, and it's easier not   to handle the error case (which only happens with rmmod --wait). */static inline void __module_get(struct module *module){	if (module) {		BUG_ON(module_refcount(module) == 0);		local_inc(&module->ref[get_cpu()].count);		put_cpu();	}}static inline int try_module_get(struct module *module){	int ret = 1;	if (module) {		unsigned int cpu = get_cpu();		if (likely(module_is_live(module)))			local_inc(&module->ref[cpu].count);		else			ret = 0;		put_cpu();	}	return ret;}static inline void module_put(struct module *module){	if (module) {		unsigned int cpu = get_cpu();		local_dec(&module->ref[cpu].count);		/* Maybe they're waiting for us to drop reference? */		if (unlikely(!module_is_live(module)))			wake_up_process(module->waiter);		put_cpu();	}}#else /*!CONFIG_MODULE_UNLOAD*/static inline int try_module_get(struct module *module){	return !module || module_is_live(module);}static inline void module_put(struct module *module){}static inline void __module_get(struct module *module){}#define symbol_put(x) do { } while(0)#define symbol_put_addr(p) do { } while(0)#endif /* CONFIG_MODULE_UNLOAD *//* This is a #define so the string doesn't get put in every .o file */#define module_name(mod)			\({						\	struct module *__mod = (mod);		\	__mod ? __mod->name : "kernel";		\})#define __unsafe(mod)							     \do {									     \	if (mod && !(mod)->unsafe) {					     \		printk(KERN_WARNING					     \		       "Module %s cannot be unloaded due to unsafe usage in" \		       " %s:%u\n", (mod)->name, __FILE__, __LINE__);	     \		(mod)->unsafe = 1;					     \	}								     \} while(0)/* For kallsyms to ask for address resolution.  NULL means not found. */const char *module_address_lookup(unsigned long addr,				  unsigned long *symbolsize,				  unsigned long *offset,				  char **modname);/* For extable.c to search modules' exception tables. */const struct exception_table_entry *search_module_extables(unsigned long addr);int register_module_notifier(struct notifier_block * nb);int unregister_module_notifier(struct notifier_block * nb);extern void print_modules(void);struct device_driver;void module_add_driver(struct module *, struct device_driver *);void module_remove_driver(struct device_driver *);#else /* !CONFIG_MODULES... */#define EXPORT_SYMBOL(sym)#define EXPORT_SYMBOL_GPL(sym)/* Given an address, look for it in the exception tables. */static inline const struct exception_table_entry *search_module_extables(unsigned long addr){	return NULL;}/* Is this address in a module? */static inline struct module *module_text_address(unsigned long addr){	return NULL;}/* Is this address in a module? (don't take a lock, we're oopsing) */static inline struct module *__module_text_address(unsigned long addr){	return NULL;}/* Get/put a kernel symbol (calls should be symmetric) */#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })#define symbol_put(x) do { } while(0)#define symbol_put_addr(x) do { } while(0)static inline void __module_get(struct module *module){}static inline int try_module_get(struct module *module){	return 1;}static inline void module_put(struct module *module){}#define module_name(mod) "kernel"#define __unsafe(mod)/* For kallsyms to ask for address resolution.  NULL means not found. */static inline const char *module_address_lookup(unsigned long addr,						unsigned long *symbolsize,						unsigned long *offset,						char **modname){	return NULL;}static inline struct module *module_get_kallsym(unsigned int symnum,						unsigned long *value,						char *type,						char namebuf[128]){	return NULL;}static inline unsigned long module_kallsyms_lookup_name(const char *name){	return 0;}static inline int is_exported(const char *name, const struct module *mod){	return 0;}static inline int register_module_notifier(struct notifier_block * nb){	/* no events will happen anyway, so this can always succeed */	return 0;}static inline int unregister_module_notifier(struct notifier_block * nb){	return 0;}#define module_put_and_exit(code) do_exit(code)static inline void print_modules(void){}struct device_driver;struct module;static inline void module_add_driver(struct module *module, struct device_driver *driver){}static inline void module_remove_driver(struct device_driver *driver){}#endif /* CONFIG_MODULES */#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */struct obsolete_modparm {	char name[64];	char type[64-sizeof(void *)];	void *addr;};#ifdef MODULE/* DEPRECATED: Do not use. */#define MODULE_PARM(var,type)						    \struct obsolete_modparm __parm_##var __attribute__((section("__obsparm"))) = \{ __stringify(var), type };static inline void MOD_INC_USE_COUNT(struct module *module){	__unsafe(module);#if defined(CONFIG_MODULE_UNLOAD) && defined(MODULE)	local_inc(&module->ref[get_cpu()].count);	put_cpu();#else	(void)try_module_get(module);#endif}static inline void MOD_DEC_USE_COUNT(struct module *module){	module_put(module);}#define MOD_INC_USE_COUNT	MOD_INC_USE_COUNT(THIS_MODULE)#define MOD_DEC_USE_COUNT	MOD_DEC_USE_COUNT(THIS_MODULE)#else#define MODULE_PARM(var,type)#define MOD_INC_USE_COUNT	do { } while (0)#define MOD_DEC_USE_COUNT	do { } while (0)#endif#define __MODULE_STRING(x) __stringify(x)/* Use symbol_get and symbol_put instead.  You'll thank me. */#define HAVE_INTER_MODULEextern void inter_module_register(const char *, struct module *, const void *);extern void inter_module_unregister(const char *);extern const void *inter_module_get(const char *);extern const void *inter_module_get_request(const char *, const char *);extern void inter_module_put(const char *);#endif /* _LINUX_MODULE_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -