linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Procfs open hook bug.
@ 2003-07-01 10:55 Peter Enderborg
  2003-07-01 18:33 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Enderborg @ 2003-07-01 10:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Theodore Ts'o, Linus Torvalds

I have done this little patch for the procfs_example.c

diff procfs_example.c 
kernels/linux-2.4.20/Documentation/DocBook/procfs_example.c
87,91d86
< static int open_qp(struct inode * inode, struct file * file)
< {
<   printk("Open my node %p %p \n",inode,file);
<   return -EINVAL;
< }
180c175
<       foo_file->proc_fops->open=open_qp;
---
 >

And when loading this module. The procfs gets broken. I get EINVAL for 
open on
/proc/meminfo and all other procfs info. Why? Should procfs inodes don't 
have full
filesematics? And it don't help to unload the module.

Strange. And a look in generic.c in fs/proc/

static struct file_operations proc_file_operations = {
    llseek:        proc_file_lseek,
    read:        proc_file_read,
    write:        proc_file_write,
};

Is this saying that we can not have the other fops on procfs inodes? No 
ioctl,open ?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Procfs open hook bug.
  2003-07-01 10:55 Procfs open hook bug Peter Enderborg
@ 2003-07-01 18:33 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2003-07-01 18:33 UTC (permalink / raw)
  To: Peter Enderborg
  Cc: Linux Kernel Mailing List, Theodore Ts'o, Linus Torvalds

On Maw, 2003-07-01 at 11:55, Peter Enderborg wrote:
> And when loading this module. The procfs gets broken. I get EINVAL for 
> open on
> /proc/meminfo and all other procfs info. Why? Should procfs inodes don't 
> have full
> filesematics? And it don't help to unload the module.

If you look at other file systems you'll see they swap the file
operations pointer


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-01 18:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-01 10:55 Procfs open hook bug Peter Enderborg
2003-07-01 18:33 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).