PROX: update version 90/67590/2 stable/hunter
authorXavier Simonart <xavier.simonart@intel.com>
Mon, 15 Apr 2019 09:18:11 +0000 (11:18 +0200)
committerXavier Simonart <xavier.simonart@intel.com>
Mon, 15 Apr 2019 15:19:21 +0000 (17:19 +0200)
PROX version was not udpated since a long time, resulting in
difficulty to easily understand which version is being run.
Improved solution should be to support sha1.

Change-Id: I9d68bd64f52f32544d31d2b8c6bcd0c55c7c228c
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
VNFs/DPPD-PROX/display.c
VNFs/DPPD-PROX/main.c
VNFs/DPPD-PROX/version.h

index 2c52d44..d7421e8 100644 (file)
@@ -541,7 +541,7 @@ static void draw_title(void)
 {
        char title_str[128];
 
-       snprintf(title_str, sizeof(title_str), "%s %s: %s", PROGRAM_NAME, VERSION_STR, prox_cfg.name);
+       snprintf(title_str, sizeof(title_str), "%s %s: %s", PROGRAM_NAME, VERSION_STR(), prox_cfg.name);
 
        wbkgd(win_title, COLOR_PAIR(BLACK_ON_GREEN));
        title_len = strlen(title_str);
index ed578c8..4a9ee88 100644 (file)
@@ -1127,7 +1127,7 @@ int main(int argc, char **argv)
        }
 
        plog_init(prox_cfg.log_name, prox_cfg.log_name_pid);
-       plog_info("=== " PROGRAM_NAME " " VERSION_STR " ===\n");
+       plog_info("=== " PROGRAM_NAME " %s ===\n", VERSION_STR());
        plog_info("\tUsing DPDK %s\n", rte_version() + sizeof(RTE_VER_PREFIX));
        read_rdt_info();
 
index a1d0123..a9f46b6 100644 (file)
 #ifndef _VERSION_H_
 #define _VERSION_H_
 
-#define STRINGIFY(s) #s
-#define SSTR(s) STRINGIFY(s)
-
 /* PROGRAM_NAME defined through Makefile */
-#define VERSION_MAJOR 0
-#define VERSION_MINOR 41
+#define VERSION_MAJOR 0      // Pre-production
+#define VERSION_MINOR 1904   // 19.04 i.e. April 2019
 #define VERSION_REV   0
 
+static inline char *VERSION_STR(void)
+{
+       static char version_buffer[32];
+       snprintf(version_buffer, sizeof(version_buffer), "%02d.%02d", VERSION_MINOR / 100, VERSION_MINOR % 100);
 #if VERSION_REV > 0
-#define VERSION_STR "v" SSTR(VERSION_MAJOR) "." SSTR(VERSION_MINOR) "." SSTR(VERSION_REV)
-#else
-#define VERSION_STR "v" SSTR(VERSION_MAJOR) "." SSTR(VERSION_MINOR)
+       snprintf(version_buffer + strlen(version_buffer), sizeof(version_buffer) - strlen(version_buffer), ".%02d", VERSION_REV);
 #endif
-
+       return version_buffer;
 #endif /* _VERSION_H_ */
+}