77 lines
2.8 KiB
Diff
77 lines
2.8 KiB
Diff
commit 4e93ccc44f61854c84d82de8de80c18c87b87957
|
|
Author: Kamalesh Babulal <kamalesh@linux.ibm.com>
|
|
Date: Mon May 31 15:47:01 2021 +0530
|
|
|
|
devicetreecollector: refactor the code of buildSCSILocCode()
|
|
|
|
Refactoring the code in buildSCSILocCode(), to make it more readable.
|
|
This patch doesn't change the logic of the function, it's needed for
|
|
the future patches, those will be altering the function
|
|
|
|
Signed-off-by: Kamalesh Babulal <kamalesh@linux.ibm.com>
|
|
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
|
|
|
|
diff --git a/src/internal/sys_interface/devicetreecollector.cpp b/src/internal/sys_interface/devicetreecollector.cpp
|
|
index db4e8b5..dd55611 100644
|
|
--- a/src/internal/sys_interface/devicetreecollector.cpp
|
|
+++ b/src/internal/sys_interface/devicetreecollector.cpp
|
|
@@ -771,31 +771,33 @@ ERROR:
|
|
* scsi, ide, usb, etc that do not generate ibm,loc-code
|
|
* files for easy grabbing
|
|
*/
|
|
- if (fillMe->devBus.dataValue == "scsi") {
|
|
- parent = findSCSIParent(fillMe, devs);
|
|
-
|
|
- if (parent != NULL) {
|
|
- target = fillMe->getDeviceSpecific("XT");
|
|
- lun = fillMe->getDeviceSpecific("XL");
|
|
- bus = fillMe->getDeviceSpecific("XB");
|
|
- host = fillMe->getDeviceSpecific("XH");
|
|
- if (host != NULL && target != NULL &&
|
|
- lun != NULL && bus != NULL) {
|
|
- if (fillMe->mPhysicalLocation.dataValue != "")
|
|
- val << fillMe->mPhysicalLocation.dataValue;
|
|
- else if
|
|
- (parent->mPhysicalLocation.dataValue != "")
|
|
- val << parent->mPhysicalLocation.dataValue;
|
|
- else
|
|
- val << getAttrValue( parent->deviceTreeNode.dataValue,
|
|
- "ibm,loc-code" );
|
|
- val << "H" << host->dataValue << "-B" << bus->dataValue
|
|
- << "-T" << target->dataValue << "-L" << lun->dataValue;
|
|
- fillMe->mPhysicalLocation.setValue( val.str( ), 60 ,
|
|
- __FILE__, __LINE__ );
|
|
- }
|
|
- }
|
|
- }
|
|
+ if (fillMe->devBus.dataValue != "scsi")
|
|
+ return;
|
|
+
|
|
+ parent = findSCSIParent(fillMe, devs);
|
|
+ if (parent == NULL)
|
|
+ return;
|
|
+
|
|
+ target = fillMe->getDeviceSpecific("XT");
|
|
+ lun = fillMe->getDeviceSpecific("XL");
|
|
+ bus = fillMe->getDeviceSpecific("XB");
|
|
+ host = fillMe->getDeviceSpecific("XH");
|
|
+ if (host == NULL || target == NULL || lun == NULL || bus == NULL)
|
|
+ return;
|
|
+
|
|
+ if (fillMe->mPhysicalLocation.dataValue != "")
|
|
+ val << fillMe->mPhysicalLocation.dataValue;
|
|
+ else if (parent->mPhysicalLocation.dataValue != "")
|
|
+ val << parent->mPhysicalLocation.dataValue;
|
|
+ else
|
|
+ val << getAttrValue( parent->deviceTreeNode.dataValue,
|
|
+ "ibm,loc-code" );
|
|
+
|
|
+ val << "H" << host->dataValue << "-B" << bus->dataValue
|
|
+ << "-T" << target->dataValue << "-L" << lun->dataValue;
|
|
+
|
|
+ fillMe->mPhysicalLocation.setValue( val.str( ), 60 ,
|
|
+ __FILE__, __LINE__ );
|
|
}
|
|
|
|
void DeviceTreeCollector::getRtasSystemParams(vector<Component*>& devs)
|