Linux驱动程序中THIS_MODULE 的定义
struct module
{
enum module_state state;
struct list_head list;
char name[MODULE_NAME_LEN];
struct module_kobject mkobj;
struct module_param_attrs *param_attrs;
const char *version;
const char *srcversion;
const struct kernel_symbol *syms;
unsigned int num_syms;
const unsigned long *crcs;
const struct kernel_symbol *gpl_syms;
unsigned int num_gpl_syms;
const unsigned long *gpl_crcs;
unsigned int num_exentries;
const struct exception_table_entry *extable;
int (*init)(void);
void *module_init;
void *module_core;
unsigned long init_size, core_size;
unsigned long init_text_size, core_text_size;
struct mod_arch_specific arch;
int unsafe;
int license_gplok;
#ifdef CONFIG_MODULE_UNLOAD
struct module_ref ref[NR_CPUS];
struct list_head modules_which_use_me;
struct task_struct *waiter;
void (*exit)(void);
#endif
#ifdef CONFIG_KALLSYMS
Elf_Sym *symtab;
unsigned long num_symtab;
char *strtab;
struct module_sect_attrs *sect_attrs;
#endif
void *percpu;
char *args;
};
|
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
unsigned int cpu = get_cpu();
struct module *mod;
printk(KERN_ALERT "this module: %p==%p\n", &__this_module, THIS_MODULE );
printk(KERN_ALERT "module state: %d\n", THIS_MODULE->state );
printk(KERN_ALERT "module name: %s\n", THIS_MODULE->name );
list_for_each_entry(mod, *(&THIS_MODULE->list.prev), list )
printk(KERN_ALERT "module name: %s\n", mod->name );
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "module state: %d\n", THIS_MODULE->state );
}
module_init(hello_init);
module_exit(hello_exit);
|
Linux驱动程序中THIS_MODULE 的定义相关推荐
- Linux中THIS_MODULE宏定义详解
一直都在耿耿于怀,这个THIS_MODULE到底是个什么玩意,linux内核中无处不在的东西.今天上网搜了一下,算是基本明白了.网上牛人写的已经比较详细,另外目前暂时没有时间往更深层次分析,所以直接贴 ...
- Linux 内核中的宏定义
Linux 内核中的宏定义 rtoax 日期 内核版本:linux-5.10.13 注释版代码:https://github.com/Rtoax/linux-5.10.13 __attribute__ ...
- Linux驱动程序中的file,inode,file_operations三大结构体
本文允许转载,但请标明出处:http://blog.csdn.net/u010944778/article/details/45077565 file_operations: 该结构是将系统调 ...
- linux shell 中数组的定义和for循环遍历
linux shell中的语法和普通编程语言 c/c++ java 的不太一样,平时用的不多,所以总是记不住,写脚本才会去查怎么用.今天突然被问到数组怎么去遍历.平时写shell脚本也经常遍历数组, ...
- 关于Linux Kernel中的宏定义likely和unlikely
在Linux kernel的源代码中,经常能见到if(likely(x))或if(unlikely(x))之类的用法,其确切含义需要说明一下,以便更好的理解kernel的源代码. likely与unl ...
- linux 标准函数注释,Linux 驱动程序中相关函数注释汇总(跟新中)
1.ARRAY_SIZE 宏,是求设备结构体中设备的个数 定义在linux/kernel.h中 #define ARRAY_SIZE(arr)(sizeof(arr)/sizeof((arr)[0]) ...
- Linux驱动程序中的并发控制
<临界区> a:对共享资源进行访问的代码称为临界区. <原子操作> a:原子操作用于执行轻量级,仅仅执行一次的的操作比如修改计数器,有条件的增加值,设置某一位.所谓原子操作是指 ...
- linux 内核 THIS_MODULE宏定义详解
结构体struct module在内核中代表一个内核模块,通过insmod(实际执行init_module系统调用)把自己编写的内核模块插入内核时,模块便与一个 struct module结构体相关联 ...
- 论文中文翻译——Double-Fetch情况如何演变为Double-Fetch漏洞:Linux内核中的双重获取研究
本论文相关内容 论文下载地址--Web Of Science 论文中文翻译--How Double-Fetch Situations turn into Double-Fetch Vulnerabil ...
最新文章
- 深度干货!如何将深度学习训练性能提升数倍?
- 树莓派上利用 Tensorflow 实现小车的自动驾驶
- 巧用组策略技术禁用办公室QQ聊天
- OpenCV—矩阵数据类型转换cv::convertTo
- (1) 基于tomcat7和jdk1.7的websocket启动
- python docx 合并文档 图片_Python+pymupdf处理PDF文档案例6则
- net 架构师-数据库-sql server-003-T-SQL 基本语句
- c语言的局部指针,C中局部变量指针问题
- Elasticsearch 不属于 Elastic
- php5.4安装教程,centos php 5.4 安装教程
- 策划通不过,不是老板的错
- 电脑蓝牙音箱,有效解决笔记本电脑连接不了蓝牙音箱的办法
- 设置国内maven镜像仓库
- python大学课本_求推荐一本大学Python教材|python基础教程用书
- win7笔记本电脑做wifi热点
- 为什么我们买了股票就不涨被套,股票割肉就飞了?
- 银行卡系统(面向对象进阶习题)
- VBA生成KML文件
- 2021-05-24 昨日三省吾身
- HDU 6656 Kejin Player(期望)
热门文章
- 基于头皮脑电的癫痫分类
- 爆改100多元卡西欧,可测速、测温、测海拔,一点不输智能运动表
- @所有城市:想建AI智算中心的看这里!国家认可的那种
- 边打“游戏”边学Vim!这款在线、交互的练习工具火了
- 去月球“挖土”咯!今天发射的嫦娥五号实现四个“首次”,下个月将样品带回地球...
- 新款iPhone,比绿更绿
- 鱼和熊掌可以兼得,云原生开启“数据库大数据一体化”新时代
- 自动驾驶公交车开上苏州街头,这次不是“试运营”了,市民乘车依然免费
- 硅谷顶级VC发声:AI技术公司毛利实在太低,人工和算力成本太高
- 全球首个AI驾校教练+驾照考官已上岗,装手机里就能用,再也不怕挨教练骂了...