Re: efficient driver/driver communication
Re: efficient driver/driver communication
- Subject: Re: efficient driver/driver communication
- From: Michael Smith <email@hidden>
- Date: Sun, 20 Jul 2008 19:56:12 -0700
On Jul 18, 2008, at 12:04 PM, email@hidden wrote:
What is the most efficient way of moving data between two kexts?Are
the
IOService message/messageClient calls the recommended way to do
this? Do
they involve memcpy?
The most efficient technique is to use IOService matching to locate
the partner kext and then make direct method calls between the two.
Since your kext isn't really discoverable until after your start
routine has returned, you are best off using a notification to find
the other kext.
Something like this:
class foo ....
IONotifier *notify;
bar *partner;
bool match_routine(void *ref, IOService *newService);
...
};
bool
foo::start(IOService *provider)
{
...
notify = addNotification(gIOPublishNotification,
serviceMatching("bar"), match_routine, this, 0);
registerService();
return(true);
}
bool
match_routine(void *ref, IOService *newService)
{
partner = OSDynamicCast(bar, newService);
...
}
Once foo has found bar, it can introduce itself with a registration
call and you can make direct inter-class calls.
Note that it can be risky doing this if the two have separate
workloops, since the potential for deadlock exists. Depending on what
you're actually doing, you may find it convenient to have one class
defer most of its setup until it finds the other, and then call
getWorkLoop() in order to share workloops.
= Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden