public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.4 Q: list of open files per inode?
@ 2007-07-19  9:01 Jacob A
  2007-07-19 11:41 ` Jan Engelhardt
  0 siblings, 1 reply; 11+ messages in thread
From: Jacob A @ 2007-07-19  9:01 UTC (permalink / raw)
  To: linux-kernel

 How can a device driver go over the  list of all the files that are open on a specific inode  instance?

I'd like to avoid doing my own housekeeping.



 The question is about 2.4  kernel.

  

 Thanks,

  

 Jacob








^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: 2.4 Q: list of open files per inode?
@ 2007-07-22 11:39 Jacob A
  2007-07-22 11:58 ` Jan Engelhardt
  2007-07-22 12:51 ` Al Viro
  0 siblings, 2 replies; 11+ messages in thread
From: Jacob A @ 2007-07-22 11:39 UTC (permalink / raw)
  To: Al Viro, Jan Engelhardt; +Cc: linux-kernel

Al,

I'm using the open/close call as a way for processes to register/unregister with a watchdog driver that I'm writing.
I thought that I can save the housekeeping within the driver, but it looks like It would be easier just to maintain my own list
and be done with it.

Jacob

----- Original Message ----
From: Al Viro <viro@ftp.linux.org.uk>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: Jacob A <jacoba51-tmp@yahoo.com>; linux-kernel@vger.kernel.org
Sent: Thursday, July 19, 2007 7:38:10 PM
Subject: Re: 2.4 Q: list of open files per inode?

On Thu, Jul 19, 2007 at 01:41:03PM +0200, Jan Engelhardt wrote:
> 
> On Jul 19 2007 02:01, Jacob A wrote:
> >
> > How can a device driver go over the  list of all the files that are open on a
> > specific inode instance?
> 
> pseudo-code:
> 
> task_list_lock;
> for each process; do
>     lock_fdtable;
>     for each filedescriptor; do
>         do_something(fd->file_ptr);
>     unlock_fdtable;
> task_list_unlock;

Not again...

There are other things that can keep file open.  SCM_RIGHTS, references
held by syscall in progress, etc., etc.

The real question is why does driver want to do that?  Details, please...




^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: 2.4 Q: list of open files per inode?
@ 2007-07-22 12:26 Jacob A
  2007-07-22 12:28 ` Jan Engelhardt
  0 siblings, 1 reply; 11+ messages in thread
From: Jacob A @ 2007-07-22 12:26 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Al Viro, linux-kernel

I want to keep an internal state per each registration instance, and I opted to use open() as the registration mechanism.
-Jacob

----- Original Message ----
From: Jan Engelhardt <jengelh@computergmbh.de>
To: Jacob A <jacoba51-tmp@yahoo.com>
Cc: Al Viro <viro@ftp.linux.org.uk>; linux-kernel@vger.kernel.org
Sent: Sunday, July 22, 2007 2:58:18 PM
Subject: Re: 2.4 Q: list of open files per inode?


On Jul 22 2007 04:39, Jacob A wrote:

>I'm using the open/close call as a way for processes to
>register/unregister with a watchdog driver that I'm writing. I
>thought that I can save the housekeeping within the driver, but it
>looks like It would be easier just to maintain my own list and be
>done with it.

Sounds a bit wrong. _What_ exactly do you want to keep?


    Jan
-- 




^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: 2.4 Q: list of open files per inode?
@ 2007-07-22 12:45 Jacob A
  2007-07-22 13:07 ` Jan Engelhardt
  0 siblings, 1 reply; 11+ messages in thread
From: Jacob A @ 2007-07-22 12:45 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Al Viro, linux-kernel

Ah, yes, this was my intention, to keep the state in filp->private_data.
But then at a timer routine I wanted to go over all the filps associated with the device
and check/modify the state. That's why I needed the open files list.
-Jacob

----- Original Message ----
From: Jan Engelhardt <jengelh@computergmbh.de>
To: Jacob A <jacoba51-tmp@yahoo.com>
Cc: Al Viro <viro@ftp.linux.org.uk>; linux-kernel@vger.kernel.org
Sent: Sunday, July 22, 2007 3:28:30 PM
Subject: Re: 2.4 Q: list of open files per inode?


On Jul 22 2007 05:26, Jacob A wrote:

>I want to keep an internal state per each registration instance, and I opted
>to use open() as the registration mechanism.

So why not just store it in filp->private_data?



    Jan
-- 



>

    Jan
-- 




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

end of thread, other threads:[~2007-07-22 14:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-19  9:01 2.4 Q: list of open files per inode? Jacob A
2007-07-19 11:41 ` Jan Engelhardt
2007-07-19 16:38   ` Al Viro
  -- strict thread matches above, loose matches on Subject: below --
2007-07-22 11:39 Jacob A
2007-07-22 11:58 ` Jan Engelhardt
2007-07-22 12:51 ` Al Viro
2007-07-22 12:26 Jacob A
2007-07-22 12:28 ` Jan Engelhardt
2007-07-22 12:45 Jacob A
2007-07-22 13:07 ` Jan Engelhardt
2007-07-22 14:35   ` Al Viro

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