3
votes

I am trying to write a module to read a file (in kernel mode). However, problem is kernel version 2.6.30 and after does, not export sys_read()

I have changed code to

  • 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)

to read file.

here I am having confusion in use of parameters int rights in file_open() (is it same as mode in 'open()').

Please suggest me with an example or help me to get man page for file_open().

1

1 Answers

1
votes

Yes, they are same.

From 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 passes its third argument int rights as the third argument to filp_open, i.e., int mode.

file_open is defined by you as a wrapper function to underlying VFS level function filp_open. So, you can't expect to find a manpage on file_open.