public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Reading from file in module fails
@ 2004-05-03 10:50 Libor Vanek
  2004-05-03 11:35 ` Erik Mouw
  0 siblings, 1 reply; 7+ messages in thread
From: Libor Vanek @ 2004-05-03 10:50 UTC (permalink / raw)
  To: linux-kernel

Hi,
I'm writing module which needs to read from file. I've got this simple sample code:

char buffer[4096];
ssize_t read;
file *f;
f = filp_open("/some/file",O_RDONLY | O_LARGEFILE,0);
f->f_pos = 0;
read = vfs_read(f,(char __user *) buffer,4096,&f->f_pos);

but here read value is "-14" (-EINVAL?) Does anybody has idea what's wrong? 

It seems that file is opened OK (I've tested:
if (f->f_op->read) {
	read = f->f_op->read(file, buf, count, pos);
}
and result was the same - so I assume that file is opened OK and structure "file f" is filled correctly.


I need to copy files (yes - I know that kernel shouldn't do this but I REALLY need) and there is nothing like "sys_copy" and "sys_sendfile" is not exported (which seems strange to me but there is nothing like EXPORT_SYMBOL(sys_sendfile) in fs/read_write.c


Thanks,
Libor Vanek


^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <1RJl8-Eo-5@gated-at.bofh.it>]

end of thread, other threads:[~2004-05-03 16:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-03 10:50 Reading from file in module fails Libor Vanek
2004-05-03 11:35 ` Erik Mouw
2004-05-03 11:43   ` Libor Vanek
2004-05-03 11:48     ` Erik Mouw
2004-05-03 12:07       ` root
2004-05-03 12:41     ` Jan-Benedict Glaw
     [not found] <1RJl8-Eo-5@gated-at.bofh.it>
     [not found] ` <1RJXT-19T-37@gated-at.bofh.it>
     [not found]   ` <1RK7v-1gJ-9@gated-at.bofh.it>
     [not found]     ` <1RL3A-23k-23@gated-at.bofh.it>
2004-05-03 16:55       ` Pascal Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox