Add the function of outputting rdci version information

Change-Id: Iabeec48ba2e109ead7fb6fb07454ebcdc74a11e6
Signed-off-by: Chen Gong <curry.gong@amd.com>


[ROCm/rdc commit: 6591563d53]
Šī revīzija ir iekļauta:
Chen Gong
2024-08-21 14:02:50 +08:00
revīziju iesūtīja Galantsev, Dmitrii
vecāks c495b7d086
revīzija 2aba92bdce
+26 -2
Parādīt failu
@@ -22,6 +22,7 @@ THE SOFTWARE.
#include <iostream>
#include <string>
#include <string.h>
#include "RdciDiagSubSystem.h"
#include "RdciDiscoverySubSystem.h"
@@ -33,16 +34,39 @@ THE SOFTWARE.
#include "rdc_lib/RdcException.h"
#include "rdc_lib/rdc_common.h"
#define RDC_CLIENT_VERSION_MAJOR 1
#define RDC_CLIENT_VERSION_MINOR 0
#define RDC_CLIENT_VERSION_RELEASE 0
#define RDC_CLIENT_VERSION_CREATE_STRING(MAJOR, MINOR, RELEASE) (#MAJOR "." #MINOR "." #RELEASE)
#define RDC_CLIENT_VERSION_EXPAND_PARTS(MAJOR_STR, MINOR_STR, RELEASE_STR) RDC_CLIENT_VERSION_CREATE_STRING(MAJOR_STR, MINOR_STR, RELEASE_STR)
#define RDC_CLIENT_VERSION_STRING RDC_CLIENT_VERSION_EXPAND_PARTS(RDC_CLIENT_VERSION_MAJOR, RDC_CLIENT_VERSION_MINOR, RDC_CLIENT_VERSION_RELEASE)
#define Q(x) #x
#define QUOTE(x) Q(x)
int main(int argc, char** argv) {
const std::string usage_help =
"Usage:\trdci <subsystem>\nsubsystem: discovery, dmon, group, "
"fieldgroup, stats, diag\n";
"Usage:\trdci <subsystem>|<options>\n"
"subsystem: \n"
" discovery, dmon, group, fieldgroup, stats, diag\n"
"options: \n"
" -v(--version) : Print client version information only\n";
if (argc <= 1) {
std::cout << usage_help;
exit(0);
}
if (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0) {
#ifdef CURRENT_GIT_HASH
std::cout << "RDCI : " << RDC_CLIENT_VERSION_STRING << "+" << QUOTE(CURRENT_GIT_HASH) << std::endl;
#else
std::cout << "RDCI : " << RDC_CLIENT_VERSION_STRING << std::endl;
#endif
exit(0);
}
amd::rdc::RdciSubSystemPtr subsystem;
try {
std::string subsystem_name = argv[1];