模块参数和模块之间的通讯

一.模块参数

  模块参数需要在加载模块时指定,e.g. insmod xxxx.ko param=1

  定义:module_param(参数名,参数数据类型,参数读写权限);

    e.g.      static long a =1;

        static int b =1;

        module_param(a,long,S_IRUGO);

        module_param(b,int,S_IRUGO);

 

二.模块的文件格式ELF

  

 .test 代码段

 .data 数据段

 Section Table 所有段的信息

 .symtab 符号表

 

三.模块之间的通讯

  符号导出用 EXPORT_SYMBOL();

  如下,先加载模块2,后加载模块1

  

版权声明:本文为hello2mhb原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/hello2mhb/p/3364197.html