[openib-general] [PATCH TRIVIAL] osmtest: use more descriptive constant names

Sasha Khapyorsky sashak at voltaire.com
Thu Feb 8 15:16:18 PST 2007


Use more descriptive constant names for osmtest flows.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/osmtest/include/osmtest.h |   12 ++++++++++++
 osm/osmtest/main.c            |   20 ++++++++++----------
 osm/osmtest/osmtest.c         |   22 +++++++++++++---------
 3 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/osm/osmtest/include/osmtest.h b/osm/osmtest/include/osmtest.h
index 39afbaf..13131dd 100644
--- a/osm/osmtest/include/osmtest.h
+++ b/osm/osmtest/include/osmtest.h
@@ -56,6 +56,18 @@
 #include "osmtest_base.h"
 #include "osmtest_subnet.h"
 
+enum OSMT_FLOWS {
+	OSMT_FLOW_ALL = 0,
+	OSMT_FLOW_CREATE_INVENTORY,
+	OSMT_FLOW_VALIDATE_INVENTORY,
+	OSMT_FLOW_SERVICE_REGISTRATION,
+	OSMT_FLOW_EVENT_FORWARDING,
+	OSMT_FLOW_STRESS_SA,
+	OSMT_FLOW_MULTICAST,
+	OSMT_FLOW_QOS,
+	OSMT_FLOW_TRAP,
+};
+
 /****s* OpenSM: Subnet/osmtest_opt_t
  * NAME
  * osmtest_opt_t
diff --git a/osm/osmtest/main.c b/osm/osmtest/main.c
index ca5805b..5f402b7 100644
--- a/osm/osmtest/main.c
+++ b/osm/osmtest/main.c
@@ -354,7 +354,7 @@ main( int argc,
 	opt.create = FALSE;
 	opt.mmode = 1;
 	opt.ignore_path_records = FALSE; /*  Do path Records too */
-	opt.flow = 0; /*  run all validation tests */
+	opt.flow = OSMT_FLOW_ALL; /*  run all validation tests */
 	strcpy(flow_name, "All Validations");
 	strcpy( opt.file_name, "osmtest.dat" );
 
