Calling completion method
Calling completion method
- Subject: Calling completion method
- From: Rakesh Singhal <email@hidden>
- Date: Fri, 01 Apr 2011 19:44:40 +0530
Hi all,
I have written driver very similar to SampleFilterScheme but the child media object is only readable. I have modified the read() method and wrote my completion method as follows:
void MyDriver::read(IOService* client,
UInt64 byteStart,
IOMemoryDescriptor* buffer,
IOStorageAttributes * attributes,
IOStorageCompletion * completion)
{
IOStorageCompletion *temp_completion;
temp_completion = (IOStorageCompletion*)IOMalloc(sizeof(*temp_completion));
if(!temp_completion) {
DEBUG_LOG("Memory could not allocated for completion\n");
}
temp_completion->action = "">
temp_completion->target = this;
temp_completion->parameter = (void*)completion;
getProvider()->read(this, byteStart,
buffer, (IOStorageAttributes*)NULL,
temp_completion);
}
void MyDriver::read_completion(void *target,
void *parameter,
IOReturn status,
UInt64 actualByteCount)
{
IOStorageCompletion* completion;
completion = (IOStorageCompletion*)parameter;
if(completion && completion->action)
{
DEBUG_LOG("Calling original completion method\n");
complete(completion, status, actualByteCount);
//( completion->action )( completion->target, completion->parameter, status, actualByteCount);
}
}
Now when I load driver and attach to a raw (not formatted) partition disk0s6. The driver gets loaded successfully and create a child media object disk0s6s1. The driver receives a read request immediately after loading.
Now if I read some data from disk0s6s1 using dd command, it panic. In logs, I can see the latest log is "Calling original completion method" and it panic.
Please let me know where I am making mistake. Is this a proper way of calling completion function?
Thanks in advance.
Regards,
Rakesh
_______________________________________________
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