views:

60

answers:

1

Hi All,

I wrote a kernel module and a user that opens it with O_RDWR mode,

in the module_permission's func i get int op parameter ,

and would like to know if its value is the same as O_RDWR or maybe the system call open changes it to another known value , and if so where can i find it..

thanks a lot..

+1  A: 

You mean your module exports a device node that the user opens as a file with O_RDWR? In this case if you are using a newer kernel, the mode is in the struct file* parameter passed to your module's open call:

int my_open(struct inode* inode, struct file* filep) 
{
    unsigned mode = file->f_mode;
    //... 
}
Inso Reiges