diff options
author | Petri Savolainen <petri.savolainen@nokia.com> | 2019-05-02 11:26:34 +0300 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2019-05-09 09:43:17 +0300 |
commit | 2e927d35cb368611d2684caee633dbff733cebe5 (patch) | |
tree | 0444a432702bd5d0a758421512a74b8a77cecac9 /helper | |
parent | 9dced3ede96b81f883172bad827054bd796c13b4 (diff) |
helper: add helper version defines
Added helper library version defines, so that application can
track helper version independent of ODP API version. Added also
function for easy print out of the versions number.
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Stanislaw Kardach <skardach@marvell.com>
Diffstat (limited to 'helper')
-rw-r--r-- | helper/Makefile.am | 6 | ||||
-rw-r--r-- | helper/include/odp/helper/.gitignore | 1 | ||||
-rw-r--r-- | helper/include/odp/helper/odph_api.h | 1 | ||||
-rw-r--r-- | helper/include/odp/helper/version.h.in | 72 | ||||
-rw-r--r-- | helper/test/.gitignore | 1 | ||||
-rw-r--r-- | helper/test/Makefile.am | 4 | ||||
-rw-r--r-- | helper/test/version.c | 22 | ||||
-rw-r--r-- | helper/version.c | 20 |
8 files changed, 124 insertions, 3 deletions
diff --git a/helper/Makefile.am b/helper/Makefile.am index 518a6a944..a7d5132df 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -27,7 +27,8 @@ helperinclude_HEADERS = \ include/odp/helper/tcp.h\ include/odp/helper/table.h\ include/odp/helper/threads.h \ - include/odp/helper/udp.h + include/odp/helper/udp.h \ + include/odp/helper/version.h if helper_linux helperinclude_HEADERS += \ @@ -51,7 +52,8 @@ __LIB__libodphelper_la_SOURCES = \ lineartable.c \ cuckootable.c \ iplookuptable.c \ - threads.c + threads.c \ + version.c if helper_linux __LIB__libodphelper_la_SOURCES += \ diff --git a/helper/include/odp/helper/.gitignore b/helper/include/odp/helper/.gitignore new file mode 100644 index 000000000..67020331b --- /dev/null +++ b/helper/include/odp/helper/.gitignore @@ -0,0 +1 @@ +version.h diff --git a/helper/include/odp/helper/odph_api.h b/helper/include/odp/helper/odph_api.h index d46ab2ad2..4bd10bf46 100644 --- a/helper/include/odp/helper/odph_api.h +++ b/helper/include/odp/helper/odph_api.h @@ -33,6 +33,7 @@ extern "C" { #include <odp/helper/table.h> #include <odp/helper/threads.h> #include <odp/helper/udp.h> +#include <odp/helper/version.h> #ifdef __cplusplus } diff --git a/helper/include/odp/helper/version.h.in b/helper/include/odp/helper/version.h.in new file mode 100644 index 000000000..127b3ff9d --- /dev/null +++ b/helper/include/odp/helper/version.h.in @@ -0,0 +1,72 @@ +/* Copyright (c) 2019, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP helper version + */ + +#ifndef ODPH_VERSION_H_ +#define ODPH_VERSION_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup odph_version VERSION + * @{ + */ + +/** + * ODP helper generation version + * + * Introduction of major new features or changes that make very significant + * changes to the helper library. + */ +#define ODPH_VERSION_GENERATION @ODPH_VERSION_GENERATION@ + +/** + * ODP helper major version + * + * Introduction of major new features or changes. Helper libraries with common + * generation, but with different major version numbers are likely not backward + * compatible. + */ +#define ODPH_VERSION_MAJOR @ODPH_VERSION_MAJOR@ + +/** + * ODP helper minor version + * + * Minor version is incremented when introducing backward compatible changes. + * Helper libraries with common generation and major version, but with + * different minor version numbers are backward compatible. + */ +#define ODPH_VERSION_MINOR @ODPH_VERSION_MINOR@ + +/** + * ODP helper version string + * + * The version string defines the helper library version in this format: + * @verbatim <generation>.<major>.<minor> @endverbatim + * + * The string is null terminated. + * + * @return Pointer to helper library version string + */ +const char *odph_version_str(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/helper/test/.gitignore b/helper/test/.gitignore index 1a81e0047..5a6c60bcc 100644 --- a/helper/test/.gitignore +++ b/helper/test/.gitignore @@ -9,3 +9,4 @@ process table thread pthread +version diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am index 662d6c758..bf3aa862c 100644 --- a/helper/test/Makefile.am +++ b/helper/test/Makefile.am @@ -1,6 +1,7 @@ include $(top_srcdir)/test/Makefile.inc -EXECUTABLES = chksum \ +EXECUTABLES = version \ + chksum \ cuckootable \ parse\ table \ @@ -36,3 +37,4 @@ odpthreads_SOURCES = odpthreads.c parse_SOURCES = parse.c table_SOURCES = table.c iplookuptable_SOURCES = iplookuptable.c +version_SOURCES = version.c diff --git a/helper/test/version.c b/helper/test/version.c new file mode 100644 index 000000000..bd817bb47 --- /dev/null +++ b/helper/test/version.c @@ -0,0 +1,22 @@ +/* Copyright (c) 2019, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "config.h" + +#include <odph_debug.h> + +#include <odp_api.h> +#include <odp/helper/odph_api.h> + +#include <stdio.h> +#include <string.h> + +int main(void) +{ + printf("\nHelper library versions is: %s\n\n", odph_version_str()); + + return 0; +} diff --git a/helper/version.c b/helper/version.c new file mode 100644 index 000000000..586abbe41 --- /dev/null +++ b/helper/version.c @@ -0,0 +1,20 @@ +/* Copyright (c) 2019, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/helper/version.h> + +#define VERSION_STR_EXPAND(x) #x +#define VERSION_TO_STR(x) VERSION_STR_EXPAND(x) + +#define VERSION_STR \ +VERSION_TO_STR(ODPH_VERSION_GENERATION) "." \ +VERSION_TO_STR(ODPH_VERSION_MAJOR) "." \ +VERSION_TO_STR(ODPH_VERSION_MINOR) + +const char *odph_version_str(void) +{ + return VERSION_STR; +} |