file operations in kernel mode

Submitted by ananth
on February 13, 2005 - 12:45am

Hi,
I wanted to read from a file a line at a time & fill my data structure in my kernel module.I want something like fgets.
1 more thing.I have intercepted open system call.If the opened file is in write/append mode and if that file is in my datastructure,i want to make a copy of it.How to do it?please help me
1 way i got was to use filp function(which is exported into kernel mode)But that fails if flags=33345(which mode is it?i think its O_WRONLY|O_CREAT|O_TRUNC).
Please suggest some easy way of doing file operations in kernel mode.
Ananth
NITK