Date: Wed, 21 Dec 2005 10:12:09 -0700 (MST) From: Warner Losh <imp@bsdimp.com> To: new.folder@email.it Cc: freebsd-drivers@freebsd.org Subject: Re: Accessing driver members Message-ID: <20051221.101209.78745726.imp@bsdimp.com> In-Reply-To: <4594988015c0429a430ba92fc05ecfa2@151.100.8.60> References: <4594988015c0429a430ba92fc05ecfa2@151.100.8.60>
next in thread | previous in thread | raw e-mail | index | archive | help
> I would like to know what's the better way to access to a device member form > kernelspace. For example, I can use a ioctl from userspace but, since the > functions are all static I can't access nicely from kernel space (and using > ioctl(2) in the kernel is not a great idea...). You have one device driver that wants to access another device driver's private parts? If so, there are only a few ways to deal with this: (1) Make the drivers friends. Let one driver know about the private parts of the other driver and provide secret public functions for that other driver to use (you can firewall the information leak by using modules and MODULE_DEPEND). This is simple, but scales poorly and is thought by many to be ugly. (2) Use a kobj interface for the two devices to talk to one another. This tends to be a better interface in that it is more flexible. I use this when I have one module that measures something in the kernel controlling a different module based on those measurements to meet a soft real-time specification (and also to give a level of overkill that made management happy given their flawed knowledge about how certain things worked). Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051221.101209.78745726.imp>