IOMedia driver
IOMedia driver
- Subject: IOMedia driver
- From: Herry Wiputra <email@hidden>
- Date: Tue, 03 Feb 2004 09:42:28 +1100
- Organization: SGI Australian Software Group
Hi guys,
I'm sorry for a rather long post.
I need to develop an IOMedia driver which has its own bdevsw table,
something similar to IOMediaBSDClient. If it works properly,
this driver should sit above all IOMedia devices that have a
specific signature in their superblock label. That way the driver
would replace IOMediaBSDClient for these devices.
I have approached this problem from 3 angles, but none of them
gave me any success:
1. I copied IOMediaBSDClient, IOMedia and IOBlockStorageDriver code
and renamed it to IOMediaBSDClientTest, IOMediaTest and
IOBlockStorageDriverTest, respectively.
IOMediaBSDClientTest is a subclass of IOMediaBSDClient and its
getProvider() method returns IOMediaTest. IOMediaTest is a subclass
of IOMedia and its getProvider() method returns IOStorage.
IOBlockStorageDriverTest is a subclass of IOBlockStorageDriver and
its getProvider() method returns IOBlockStorageDevice.
This is the plist for it:
<dict>
...
<key>IOKitPersonalities</key>
<dict>
<key>IOBlockStorageDriverTest</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.test.iokit.IOMediaBSDClientTest</string>
<key>IOClass</key>
<string>IOBlockStorageDriverTest</string>
<key>IOPropertyMatch</key>
<dict>
<key>device-type</key>
<string>Generic</string>
</dict>
<key>IOProviderClass</key>
<string>IOBlockStorageDevice</string>
</dict>
<key>IOMediaBSDClientTest</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.test.iokit.IOMediaBSDClientTest</string>
<key>IOClass</key>
<string>IOMediaBSDClientTest</string>
<key>IOMatchCategory</key>
<string>IOMediaBSDClient</string>
<key>IOProbeScore</key>
<integer>60001</integer>
<key>IOProviderClass</key>
<string>IOMediaTest</string>
<key>IOResourceMatch</key>
<string>IOBSD</string>
</dict>
</dict>
...
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.iokit.IOStorageFamily</key>
<string>1.2.3</string>
<key>com.apple.kernel.bsd</key>
<string>1.1</string>
<key>com.apple.kernel.iokit</key>
<string>1.1</string>
<key>com.apple.kernel.libkern</key>
<string>1.1</string>
</dict>
<key>OSBundleRequired</key>
<string>Local-Root</string>
</dict>
After I put this kext in /System/Library/Extensions, and rebooted with boot-args="-v",
I got a panic almost immediately in my IOKit kext. This indicates to me that my
kext gets loaded and matched and actually gets used but something is seriously wrong,
although I haven't changed anything from the original code except for the names.
Anyway, I can't debug it because it is too early in the startup sequence.
2. I copied the IOMediaBSDClient class only and renamed it to IOMediaBSDClientTest.
I also made this kext depend on IOStorageFamily kext, so it doesn't have undefined
symbols.
IOMediaBSDClientTest is a subclass of IOMediaBSDClient and its getProvider() method
returns IOMedia.
This is the plist for it:
<dict>
...
<key>IOKitPersonalities</key>
<dict>
<key>IOMediaBSDClientTest</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.test.iokit.IOMediaBSDClientTest</string>
<key>IOClass</key>
<string>IOMediaBSDClientTest</string>
<key>IOMatchCategory</key>
<string>IOMediaBSDClient</string>
<key>IOProbeScore</key>
<integer>65536</integer>
<key>IOProviderClass</key>
<string>IOMedia</string>
<key>IOResourceMatch</key>
<string>IOBSD</string>
<key>Leaf</key>
<true/>
</dict>
</dict>
...
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.iokit.IOStorageFamily</key>
<string>1.2.3</string>
<key>com.apple.kernel.bsd</key>
<string>1.1</string>
<key>com.apple.kernel.iokit</key>
<string>1.1</string>
<key>com.apple.kernel.libkern</key>
<string>1.1</string>
</dict>
<key>OSBundleRequired</key>
<string>Local-Root</string>
</dict>
This kext loaded with no problems but it never got used. kextstat shows the
kext has already been loaded. I suspect it is because the IOStorageFamily
kext has loaded first and thus IOMediaBSDClient has a higher probability of
getting used, even though I have given this kext a much higher IOProbeScore.
3. I copied IOCDStorageFamily project and renamed all occurences of IOCD to
IOTest.
This kext loaded with no problems when done manually, but if you reboot
the box, the box won't even be able to boot. It gives me the apple logo with
a black box on top of it.
This is the plist for it:
<dict>
...
<key>IOKitPersonalities</key>
<dict>
<key>IOTestPartitionScheme</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.test.iokit.IOTestStorageFamily</string>
<key>Content Mask</key>
<string>CD_partition_scheme</string>
<key>Content Table</key>
<dict>
...
</dict>
<key>IOClass</key>
<string>IOTestPartitionScheme</string>
<key>IOMatchCategory</key>
<string>IOStorage</string>
<key>IOProviderClass</key>
<string>IOTestMedia</string>
</dict>
<key>IOTestBlockStorageDriver</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.test.iokit.IOTestStorageFamily</string>
<key>IOClass</key>
<string>IOTestBlockStorageDriver</string>
<key>IOPropertyMatch</key>
<dict>
...
</dict>
<key>IOProviderClass</key>
<string>IOTestBlockStorageDevice</string>
</dict>
<key>IOTestMediaBSDClient</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.test.iokit.IOTestStorageFamily</string>
<key>IOClass</key>
<string>IOTestMediaBSDClient</string>
<key>IOMatchCategory</key>
<string>IOMediaBSDClient</string>
<key>IOProbeScore</key>
<integer>61000</integer>
<key>IOProviderClass</key>
<string>IOTestMedia</string>
</dict>
</dict>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.iokit.IOStorageFamily</key>
<string>1.2.3</string>
<key>com.apple.kernel.bsd</key>
<string>1.1</string>
<key>com.apple.kernel.libkern</key>
<string>1.1</string>
<key>com.apple.kernel.mach</key>
<string>1.1</string>
</dict>
<key>OSBundleRequired</key>
<string>Local-Root</string>
</dict>
If everything goes according to plan, this driver should sit above all
CD media, replacing IOCDMediaBSDClient, correct?
Has someone done this before? or maybe can help me with this?
Thanks,
Herry Wiputra
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.