我正在尝试写一个 module读取文件(在内核模式下)。 但是,问题是内核版本 2.6.30 及之后,不导出 sys_read()
我已将代码更改为
struct file* file_open(const char* path, int flags, int rights)
&int file_read(struct file* file, unsigned long long offset, unsigned char* data, unsigned int size)
读取文件。
here我对 file_open()
中参数 int rights
的使用感到困惑(它是否与“open()”中的 mode
相同)。
请给我一个示例或帮助我获取 file_open()
的手册页。
最佳答案
是的,它们是一样的。
来自 rz2 man pages for FILP_OPEN ,
struct file * filp_open(const char * filename, int flags, int mode);
ARGUMENTS
- filename: path to open .
- flags: open flags as per the open(2) second argument.
- mode: mode for the new file if O_CREAT is set, else ignored.
file_open
将其第三个参数 int rights
作为第三个参数传递给 filp_open
,即 int mode
。
file_open
由您定义为底层 VFS 级函数 filp_open
的包装函数。因此,您不能指望在 file_open
上找到联机帮助页。
关于c - 我在哪里可以获得 `struct file* file_open(const char* path, int flags, int rights)` 的手册页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34327207/