[ofa-general] [PATCH] libibcommon, infiniband-diags: move get_build_version() to diags
Sasha Khapyorsky
sashak at voltaire.com
Sun Oct 14 12:52:51 PDT 2007
Move get_build_version() function (which is ifdefed by
__BUILD_VERSION_TAG__) to infiniband-diags, where it is only used.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
infiniband-diags/include/ibdiag_common.h | 11 +++++++++++
infiniband-diags/src/ibstat.c | 4 ++--
infiniband-diags/src/smpdump.c | 6 +++---
libibcommon/include/infiniband/common.h | 18 ------------------
4 files changed, 16 insertions(+), 23 deletions(-)
diff --git a/infiniband-diags/include/ibdiag_common.h b/infiniband-diags/include/ibdiag_common.h
index 2d463c5..159e929 100644
--- a/infiniband-diags/include/ibdiag_common.h
+++ b/infiniband-diags/include/ibdiag_common.h
@@ -65,4 +65,15 @@ void iberror(const char *fn, char *msg, ...);
/* NOTE: this modifies the parameter "nodedesc". */
char *clean_nodedesc(char *nodedesc);
+#ifdef __BUILD_VERSION_TAG__
+
+#define stringify(s) to_string(s)
+#define to_string(s) #s
+
+static inline const char* get_build_version(void)
+{
+ return "BUILD VERSION: " stringify(__BUILD_VERSION_TAG__) " Build date: " __DATE__ " " __TIME__ ;
+}
+#endif
+
#endif /* _IBDIAG_COMMON_H_ */
diff --git a/infiniband-diags/src/ibstat.c b/infiniband-diags/src/ibstat.c
index 4653390..aa55d83 100644
--- a/infiniband-diags/src/ibstat.c
+++ b/infiniband-diags/src/ibstat.c
@@ -62,11 +62,11 @@
#include <infiniband/umad.h>
#include <infiniband/mad.h>
-#define DEBUG if (debug) IBWARN
+#include <ibdiag_common.h>
static int debug;
-static char *argv0 = "ibstat";
+char *argv0 = "ibstat";
static char *node_type_str[] = {
"???",
diff --git a/infiniband-diags/src/smpdump.c b/infiniband-diags/src/smpdump.c
index 5eceea7..c325771 100644
--- a/infiniband-diags/src/smpdump.c
+++ b/infiniband-diags/src/smpdump.c
@@ -61,7 +61,7 @@
#include <infiniband/mad.h>
#include <infiniband/umad.h>
-#define DEBUG if (debug) IBWARN
+#include <ibdiag_common.h>
static const uint8_t CLASS_SUBN_DIRECTED_ROUTE = 0x81;
static const uint8_t CLASS_SUBN_LID_ROUTE = 0x1;
@@ -73,9 +73,9 @@ static const uint8_t CLASS_SUBN_LID_ROUTE = 0x1;
static int mad_agent;
static int drmad_tid = 0x123;
-static int debug;
+static int debug, verbose;
-static char *argv0 = "smpdump";
+char *argv0 = "smpdump";
typedef struct {
char path[64];
diff --git a/libibcommon/include/infiniband/common.h b/libibcommon/include/infiniband/common.h
index 72147d8..4eb3872 100644
--- a/libibcommon/include/infiniband/common.h
+++ b/libibcommon/include/infiniband/common.h
@@ -143,24 +143,6 @@ uint64_t getcurrenttime(void);
/* hash.c */
uint32_t fhash(uint8_t *k, int length, uint32_t initval);
-#ifdef __BUILD_VERSION_TAG__
-
-#undef stringify
-#undef tostring
-
-#define stringify(s) tostring(s)
-#define tostring(s) #s
-
-__attribute__((unused)) static char _build_version[] = { "BUILD VERSION: " stringify(__BUILD_VERSION_TAG__) " Build date: " __DATE__ " " __TIME__ };
-
-__attribute__((unused)) static inline char*
-get_build_version(void)
-{
- return _build_version;
-}
-
-#endif
-
END_C_DECLS
#endif /* __COMMON_H__ */
--
1.5.3.rc2.29.gc4640f
More information about the general
mailing list