From: Thomas Monjalon Date: Tue, 16 Apr 2013 09:44:12 +0000 (+0200) Subject: version: add 4th digit and helper macros X-Git-Tag: spdx-start~10922 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c528a3b7d5be8603ac3b016e512190c1092f958c;p=dpdk.git version: add 4th digit and helper macros Applications can test versions, for compatibility, this way: #if RTE_VERSION >= RTE_VERSION_NUM(1,2,3,4) RTE_VERSION was already defined for use with rte_config. It is moved in rte_version.h and updated to current version number. Note that the first tag having this helper is 1.2.3r2. Releases r0 have not this patch. Signed-off-by: Thomas Monjalon Acked-by: Olivier Matz --- diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index fe1323df65..658b4f7a56 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -46,7 +46,6 @@ extern "C" { #endif -#define RTE_VERSION 1 /**< The version of the RTE configuration structure. */ #define RTE_MAGIC 19820526 /**< Magic number written by the main partition when ready. */ /** diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h index 79ff2ea8ff..56dfa3219a 100644 --- a/lib/librte_eal/common/include/rte_version.h +++ b/lib/librte_eal/common/include/rte_version.h @@ -66,6 +66,25 @@ extern "C" { */ #define RTE_VER_PATCH_LEVEL 0 +/** + * Patch release number i.e. the w in x.y.zrw + */ +#define RTE_VER_PATCH_RELEASE 0 + +/** + * Macro to compute a version number usable for comparisons + */ +#define RTE_VERSION_NUM(a,b,c,d) ((a) << 24 | (b) << 16 | (c) << 8 | (d)) + +/** + * All version numbers in one to compare with RTE_VERSION_NUM() + */ +#define RTE_VERSION RTE_VERSION_NUM( \ + RTE_VER_MAJOR, \ + RTE_VER_MINOR, \ + RTE_VER_PATCH_LEVEL, \ + RTE_VER_PATCH_RELEASE) + /** * Extra string to be appended to version number, * for example: pre1, EAR, final etc. @@ -73,7 +92,7 @@ extern "C" { #define RTE_VER_SUFFIX "" /** - * Function returning string of version number: "RTE x.y.z" + * Function returning string of version number: "RTE x.y.zrw" * @return * string */ @@ -83,13 +102,15 @@ rte_version(void) { return RTE_VER_PREFIX" " RTE_STR(RTE_VER_MAJOR)"." RTE_STR(RTE_VER_MINOR)"." - RTE_STR(RTE_VER_PATCH_LEVEL) + RTE_STR(RTE_VER_PATCH_LEVEL)"r" + RTE_STR(RTE_VER_PATCH_RELEASE) "-"RTE_VER_SUFFIX; else return RTE_VER_PREFIX" " RTE_STR(RTE_VER_MAJOR)"." RTE_STR(RTE_VER_MINOR)"." - RTE_STR(RTE_VER_PATCH_LEVEL); + RTE_STR(RTE_VER_PATCH_LEVEL)"r" + RTE_STR(RTE_VER_PATCH_RELEASE); } #ifdef __cplusplus