On Tue, 2004-01-20 at 13:57, Greg KH wrote: > On Tue, Jan 20, 2004 at 01:45:03PM -0700, Liberty Young wrote: > > On Tue, 2004-01-20 at 13:28, Greg KH wrote: > > > On Tue, Jan 20, 2004 at 01:16:41PM -0700, Liberty Young wrote: > > > > > > > > But the kernel doesn't print out the expected results! What am i doing wrong? > > > > > > Relying on devfs being enabled is the main problem :) > > > > > > Just use the minor number in the inode on open to determine which > > > structure in your driver is being accessed. Then set the private > > > pointer in the struct file to this value. That can then be used on all > > > future read(), write(), and release() calls. > > > > > > > Relying on devfs being enabled is pretty much okay, as this driver is > > more internal and we're using devfs...but point taken. I think to solve > > _this_ problem, i'll do just that. > > You are aware of the current issues with devfs, right? Ok, it's your > kernel... :) > > > That aside, I'm interested in why i can't set the void *private argument > > to a default value in open() and other related calls. > > You are supposed to set it in your open() call, for use in all other > related calls. Or am I misunderstanding your question here? > > thanks, > > greg k-h 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. > 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? -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/