+/*********************************************************************
+*********************************************************************/
+static
+Boolean kextIsADependency(OSString * name) {
+ Boolean result = true;
+ OSDictionary * extensionsDict = 0; // don't release
+ OSDictionary * extDict = 0; // don't release
+ OSDictionary * extPlist = 0; // don't release
+ OSBoolean * isKernelResourceObj = 0; // don't release
+ OSData * driverCode = 0; // don't release
+ OSData * compressedCode = 0; // don't release
+
+ extensionsDict = getStartupExtensions();
+ if (!extensionsDict) {
+ IOLog("kextIsADependency(): No extensions dictionary.\n");
+ LOG_DELAY();
+ result = false;
+ goto finish;
+ }
+
+
+ extDict = OSDynamicCast(OSDictionary,
+ extensionsDict->getObject(name));
+ if (!extDict) {
+ IOLog("kextIsADependency(): "
+ "Extension \"%s\" cannot be found.\n",
+ name->getCStringNoCopy());
+ LOG_DELAY();
+ result = false;
+ goto finish;
+ }
+
+ extPlist = OSDynamicCast(OSDictionary, extDict->getObject("plist"));
+ if (!extPlist) {
+ IOLog("getDependencyListForKmod(): "
+ "Extension \"%s\" has no property list.\n",
+ name->getCStringNoCopy());
+ LOG_DELAY();
+ result = false;
+ goto finish;
+ }
+
+ /* A kext that is a kernel component is still a dependency, as there
+ * are fake kmod entries for them.
+ */
+ isKernelResourceObj = OSDynamicCast(OSBoolean,
+ extPlist->getObject("OSKernelResource"));
+ if (isKernelResourceObj && isKernelResourceObj->isTrue()) {
+ result = true;
+ goto finish;
+ }
+
+ driverCode = OSDynamicCast(OSData, extDict->getObject("code"));
+ compressedCode = OSDynamicCast(OSData,
+ extDict->getObject("compressedCode"));
+
+ if (!driverCode && !compressedCode) {
+ result = false;
+ goto finish;
+ }
+
+finish:
+
+ return result;
+}
+