Messages in this thread | | | Date | Sun, 22 Jul 2007 15:07:47 +0200 (CEST) | From | Jan Engelhardt <> | Subject | Re: 2.4 Q: list of open files per inode? |
| |
On Jul 22 2007 05:45, Jacob A wrote: > >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.
No. For each private_data that you allocate, create a linked list that also has them. In other words:
struct mystuff { struct list_head list; int other_fluff; };
int mydriver_open() { struct mystuff *pd = kmalloc(...); filp->private_data = pd; list_add(&pd->list); }
int mydriver_close() { struct mystuff *pd = filp->private_data; list_del(&pd->list); free(pd); }
Simple as that. *Of course* this requires that the file descriptor remains open. But that should not be a problem, would it?
Jan --
>
Jan --
>
Jan -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |