From: Jonathan Rajotte Julien Date: Thu, 15 May 2014 16:10:17 +0000 (-0400) Subject: Mi version command: add commit version to mi version X-Git-Tag: v2.6.0-rc1~129 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=314d52225ce6d9b81d48b7645b035b1c93875369;p=lttng-tools.git Mi version command: add commit version to mi version --- diff --git a/src/bin/lttng/commands/version.c b/src/bin/lttng/commands/version.c index d27013689..8631cf948 100644 --- a/src/bin/lttng/commands/version.c +++ b/src/bin/lttng/commands/version.c @@ -65,6 +65,7 @@ static void create_version(struct mi_lttng_version *version) version->version_major = VERSION_MAJOR; version->version_minor = VERSION_MINOR; version->version_patchlevel = VERSION_PATCHLEVEL; + strncpy(version->version_commit, FULL_VERSION, NAME_MAX); strncpy(version->version_name, VERSION_NAME, NAME_MAX); strncpy(version->package_url, PACKAGE_URL, NAME_MAX); } diff --git a/src/common/mi-lttng.c b/src/common/mi-lttng.c index 02500ff14..7364c5d82 100644 --- a/src/common/mi-lttng.c +++ b/src/common/mi-lttng.c @@ -36,6 +36,7 @@ const char * const mi_lttng_element_version_str = "string"; const char * const mi_lttng_element_version_web = "url"; const char * const mi_lttng_element_version_major = "major"; const char * const mi_lttng_element_version_minor = "minor"; +const char * const mi_lttng_element_version_commit = "commit"; const char * const mi_lttng_element_version_license = "license"; const char * const mi_lttng_element_version_patch_level = "patchLevel"; const char * const mi_lttng_element_version_description = "description"; @@ -372,6 +373,13 @@ int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version *version, goto end; } + /* Commit version number */ + ret = mi_lttng_writer_write_element_string(writer, + mi_lttng_element_version_commit, version->version_commit); + if (ret) { + goto end; + } + /* Patch number */ ret = mi_lttng_writer_write_element_unsigned_int(writer, mi_lttng_element_version_patch_level, version->version_patchlevel); diff --git a/src/common/mi-lttng.h b/src/common/mi-lttng.h index f033bd770..e2b5de71c 100644 --- a/src/common/mi-lttng.h +++ b/src/common/mi-lttng.h @@ -40,6 +40,7 @@ struct mi_lttng_version { uint32_t version_major; /* LTTng-Tools major version number */ uint32_t version_minor; /* LTTng-Tools minor version number */ uint32_t version_patchlevel; /* LTTng-Tools patchlevel version number */ + char version_commit[NAME_MAX]; /* Commit hash of the current version */ char version_name[NAME_MAX]; char package_url[NAME_MAX]; /* Define to the home page for this package. */ }; @@ -58,6 +59,7 @@ const char * const mi_lttng_element_version_web; const char * const mi_lttng_element_version_major; const char * const mi_lttng_element_version_minor; const char * const mi_lttng_element_version_license; +const char * const mi_lttng_element_version_commit; const char * const mi_lttng_element_version_patch_level; const char * const mi_lttng_element_version_description; diff --git a/src/common/mi_lttng.xsd b/src/common/mi_lttng.xsd index 6fc25c6b7..d41b1eda1 100644 --- a/src/common/mi_lttng.xsd +++ b/src/common/mi_lttng.xsd @@ -153,6 +153,7 @@ THE SOFTWARE. +