bool IOFireWireSBP2LUN::matchPropertyTable(OSDictionary * table) { // // If the service object wishes to compare some of its properties in its // property table against the supplied matching dictionary, // it should do so in this method and return truth on success. // if( !IOService::matchPropertyTable(table) ) return false; // We return success if the following expression is true -- individual // comparisions evaluate to truth if the named property is not present // in the supplied matching dictionary. bool res = compareProperty(table, gCommand_Set_Spec_ID_Symbol) && compareProperty(table, gCommand_Set_Symbol) && compareProperty(table, gModule_Vendor_ID_Symbol) && compareProperty(table, gCommand_Set_Revision_Symbol) && compareProperty(table, gIOUnit_Symbol) && compareProperty(table, gFirmware_Revision_Symbol) && compareProperty(table, gDevice_Type_Symbol) && compareProperty(table, gGUID_Symbol) && compareProperty(table, gFireWireModel_ID); return res; }
// TODO: this need to e updated for states static bool compareTree(const ModelNode &node1, const ModelNode &node2) { if (!node1.isValid() || !node2.isValid()) { return false; } if (node1.type() != node2.type()) { return false; } // Compare properties { const QList<AbstractProperty> propList1 = node1.properties(); const QList<AbstractProperty> propList2 = node2.properties(); QList<AbstractProperty>::const_iterator iter1 = propList1.constBegin(); QList<AbstractProperty>::const_iterator iter2 = propList2.constBegin(); for (; iter1 != propList1.constEnd() && iter2 != propList2.constEnd(); iter1++, iter2++) { if (!compareProperty(*iter1, *iter2)) return false; } if (iter1 != propList1.constEnd() || iter2 != propList2.constEnd()) return false; } // Compare list of children { const QList<ModelNode> childList1 = node1.allDirectSubModelNodes(); const QList<ModelNode> childList2 = node2.allDirectSubModelNodes(); QList<ModelNode>::const_iterator iter1; QList<ModelNode>::const_iterator iter2; for (iter1 = childList1.constBegin(), iter2 = childList2.constBegin(); iter1 != childList1.constEnd() && iter2 != childList2.constEnd(); iter1++, iter2++) { if (!compareTree((*iter1), (*iter2))) return false; } if (iter1 != childList1.constEnd() || iter2 != childList2.constEnd()) return false; } return true; }