@@ -396,31 +396,31 @@ main( int argc,
 
 		  if (!strcmp("c", optarg)) {
 			 strcpy(flow_name, "Create Inventory");
-			 opt.flow = 1;
+			 opt.flow = OSMT_FLOW_CREATE_INVENTORY;
 		  } else if (!strcmp("v", optarg)) {
 			 strcpy(flow_name, "Validate Inventory");
-			 opt.flow = 2;
+			 opt.flow = OSMT_FLOW_VALIDATE_INVENTORY;
 		  } else if (!strcmp("s", optarg)) {
 			 strcpy(flow_name, "Services Registration");
-			 opt.flow = 3;
+			 opt.flow = OSMT_FLOW_SERVICE_REGISTRATION;
 		  } else if (!strcmp("e", optarg)) {
 			 strcpy(flow_name, "Event Forwarding");
-			 opt.flow = 4;
+			 opt.flow = OSMT_FLOW_EVENT_FORWARDING;
 		  } else if (!strcmp("f", optarg)) {
 			 strcpy(flow_name, "Stress SA");
-			 opt.flow = 5;
+			 opt.flow = OSMT_FLOW_STRESS_SA;
 		  } else if (!strcmp("m", optarg)) {
 			 strcpy(flow_name, "Multicast");
-			 opt.flow = 6;
+			 opt.flow = OSMT_FLOW_MULTICAST;
 		  } else if (!strcmp("q", optarg)) {
 			 strcpy(flow_name, "QoS: VLArb and SLtoVL");
-			 opt.flow = 7;
+			 opt.flow = OSMT_FLOW_QOS;
 		  } else if (!strcmp("t", optarg)) {
 			 strcpy(flow_name, "Trap 64/65");
-			 opt.flow = 8;
+			 opt.flow = OSMT_FLOW_TRAP;
 		  } else if (!strcmp("a", optarg)) {
 			 strcpy(flow_name, "All Validations");
-			 opt.flow = 0;
+			 opt.flow = OSMT_FLOW_ALL;
 		  } else {
 			 printf( "\nError: unknown flow %s\n",flow_name);
 			 exit(2);
diff --git a/osm/osmtest/osmtest.c b/osm/osmtest/osmtest.c
index 3c16a6f..ce185ec 100644
--- a/osm/osmtest/osmtest.c
+++ b/osm/osmtest/osmtest.c
@@ -7948,7 +7948,7 @@ osmtest_run( IN osmtest_t * const p_osmt )
     goto Exit;
   }
 
-  if( p_osmt->opt.flow == 1 )
+  if( p_osmt->opt.flow == OSMT_FLOW_CREATE_INVENTORY )
   {
     /*
      * Creating an inventory file with all nodes, ports and paths
@@ -7965,7 +7965,7 @@ osmtest_run( IN osmtest_t * const p_osmt )
   }
   else
   {
-    if( p_osmt->opt.flow == 5 )
+    if( p_osmt->opt.flow == OSMT_FLOW_STRESS_SA )
     {
       /*
        * Stress SA - flood the it with queries
@@ -8030,7 +8030,8 @@ osmtest_run( IN osmtest_t * const p_osmt )
       /*
        * Run normal validition tests.
        */
-       if (p_osmt->opt.flow == 0 || p_osmt->opt.flow == 2)
+       if (p_osmt->opt.flow == OSMT_FLOW_ALL ||
+           p_osmt->opt.flow == OSMT_FLOW_VALIDATE_INVENTORY)
        {
          /*
           * Only validate the given inventory file
@@ -8056,7 +8057,7 @@ osmtest_run( IN osmtest_t * const p_osmt )
          }
        }
 
-       if (p_osmt->opt.flow == 0)
+       if (p_osmt->opt.flow == OSMT_FLOW_ALL)
        {
          status = osmtest_wrong_sm_key_ignored( p_osmt );
          if( status != IB_SUCCESS )
@@ -8069,7 +8070,8 @@ osmtest_run( IN osmtest_t * const p_osmt )
          }
        }
 
-       if (p_osmt->opt.flow == 0 || p_osmt->opt.flow == 3)
+       if (p_osmt->opt.flow == OSMT_FLOW_ALL ||
+           p_osmt->opt.flow == OSMT_FLOW_SERVICE_REGISTRATION)
        {
          /*
           * run service registration, deregistration, and lease test
@@ -8085,7 +8087,8 @@ osmtest_run( IN osmtest_t * const p_osmt )
          }
        }
 
-       if (p_osmt->opt.flow == 0 || p_osmt->opt.flow == 4)
+       if (p_osmt->opt.flow == OSMT_FLOW_ALL ||
+           p_osmt->opt.flow == OSMT_FLOW_EVENT_FORWARDING)
        {
           /* 
            * Run event forwarding test
@@ -8110,7 +8113,7 @@ osmtest_run( IN osmtest_t * const p_osmt )
 #endif
         }
 
-        if (p_osmt->opt.flow == 7)
+        if (p_osmt->opt.flow == OSMT_FLOW_QOS)
         {
           /* 
            * QoS info: dump VLArb and SLtoVL tables.
@@ -8138,7 +8141,7 @@ osmtest_run( IN osmtest_t * const p_osmt )
           }
         }
 
-        if (p_osmt->opt.flow == 8)
+        if (p_osmt->opt.flow == OSMT_FLOW_TRAP)
         {
           /*
            * Run trap 64/65 flow (this flow requires running of external tool)
@@ -8162,7 +8165,8 @@ osmtest_run( IN osmtest_t * const p_osmt )
 #endif
         }
 
-        if (p_osmt->opt.flow == 0 || p_osmt->opt.flow == 6)
+        if (p_osmt->opt.flow == OSMT_FLOW_ALL ||
+            p_osmt->opt.flow == OSMT_FLOW_MULTICAST)
         {
           /*
            * Multicast flow
-- 
1.5.0.rc2.g11a3





More information about the general mailing list