Replacing FBSD mutexes
Markus Pfeiffer
markus.pfeiffer at morphism.de
Fri Oct 26 00:50:09 PDT 2012
Dear Petr,
On Fri, Oct 26, 2012 at 09:21:48AM +1100, elekktretterr at exemail.com.au wrote:
> Thanks Markus.
>
> I'm not sure what's the reasoning behind using those functions to set and
> retreive a pointer in the first place?
>
The functions store per-fd data for the driver. As far as I understand this is
used to handle multiple opens of a device.
> I have nvidia_ctl_open which uses devfs_set_cdevpri(struct filep)
>
> and then nvidia_ctl_close retrieves the pointer to filep via
> devfs_get_cdevpri.
>
>
Are you sure it is not used in an ioctl or read/write somewhere?
> Is it OK to store filep in the compilation-unit scope and access it when
> needed?
I think in usb4bsd I stored the pointer for one open in the device structure.
Obviously that is not per-fd, but for testing purposes where you only do one
open it was enough.
At the moment I am busy chasing down a bug in the xhci driver of usb4bsd. The
patch implmenting per-fd data is a little bit more involved since it requires
passing the fp down the whole device stack as far as I recall.
Markus
--
Markus Pfeiffer, University Manchester
email: markus.pfeiffer at morphism.de | xmpp: markus.pfeiffer at jabber.morphism.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20121026/c1145732/attachment-0022.bin>
More information about the Users
mailing list