All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Guillaume <jean-guillaume.paradis@ericsson.ca>
To: linux-kernel@vger.kernel.org
Subject: Simple Procfs question: Triggering an "action" when opening a directory instead of a file (with seqfile.h)???
Date: Mon, 29 Sep 2003 13:40:03 -0400	[thread overview]
Message-ID: <3F786E73.6010306@ericsson.ca> (raw)

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?

             reply	other threads:[~2003-09-29 17:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-29 17:40 Jean-Guillaume [this message]
2003-09-29 18:03 ` Simple Procfs question: Triggering an "action" when opening a directory instead of a file (with seqfile.h)??? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F786E73.6010306@ericsson.ca \
    --to=jean-guillaume.paradis@ericsson.ca \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.