Re: passing data to kernel driver from a file.
Re: passing data to kernel driver from a file.
- Subject: Re: passing data to kernel driver from a file.
- From: John Dalgliesh <email@hidden>
- Date: Mon, 9 Oct 2006 23:05:56 +1000 (EST)
On Mon, 9 Oct 2006, sanjay yaragatti wrote:
Hi,
Hi, please don't cross-post to multiple lists. If you don't get an answer
from one list after a few days it's OK to resend your question to another.
It's not OK to spam both at the same time like this.
I have written a kernel resident driver.I need to pass
some data to the driver which is stored in a file.How
can this be accomplised.Came to know that file
operations are not supported in kernel.Read about the
UserClient but still not clear.Please suggest me how
to pass data to the driver.
OK, here we go again. File access in the kernel is discouraged (as I have
learnt the hard way :). Even if you are accessing it through a UserClient
it still imports userland dependencies into the kernel.
So the first question is: why? What are the contents of this file? Is it
like a firmware blob that gets loaded once and discarded, or is it a
settings file? Something else? Also: when? At boot time or later?
Note that if you're trying to access a resource file within your kext's
directory, then I believe that there are even cases where it won't be
available (e.g. when netbooted) so you need to worry about that too.
If the file you want is just a firmware blob, then a good way around
loading a file is to have a kext in your plugins directory with the blob
compiled-in. That way you stay within the kext system and it can even be
unloaded when you're done with it.
If however the file is a settings file you will need to go the UserClient
route. I have done this before and now have a daemon plus a kext that
provides access to files through a nice C++ class. It can even return a
.plist file as an OSDictionary. You're welcome to use it or just study it
and write your own if you prefer.
Thanks in Advance..
No worries.
{P^/
John
(You can find that daemon+kext in my CVS repository, instructions to
access it are under 'Development' here: <http://www.defyne.org/dvb/>.
Check out Driver/UDMUtils/UDMResourceFile.hpp for the interface. The
drivers package on that site installs it all for you if you don't want to
build it yourself.)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden