【发布时间】:2014-04-24 22:23:23
【问题描述】:
有没有办法将参数从挂载系统调用传递到内核模块。 就像 mount -t ext2 abc=/Dir/ target。
这里我想将参数 abc 从挂载传递到内核模块。
谢谢
【问题讨论】:
标签: linux filesystems kernel kernel-module mount
有没有办法将参数从挂载系统调用传递到内核模块。 就像 mount -t ext2 abc=/Dir/ target。
这里我想将参数 abc 从挂载传递到内核模块。
谢谢
【问题讨论】:
标签: linux filesystems kernel kernel-module mount
如果您开发自己的文件系统,您只能让mount 为您做一些事情。
在这种情况下,当您调用register_filesystem 时,您需要给它一个file_system_type,其中包含一个.mount 字段。 Mount 是具有此原型的函数:
struct dentry *some_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data);
您可以通过data 参数访问使用-o 传递的数据以进行挂载。
如果您只想将一些数据从用户区传递到您的模块,则更简单的方法是使用module_param:
static char *abc = "";
module_param(abc, charp, 0000);
MODULE_PARM_DESC(abc, "Some string that you give to insmod");
【讨论】: