Re: 2.4 Q: list of open files per inode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux