Problem for read routine in filter scheme driver
Problem for read routine in filter scheme driver
- Subject: Problem for read routine in filter scheme driver
- From: Yogesh P <email@hidden>
- Date: 09 Jun 2005 21:52:12 +0530
Hi folks,
I have written a filter scheme driver. By using this driver i am able to
write on the disk.But when i call the read API of driver it is returning
me some garbage characters.When i "dd" on the disk i get the correct
buffer that i write on the disk using write routine of driver.
The code snippet for the my read routine is as follows:
void com_My_driver::read(IOService* provider,UInt64 byteStart,
IOMemoryDescriptor* buffer,
IOStorageCompletion completion)
{
IOLog("\n com_CoreSnap_driver --- read function Called ...\n");
int i;
IOByteCount readBytes = 0;
IOByteCount bufLength = buffer->getLength();
IOLog("\n bufLength = %lu\n", bufLength);
char *myBuff1 = new char[bufLength];
IOLog("\n before read function Called ...\n");
getProvider()->read(this, byteStart, buffer, completion);
IOLog("\n After read function Called ...\n");
IOLog("\n before readbytes function Called ...\n");
readBytes = buffer->readBytes(0, myBuff1, bufLength);
IOLog("\n before readbytes function Called ...\n");
IOLog("\n Calling for loop After read .....\n");
for (i = 0; i < 8192; i++)
{
IOLog("%c C", *myBuff1);
}
IOLog("\n For loop overs After read.....\n");
}
My for loop IOLog shows the following output:
Jun 9 21:44:32 localhost kernel:
Jun 9 21:44:32 localhost kernel: com_My_driver --- handleIsOpen
function Called
Jun 9 21:44:32 localhost kernel:
com_My_driver[0x11be680]::handleIsOpen(0x191e200)
Jun 9 21:44:32 localhost kernel:
Jun 9 21:44:32 localhost kernel: com_My_driver --- handleClose function
Called
Jun 9 21:44:32 localhost kernel:
com_My_driver[0x11be680]::handleClose(0x191e200, 0)
Jun 9 21:44:39 localhost kernel: C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCC CCCCCCCCCCCCC
Jun 9 21:44:39 localhost kernel: For loop overs After read.....
It shows the garbage values.I think it will have to show the buffer
which gets write on the disk.
Am i missing something in my read?
Please suggest.
Thanks in advance,
Yogesh
~
_______________________________________________
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