Re: devfs_get/set_cdevpriv functions from FreeBSD

Francois Tigeot <[email protected]>
Newsgroups gmane.os.dragonfly-bsd.kernel
Message-ID <[email protected]>
Hi,

On Tue, Jul 17, 2012 at 08:11:13AM +0000, Markus Pfeiffer wrote:
> 
> while porting drivers from FreeBSD some of us have stumbled over the functions
> devfs_get_cdevpriv and devfs_set_cdevpriv, which store some
> per-open-filedescriptor information for some devices.
> 
> I looked into the FreeBSD code and the implementation seems weird to me since
> they store the filedescriptor on syscall in their thread struct and the functions
> rely on that hidden state.
> 
> Question is now: Should we have similar functionality (i.e. per open
> filedescriptor "private" data) and if yes how to best implement that. I know
> that AlexH had made some suggestion but I cannot find it in the IRC logs and
> it would probably be more efficient doing this by mail. 

I encountered the same family of functions while looking at recent FreeBSD DRM
code; since it was ported from Linux in the first place, I also looked at the
Linux equivalent functions, and they seemed much more sane.

Private data was directly accessible from the filedescriptor if I remember
correctly.

-- 
Francois Tigeot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.