假设我有一个名为“hello”的内核模块。
例如:
static struct file_operations hello_fops = {
.open = hello_open,
.read = hello_read,
.release = hello_release,
};
static ssize_t hello_read(struct file *f, char *buf, size_t len, loff_t *offset){
// some code here
}
当你从/dev/hello
字符设备文件中读取时,hello_read
函数会被调用,但是函数的参数是从哪里来的呢?