devfs_get/set_cdevpriv functions from FreeBSD

Alex Hornung ahornung at gmail.com
Wed Jul 18 03:33:34 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 17/07/12 09:11, Markus Pfeiffer wrote:
> 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.

My original suggestion, which is straight forward to implement, is to
just store the fp in each of the devfs_fo_* operations somewhere (e.g.
curthread like FreeBSD, although that isn't all that nice), and then
clean it up on devfs_fo_close.

Having that, you can easily implement the rest to set up some list or
tree or whatever inside a  cdev that is also passed to the function.
the search key would then be the fp that you stored somewhere whilst
in devfs_fo_*.

HTH,
Alex
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJQBpD+AAoJEInr8DonK72KMuEIAIa2/rGQeMivoWj19iFQkbWH
3Qi/bw6HeQ8392B5lG7P5c1eY9zxJCZZnME4vrUGX+IaWepXlZyHfsosFQ6KyiTu
K4GIm5HSLBATS9vAgQotZ7yHyExy+m54AZ6C4mXkwK4lU8/5+Gi4wV6D/8lg4Fco
pxKjDL9IOXUUQmXvQ6bC5xu8uX8JKuobO3N6LSjJpHwQkHb89fTi2ELh18aOxV6G
uh1BBu4AQFtlDC9wGb/5599wAAGTzSDdvzSBkADs4ckhh204xBlNMEQgBT+f1QCf
BuEtIgifU10nqMVd9fPbNMzEfC0mCq8JVOsgBrOGqjyZG+1upLNM8QhuokoYO8g=
=C91L
-----END PGP SIGNATURE-----





More information about the Kernel mailing list