Re: File Descriptor

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

 



On Tue, Nov 30, 2004 at 16:17:23 -0800, Usman S. Ansari wrote:
> Briefly, when a process opens my driver device special file, it can
> request certain optional services to be performed, whenever that
> particular descriptor call goes to the driver.
> 
> These processes can stay there for long time.
> 
> There is another operation (through ioctl of course) defined, which
> can
> kind of reset the card. Which means that all the open descriptors are
> still valid, but these process have to do login [login/out state
> maintained by driver] again.
> 
> At this point, I have a choice, I can tell the user that any operation
> after that is invalid, so they have to close all the fds (and reopen
> them), or I can cleanup data I have attached to private area of
> "struct file".
> 
> Now, this senario should not occur normally. But there could be a user
> who is not careful.
> 
> So, the fds are not actually closed, in is to do with the state of
> driver. I was thinking that when process performs a operation on fd,
> kernel know to send it to correct driver. There may be a list which
> will let me go through all the fds associated with the driver.

So you don't need the descriptors, you need your private structures,
right? Then keep a list of them. It's just 3 statements! (one declaring
the list, one in allocator to add it and one in deallocator to remove
it -- see include/linux/list.h)

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux