Re: devfs_register and private data

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

 



On Tue, Jan 20, 2004 at 02:50:54PM -0700, Liberty Young wrote:
> 
> Perhaps it's my mis-understanding. From the kernel source and from Linux
> Device Drivers, it seems i can give filep->private_data  default values.
> Quoting LDD, 
> "
> A default value for filp->private_data. The filesystem will initialize
> the pointer to this value when the device is opened. The info pointer
> passed to devfs_mk_dir is not used by devfs and acts as a "client data"
> pointer.
> "
> 
> So, I thought i had a way to give open() calls a default value for the
> private_data. And, just like the kernel source mentioned, that value
> could be changed and would not persist across different file open()
> calls. 

For devfs only it looks like this should work.  But I do not think
anyone else has ever used that code (and it is totally gone in 2.6, so
be forwarned.)

I don't know why that doesn't work, try asking the devfs author.

But without using devfs, no, there is no way to do this, sorry.  Your
file pointer passed to you in open has a NULL for private (or it might
contain garbage, either way you can't rely on it.)

> > more internal and we're using devfs...but point taken. I think to
> solve
> > > _this_ problem, i'll do just that. 
> I meant that i would do as you suggested. 
> 
> Is there a way to have the private_data parameter to the open() calls
> have a default value in the referenced pointer? 

Nope, sorry.

greg k-h

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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