目录:http://www.cnblogs.com/WuCountry/archive/2008/11/15/1333960.html
 
[不提供插图,读者最好从网上下载源书]

5.6. Module Options 模块选项

Kernel modules define their parameters by means of macros such as module_param; see include/linux/moduleparam.h for a list. module_param requires three input parameters, as shown in the following example from drivers/net/sis900.c:
内核模块通过宏的含义来定义他们的参数,例如module_param,参见include/linux/moduleparam.h里有一个列表。moule_param需要本三个参数来输入模块参数,下面是从drivers/net/sis00.c里的一个例子:

...
module_param(multicast_filter_limit, int 0444);
module_param(max_interrupt_work, int, 0444);
module_param(debug, int, 0444);
...

The first input parameter is the name of the parameter to be offered to the user. The second is the type of the parameter (e.g., integer), and the third represents the permissions assigned to the file in /sys to which the parameter will be exported.
第一个输入的参数是提供给用户的使用的模块参数名。第二个参数是模块参数的数据类型,而第三个参数就是指定参数是否暴露给用户通过/sys文件来访问。

This is what you would get when listing the module's directory in /sys:
这些就是你可以从一个模块的目录里得到的:

[root@localhost src]# ls -la /sys/module/sis900/parameters/
total 0
drwxr-xr-x  2 root root    0 Apr  9 18:31 .
drwxr-xr-x  4 root root    0 Apr  9 18:31 ..
-r--r--r--  1 root root    0 Apr  9 18:31 debug
-r--r--r--  1 root root 4096 Apr  9 18:31 max_interrupt_work
-r--r--r--  1 root root 4096 Apr  9 18:31 multicast_filter_limit
[root@localhost src]#

Each module is assigned a directory in /sys/modules. The subdirectory /sys/modules/module/parameters holds a file for each parameter exported by module. The previous snapshot from drivers/net/sis900.c shows three options that are readable by anyone, but not writable (they cannot be changed).
每一个模块都在/sys/modules里给定了一个目录。/sys/modules/module/parameters这个子目录就为模块暴露的每个参数保存了一个文件,前面的快照就是drivers/net/sis900.c中的,显示了三个任何人都可以读取的选项。但不能修改。

Permissions on /sys files (and on /proc files, incidentally) are defined using the same syntax as common files, so you can specify read, write, and execute permissions for the owner, the group, and everybody else. A value of 400 means, for example, read access for the owner (who is the root user) and no other access for anyone. When a value of 0 is assigned, no one has any permissions and you would not even see the file in /sys.
/sys文件(顺便说一下,/proc文件也一样)的访问权限可以用普通文件同样的语法来定义。所以,你可以为文件的所有者,组,或者所有人指定读,写,以及执行权限。例如,一个400的值就是指所有者的读权限(谁是root用户),而其它人没有任何权限。当一个0值被指定时,没有人被许可,你甚至连/sys里的文件都看不到。

If the component programmer wants the user to be able to read the values of parameters, she must give at least read permission. She can also provide write permission to allow users to modify values. However, take into account that the module that exports the parameter is not notified about any change to the file, so the module must have a mechanism to detect the change or be able to cope with changes.
如果组件的程序员想让用户可以读参数的值,他必须至少给一个读权限。他也样可以通过给定写权限让用户来修改参数的值。然而,考虑模块暴露给用户的参数不能通过文件做任何的修改,所以模块必须有一个机制能检测到这些修改,从而处理这些改变。

For a detailed description of the /sys interface, refer to Linux Device Drivers.
关于/sys接口的详细介绍,可以参考Linux Device Drivers.

词组 :
take into account
v.
重视, 考虑

转载于:https://www.cnblogs.com/WuCountry/archive/2009/02/17/1392796.html

[译]5.6. Module Options 模块选项相关推荐

  1. options模块介绍

    一. options是什么? 是tornado中为我们提供好的一个模块. 二. options的作用? 用来定义, 存储, 转换全局参数. 即定义变量 三. options如何使用? import t ...

  2. JS设计模式之Module(模块)模式、Revealing Module(揭示模块)模式

    Module(模块)模式 概念 Module模式最初被定义为一种在传统软件工程中为类提供私有和共有封装的方法. 通过这种方式,能够使一个单独的对象拥有共有/私有方法和变量,从而屏蔽来自全局作用局的特殊 ...

  3. php 投票 排序,关于phpcms v9投票模块选项排序问题修改_PHP教程

    关于phpcms v9投票模块选项排序listorder设定问题修改,小弟主要修改了三个文件三处地方. 此方法我觉得自己已经够用,欢迎大家来拍砖. 主要修改三个文件: 1.phpcms\modules ...

  4. php+投票排序,关于phpcms v9投票模块选项排序listorder设定问题修改

    关于phpcms v9投票模块选项排序listorder设定问题修改,小弟主要修改了三个文件三处地方. 此方法我觉得自己已经够用,欢迎大家来拍砖. 主要修改三个文件: 1.phpcms\modules ...

  5. 【Python问题】Python 导入模块的三种方式ModuleNotFoundError: No module named ‘模块名‘

    Python 导入模块的三种方式ModuleNotFoundError: No module named '模块名' 问题 一.Python解释器查找模块文件的过程. 二.解决方法 记录一下 大家可以 ...

  6. devServer.proxy完整options配置选项

    target:要使用url模块解析的url字符串 forward:要使用url模块解析的url字符串 agent:要传递给http.squest的对象(请参阅Node的https代理和http代理对象 ...

  7. Pycharm中 No module ‘自定义模块‘ 的问题(mmrotate)

    问题情况:这多半发生在已经构建好的项目,复制项目到新的路径下再次运行就会出现你自定义的包和模块文件"找不到"了 其原因是:在该项目下有个 .idea 文件夹,其中的文件存储了先前构 ...

  8. NS3 Logging Module 日志模块

    转自:http://blog.sina.com.cn/s/blog_7ec2ab360102wx5z.html 一. 日志概述 日志是快速获得脚本和模型的调试信息.警告信息.错误信息或者其他信息的首选 ...

  9. [译] 漫画:深入浅出 ES 模块

    原文地址:ES modules: A cartoon deep-dive 原文作者:Lin Clark 译文出自:掘金翻译计划 本文永久链接:github.com/xitu/gold-m- 译者:st ...

  10. 为什么电商云产品需要 Assisted Service Module (ASM) 模块的支持

    SAP Commerce Assisted Service Module (ASM) 使组织能够在所有渠道中提供全面的引导式采购流程. ASM 与 SAP Commerce B2C Accelerat ...

最新文章

  1. LINUX在逻辑卷基础加盘操作步骤
  2. C# .net 下拉框显示提示内容-【ComboBox】
  3. jboss启动之奇葩问题
  4. Mysql数据库正则表达式
  5. 【DP】【四边形不等式】邮局(P4767)
  6. kali利用msf工具对ms08-067漏洞入侵靶机(win xp2)
  7. python 发送邮件的两种方式【终极篇】
  8. 改变网页标签图片(favicon)
  9. SQL数值计算函数之round(X,D)
  10. 翻译:Swift 5编写并发编程,并发解决方案和异步Operation
  11. C#.Net网络程序开发-Socket篇(转)
  12. 冗余链路引起广播风暴和MAC地址表不稳定
  13. 信道估计---LS、MMSE、LMMSE准则
  14. JavaWeb整合萤石云(二)
  15. 用PS制作透明背景的电子签名
  16. 未来10年35项最值得你期待的技术
  17. 逾期的人真有这么多吗?
  18. 迭代器(list迭代器的实现)
  19. 常见面试题整理--操作系统篇
  20. Redis 客户端连接服务器失败

热门文章

  1. cocos studio 基本功能添加——场景(Scene)
  2. 罗盘时钟制作代码_抖音超火的姓氏罗盘壁纸,安卓和苹果都能做
  3. Flutter实战之Hello Flutter
  4. UDP通信的简单实现(程序)
  5. 实时即未来!Flink Forward Asia 2021 议程正式上线!
  6. c语言字符串如何调换位置,c语言字符串从第m个位置开始复制
  7. 子类发送消息_RocketMQ生产消息源码解析
  8. 非法关机linux分辨率丢失,非法关机造成文件系统损坏,怎么办?请教:附图片...
  9. 凯立德地图导航2020年最新版_曾是导航领域“领头羊”的凯立德,如今为何岌岌可危?...
  10. linux django 安装mysql_Linux下安装Python3和django并配置mysql作为django默认服务器