[openib-general] [PATCH] ibdm nits and a few questions
Bernhard Fischer
rep.nop at aon.at
Wed Jul 6 09:02:22 PDT 2005
Hi Eitan and Hal,
On Tue, Jul 05, 2005 at 02:23:57PM +0300, Eitan Zahavi wrote:
>Hi Ber,
>
>Thanks.
>I have used an ex script to fix the following typos on all the code tree's I
>own.
>In the future - it is much better from my perspective to simply get the list
>of words I need to check for.
>I hope you will be able to simply send me the list of words. It will make my
>life easier.
Sure.
missm -> mism
optential -> potential
finaly -> finally
adn -> and
simplicty -> simplicity
consistant -> consistent
the[[:space:]]*the[[:space:]] -> the
(i.e. double 'the' but not 'the theory')
incomming -> incoming
seperat -> separat
unseccessful -> unsuccessful
fucntions -> functions
acording -> according
(acordingly -> accordingly)
callabcks -> callbacks
distructor -> destructor
Distractor -> Destructor
reciev -> receiv
(recieving -> receiving)
(Recieved -> Received)
What about removing all the generated scripts (configure et al) and
auto-tools helpers (aclocal.m4 etc and most of config/*) from the
repository?
Note that the other userspace IB libraries do not have these in the
repository but each do provide a toplevel ./autogen.sh -- as opposed
to ibdm's ./config/bootstrap.
There are a number of other unused variables.
Is ibdm supposed to be compilable with pure ISO c++ compilers, btw?
There is at least one place which uses a variable sized array which AFAIK
is not valid ISO c++.
Attached patch does:
IBSystem::guid: As default nowadays is public, move guid into the
private section explicitely.
configure.in: fix indentation of --enable-debug help text.
IBFabric::parseFdbFile(): initialize p_node
IBFabric::parseMCFdbFile(): ditto
IBFabric::IBLinkWidth: remove comma at end of enumerator list
IBFabric::IBLinkSpeed: ditto
IBFabric:: remove 'IBFabric::' qualifier from member function
parseMCFdbFile()
Fabric.h: remove extra ';' from member functions
datamodel/ibdmsh_wrap.cpp::ibdmGetObjPtrByTclName(): avoid using
uninitialized name
datamodel/ibdm_wrap.cpp::ibdmGetObjPtrByTclName(): ditto
datamodel/SubnMgt.cpp::SubnMgtCalcMinHopTables(): make sure worstHopLid
is initialized
datamodel/SubnMgt.cpp::SubnReportNonUpDownCa2CaPaths(): make sure
p_prevNode is initialized
datamodel/TopoMatch.cpp::TopoMatchNodeByAdjacentMatched(): make sure
succeedMatch is initialized
datamodel/TopoMatch.cpp::TopoMatchSpecNodesByAdjacentNode(): add missing
return numMatched;
datamodel/TraceRoute.cpp::TraceDRPathRoute(): remove check which is
always false due to limited datatype
src/osm_check.cpp::main(): remove unused variable 'status'
IBMgtSim doesn't compile for me as iba/ib_types.h isn't installed, so
the above is only compile-tested.
Hal, will you take care of installing the missing headers?
Thank you,
Bernhard
-------------- next part --------------
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/ibdm/configure.in gen2.2810/utils/src/linux-user/ibdm/configure.in
--- gen2.2810.oorig/utils/src/linux-user/ibdm/configure.in 2005-03-24 17:55:47.000000000 +0100
+++ gen2.2810/utils/src/linux-user/ibdm/configure.in 2005-07-06 13:42:52.000000000 +0200
@@ -73,7 +73,7 @@ dnl AC_SUBST(LTLIBOBJS)
dnl Define an input config option to control debug compile
AC_ARG_ENABLE(debug,
-[ --enable-debug Turn on debugging],
+[ --enable-debug Turn on debugging],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/Fabric.cpp gen2.2810/utils/src/linux-user/ibdm/datamodel/Fabric.cpp
--- gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/Fabric.cpp 2005-07-06 11:52:49.000000000 +0200
+++ gen2.2810/utils/src/linux-user/ibdm/datamodel/Fabric.cpp 2005-07-06 14:31:01.000000000 +0200
@@ -1593,7 +1593,7 @@ IBFabric::parseFdbFile(string fn) {
cout << "-I- Parsing OpenSM FDBs file:" << fn.c_str() << endl;
- IBNode *p_node;
+ IBNode *p_node = NULL;
int anyErr = 0;
while (f.good()) {
@@ -1665,7 +1665,7 @@ IBFabric::parseMCFdbFile(string fn) {
cout << "-I- Parsing OpenSM Multicast FDBs file:" << fn.c_str() << endl;
- IBNode *p_node;
+ IBNode *p_node = NULL;
int anyErr = 0;
while (f.good()) {
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/Fabric.h gen2.2810/utils/src/linux-user/ibdm/datamodel/Fabric.h
--- gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/Fabric.h 2005-07-06 11:52:49.000000000 +0200
+++ gen2.2810/utils/src/linux-user/ibdm/datamodel/Fabric.h 2005-07-06 14:16:07.000000000 +0200
@@ -132,7 +132,7 @@ typedef enum {IB_UNKNOWN_LINK_WIDTH = 0,
IB_LINK_WIDTH_1X = 1,
IB_LINK_WIDTH_4X = 2,
IB_LINK_WIDTH_8X = 4,
- IB_LINK_WIDTH_12X =8,
+ IB_LINK_WIDTH_12X =8
} IBLinkWidth;
static inline IBLinkWidth char2width( const char *w)
@@ -143,7 +143,7 @@ static inline IBLinkWidth char2width( co
if (!strcmp(w,"8x")) return IB_LINK_WIDTH_8X;
if (!strcmp(w,"12x")) return IB_LINK_WIDTH_12X;
return IB_UNKNOWN_LINK_WIDTH;
-};
+}
static inline char * width2char( const IBLinkWidth w)
{
@@ -155,12 +155,12 @@ static inline char * width2char( const I
case IB_LINK_WIDTH_12X: return("12x"); break;
default: return("UNKNOWN");
}
-};
+}
typedef enum {IB_UNKNOWN_LINK_SPEED = 0,
IB_LINK_SPEED_2_5 = 1,
IB_LINK_SPEED_5 = 2,
- IB_LINK_SPEED_10 = 4,
+ IB_LINK_SPEED_10 = 4
} IBLinkSpeed;
static inline char * speed2char( const IBLinkSpeed s)
@@ -172,7 +172,7 @@ static inline char * speed2char( const I
case IB_LINK_SPEED_10: return("10"); break;
default: return("UNKNOWN");
}
-};
+}
static inline IBLinkSpeed char2speed( const char *s)
{
@@ -181,14 +181,14 @@ static inline IBLinkSpeed char2speed( co
if (!strcmp(s,"5")) return IB_LINK_SPEED_5;
if (!strcmp(s,"10")) return IB_LINK_SPEED_10;
return IB_UNKNOWN_LINK_SPEED;
-};
+}
static inline string guid2str(uint64_t guid) {
char buff[18];
sprintf(buff, "0x%016" PRIx64 , guid);
// string res(buff);
return buff;
-};
+}
//
// IB Port class.
@@ -196,6 +196,7 @@ static inline string guid2str(uint64_t g
// a node.
//
class IBPort {
+private:
uint64_t guid; // The port GUID (on SW only on Port0)
public:
class IBPort * p_remotePort; // Port connected on the other side of link
@@ -237,6 +238,7 @@ typedef union _PrivateAppData {
// IB Node class
//
class IBNode {
+private:
uint64_t guid;
public:
string name; // Name of the node (instance name of the chip)
@@ -339,6 +341,7 @@ class IBSysPort {
// This is normally derived into a system specific class
//
class IBSystem {
+private:
uint64_t guid;
public:
string name; // the "host" name of the system
@@ -474,7 +477,7 @@ class IBFabric {
int parseFdbFile(string fn);
// Parse an OpenSM MCFDBs file and set the MFT table accordingly
- int IBFabric::parseMCFdbFile(string fn);
+ int parseMCFdbFile(string fn);
// set a lid port
inline void setLidPort (unsigned int lid, IBPort *p_port) {
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/ibdmsh_wrap.cpp gen2.2810/utils/src/linux-user/ibdm/datamodel/ibdmsh_wrap.cpp
--- gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/ibdmsh_wrap.cpp 2005-07-06 11:52:49.000000000 +0200
+++ gen2.2810/utils/src/linux-user/ibdm/datamodel/ibdmsh_wrap.cpp 2005-07-06 15:33:29.782708152 +0200
@@ -459,7 +459,7 @@ SWIGEXPORT(int,Ibdm_Init)(Tcl_Interp *);
int ibdmGetObjPtrByTclName(Tcl_Obj *objPtr, void **ptr) {
/* we need to parse the name and get the type etc. */
char buf[256];
- char *type, *name, *fabIdxStr;
+ char *type, *name = NULL, *fabIdxStr;
char *colonIdx, *slashIdx;
int fabricIdx;
*ptr = NULL;
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/ibdm_wrap.cpp gen2.2810/utils/src/linux-user/ibdm/datamodel/ibdm_wrap.cpp
--- gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/ibdm_wrap.cpp 2005-07-06 11:52:49.000000000 +0200
+++ gen2.2810/utils/src/linux-user/ibdm/datamodel/ibdm_wrap.cpp 2005-07-06 15:19:48.172208363 +0200
@@ -459,7 +459,7 @@ SWIGEXPORT(int,Ibdm_Init)(Tcl_Interp *);
int ibdmGetObjPtrByTclName(Tcl_Obj *objPtr, void **ptr) {
/* we need to parse the name and get the type etc. */
char buf[256];
- char *type, *name, *fabIdxStr;
+ char *type, *name = NULL, *fabIdxStr;
char *colonIdx, *slashIdx;
int fabricIdx;
*ptr = NULL;
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/SubnMgt.cpp gen2.2810/utils/src/linux-user/ibdm/datamodel/SubnMgt.cpp
--- gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/SubnMgt.cpp 2005-07-06 11:52:49.000000000 +0200
+++ gen2.2810/utils/src/linux-user/ibdm/datamodel/SubnMgt.cpp 2005-07-06 14:56:48.000000000 +0200
@@ -323,7 +323,7 @@ SubnMgtCalcMinHopTables (IBFabric *p_fab
int maxHops = 0;
IBNode *p_worstHopNode = NULL;
IBPort *p_worstHopPort = NULL;
- unsigned int worstHopLid;
+ unsigned int worstHopLid = 0;
IBNode *p_caNode;
IBPort *p_caPort;
vec_int maxHopsHist(50,0);
@@ -1389,7 +1389,7 @@ SubnReportNonUpDownCa2CaPaths(
int numChanges = 0;
int prevGoingUp = 1, goingUp;
int prevRank = 99, rank;
- IBNode *p_prevNode;
+ IBNode *p_prevNode = NULL;
// Go through the path and check for up down transitions.
for (list_pnode::iterator lI = path.begin(); lI!= path.end(); lI++) {
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/TopoMatch.cpp gen2.2810/utils/src/linux-user/ibdm/datamodel/TopoMatch.cpp
--- gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/TopoMatch.cpp 2005-07-06 11:52:49.000000000 +0200
+++ gen2.2810/utils/src/linux-user/ibdm/datamodel/TopoMatch.cpp 2005-07-06 15:14:34.998761395 +0200
@@ -534,7 +534,7 @@ TopoMatchNodeByAdjacentMatched(
IBNode *p_sNode
)
{
- int succeedMatch;
+ int succeedMatch = 0;
// This map will hold the number of matching ports for each candidate
// discovered node
@@ -648,6 +648,7 @@ TopoMatchSpecNodesByAdjacentNode(
{
numMatched += TopoMatchNodeByAdjacentMatched(*nI);
}
+ return numMatched;
}
//////////////////////////////////////////////////////////////////////////////
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/TraceRoute.cpp gen2.2810/utils/src/linux-user/ibdm/datamodel/TraceRoute.cpp
--- gen2.2810.oorig/utils/src/linux-user/ibdm/datamodel/TraceRoute.cpp 2005-07-06 11:52:49.000000000 +0200
+++ gen2.2810/utils/src/linux-user/ibdm/datamodel/TraceRoute.cpp 2005-07-06 15:01:31.000000000 +0200
@@ -111,7 +111,8 @@ int TraceDRPathRoute (IBPort *p_smNodePo
// calc the next port
outPortNum = *pI - 1;
// we could get stuck on bad port num
- if (outPortNum > p_remNode->numPorts || outPortNum < 0) {
+ // as outPortNum is unsigned it's always >= 0
+ if (outPortNum > p_remNode->numPorts) {
cout << "-E- Bad port number:" << outPortNum << " hop:" << hop << endl;
return 1;
}
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/ibdm/src/osm_check.cpp gen2.2810/utils/src/linux-user/ibdm/src/osm_check.cpp
--- gen2.2810.oorig/utils/src/linux-user/ibdm/src/osm_check.cpp 2005-07-06 11:52:44.000000000 +0200
+++ gen2.2810/utils/src/linux-user/ibdm/src/osm_check.cpp 2005-07-06 15:22:07.999098448 +0200
@@ -327,7 +327,6 @@ int main (int argc, char **argv) {
}
while(next_option != -1);
- int status = 0;
IBFabric fabric;
/* based on the topology file we decide what mode we are: */
More information about the general
mailing list