All of lore.kernel.org
 help / color / mirror / Atom feed
* Simple Procfs question: Triggering an "action" when opening a directory instead of a file (with seqfile.h)???
@ 2003-09-29 17:40 Jean-Guillaume
  2003-09-29 18:03 ` viro
  2003-10-09 15:27 ` ProcFs: FORCING remove_proc_entry even if the directory is used (busy) ?? Jean-Guillaume
  0 siblings, 2 replies; 4+ messages in thread
From: Jean-Guillaume @ 2003-09-29 17:40 UTC (permalink / raw)
  To: linux-kernel

Hello everybody :)

I need some help on this one, I couldn't find anything on google or in 
the archives of the mailing list. Here it goes:

I want to trigger an action when "opening" a directory of the procfs. 
This is easy for files, but how is it done for directories...???

With files this is simple, all we have to do is to change some structs:

static struct file_operations FILE_fops = {
    open:        FILE_open,
    read:        seq_read,
    llseek:        seq_lseek,
    release:    seq_release,
};
and
static struct seq_operations FILE_ops = {
    start:    FILE_start,
    next:    FILE_next,
    stop:    FILE_stop,
    show:    FILE_show
};
and insert some code.


But for directories, the same doesn't work:

tipcDir  = proc_mkdir("tipc",&proc_root);
   if (tipcDir) {
      tipcDir->proc_fops = &tipcDir_fops;
   }

...

because when tyring to enter the directory of tipcDir, it says "tipc not 
a directory", probably because I try to use a "fops" (file operation). 
But I can't find any other ways to do this

Any ideas?

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

* Re: Simple Procfs question: Triggering an "action" when opening a directory instead of a file (with seqfile.h)???
  2003-09-29 17:40 Simple Procfs question: Triggering an "action" when opening a directory instead of a file (with seqfile.h)??? Jean-Guillaume
@ 2003-09-29 18:03 ` viro
  2003-09-29 18:40   ` Jean-Guillaume
  2003-10-09 15:27 ` ProcFs: FORCING remove_proc_entry even if the directory is used (busy) ?? Jean-Guillaume
  1 sibling, 1 reply; 4+ messages in thread
From: viro @ 2003-09-29 18:03 UTC (permalink / raw)
  To: Jean-Guillaume; +Cc: linux-kernel

On Mon, Sep 29, 2003 at 01:40:03PM -0400, Jean-Guillaume wrote:
> Hello everybody :)
 
> I need some help on this one, I couldn't find anything on google or in 
> the archives of the mailing list. Here it goes:
> 
> I want to trigger an action when "opening" a directory of the procfs. 
> This is easy for files, but how is it done for directories...???

With a separate filesystem.  Don't do that on procfs, it's messy enough as
it is.

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

* Re: Simple Procfs question: Triggering an "action" when opening a directory instead of a file (with seqfile.h)???
  2003-09-29 18:03 ` viro
@ 2003-09-29 18:40   ` Jean-Guillaume
  0 siblings, 0 replies; 4+ messages in thread
From: Jean-Guillaume @ 2003-09-29 18:40 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel

viro@parcelfarce.linux.theplanet.co.uk wrote:

>On Mon, Sep 29, 2003 at 01:40:03PM -0400, Jean-Guillaume wrote:
>  
>
>>Hello everybody :)
>>    
>>
> 
>  
>
>>I need some help on this one, I couldn't find anything on google or in 
>>the archives of the mailing list. Here it goes:
>>
>>I want to trigger an action when "opening" a directory of the procfs. 
>>This is easy for files, but how is it done for directories...???
>>    
>>
>
>With a separate filesystem.  Don't do that on procfs, it's messy enough as
>it is.
>  
>

lol, ok then :)

I have indeed noticed some funny things with the procfs. Like, doing a 
"ls" on my tipc dir  said the directory was empty, but I could do a "vi 
/proc/tipc/file" and see the content of file. Invisible file? :)



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

* ProcFs: FORCING  remove_proc_entry even if the directory is used (busy)  ??
  2003-09-29 17:40 Simple Procfs question: Triggering an "action" when opening a directory instead of a file (with seqfile.h)??? Jean-Guillaume
  2003-09-29 18:03 ` viro
@ 2003-10-09 15:27 ` Jean-Guillaume
  1 sibling, 0 replies; 4+ messages in thread
From: Jean-Guillaume @ 2003-10-09 15:27 UTC (permalink / raw)
  Cc: linux-kernel

Hi all,

    I have a program that automaticaly recreate a directory in /proc, 
based on some events. To do this, I do a remove_proc_entry, and then 
recreate the directory.

    However, if someone is using a console and is currently IN my /proc 
directory, remove_proc_entry fails, saying that the dir is "busy".

    Any way to force the deletion? Or any ideas for workarounds?


    Many thanks

       Jena-Guillaume

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

end of thread, other threads:[~2003-10-09 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-29 17:40 Simple Procfs question: Triggering an "action" when opening a directory instead of a file (with seqfile.h)??? Jean-Guillaume
2003-09-29 18:03 ` viro
2003-09-29 18:40   ` Jean-Guillaume
2003-10-09 15:27 ` ProcFs: FORCING remove_proc_entry even if the directory is used (busy) ?? Jean-Guillaume

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.