Re: opening files in /proc, and modules

2001-03-08 Thread Alexander Viro
On 8 Mar 2001, Michael Rothwell wrote: > Figured it out -- I think. This appears to be the answer: > > In struct proc_dir_entry,set the fill_inode function pointer to a > callback to handle refcounts. > > struct proc_dir_entry > { > ... > void (*fill_inode)(struct inode *, int); > ... > }; [s

Re: opening files in /proc, and modules

2001-03-08 Thread Michael Rothwell
Sweet! Thanks! I'm working on 2.2 for now, but the 2.4 API looks nicer... :) -M On 08 Mar 2001 11:43:24 -0500, Alexander Viro wrote: > > > On 8 Mar 2001, Michael Rothwell wrote: > > > Figured it out -- I think. This appears to be the answer: > > > > In struct proc_dir_entry,set the fill_ino

Re: opening files in /proc, and modules

2001-03-08 Thread Michael Rothwell
Figured it out -- I think. This appears to be the answer: In struct proc_dir_entry,set the fill_inode function pointer to a callback to handle refcounts. struct proc_dir_entry { ... void (*fill_inode)(struct inode *, int); ... }; void fill_inode_cb(struct inode *i, int v) { if (v==0) { MOD

Re: opening files in /proc, and modules

2001-03-08 Thread Brian Gerst
Michael Rothwell wrote: > > How can I detect that open() has been called on a file in procfs that a > module provides? If I modprobe my module, open one or more if its proc > entries, then rmmod the module while the proc files are still open, then > the deletion of those entries is deferred. When

opening files in /proc, and modules

2001-03-08 Thread Michael Rothwell
How can I detect that open() has been called on a file in procfs that a module provides? If I modprobe my module, open one or more if its proc entries, then rmmod the module while the proc files are still open, then the deletion of those entries is deferred. When I close the file(s), the kernel oo