Hi All,
I have made two partitions on a disk with same
content hint and have written a filter scheme driver which should
write data only on one partition at a time. For this purpose I have given
different partition names to both the partitions say Part1 and Part2.
In the default write call of driver
i.e.
void
MyDriver::write(IOService*,UInt64,IOMemoryDescriptor*,IOStorageCompletion);
I check the name of media(partition) and if
the name matches to the partition on which I want to write data then
only I call
getProvider->write(this,byteStart,buffer,completion);
but if the media name doesn't match then I come out
of drivers default write() without writing anything
then my driver doesn't get unloaded.
Error msg:
Can not unload driver as driver
has 1instance(s).
Kindly guide by telling how can I unload driver and
send the default write only for a particular media.
Code snippet of write call
void
MyDriver::write(IOService*,UInt64,IOMemoryDescriptor*,IOStorageCompletion)
{
char MediaName[20];
sprintf(MediaName, "%s",
_media->getName());
if(strcmp(MediaName,"Part1") ==
0)
getProvider->write(this,byteStart,buffer,completion);
else
IOLog("Media didnt match
\n");
}
Thanks and Regards,
Mekhala
|