From: Gleb C. <lna...@ya...> - 2025-05-16 14:33:58
|
Commit: ac1e7f8 GitHub URL: https://github.com/SCST-project/scst/commit/ac1e7f82b7fc3fbeffea2e882d123d76ed608f62 Author: Gleb Chesnokov Date: 2025-05-16T17:33:33+03:00 Log Message: ----------- scst: Fix SCST_KVER to use semantic version only Previously, SCST_KVER included the full kernel release string. This patch limits it to the semantic version (e.g. "6.9.0") for cleaner and more consistent output in dmesg, sysfs, and modinfo. Fixes: 6782003bfc7d ("scst: Extend build metadata passed to the SCST") Modified Paths: -------------- Makefile | 3 ++- scst/include/scst_const.h | 12 ++++++------ scst/src/Kbuild | 2 +- scst/src/scst_main.c | 4 ++-- scst/src/scst_sysfs.c | 8 ++++---- 5 files changed, 15 insertions(+), 14 deletions(-) =================================================================== diff --git a/Makefile b/Makefile index 9cfbaea..04100b1 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ ISCSI_DIR = iscsi-scst BUILD_DATE := $(shell date -u '+%Y/%m/%d-%H:%M:%S-%Z%:z') GIT_COMMIT := $(shell git rev-parse --short=12 HEAD 2>/dev/null) +KVER_SEMVER := $(shell echo ${KVER} | cut -d'-' -f1) ifndef BUILD_NUMBER BUILD_NUMBER := $(shell git rev-list --count HEAD 2>/dev/null || echo 0) @@ -80,7 +81,7 @@ ifndef ARCH_TYPE ARCH_TYPE := $(shell uname -m) endif -export KVER BUILD_DATE GIT_COMMIT BUILD_NUMBER ARCH_TYPE +export KVER BUILD_DATE GIT_COMMIT KVER_SEMVER BUILD_NUMBER ARCH_TYPE RELEASE_VERSION := $(shell echo -n "$$(sed -n 's/^\#define[[:blank:]]SCST_VERSION_NAME[[:blank:]]*\"\([^-]*\).*\"/\1/p' scst/include/scst_const.h)") diff --git a/scst/include/scst_const.h b/scst/include/scst_const.h index 7b65dc5..7bbb85c 100644 --- a/scst/include/scst_const.h +++ b/scst/include/scst_const.h @@ -53,12 +53,6 @@ #define SCST_VERSION_STRING_SUFFIX #define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX -#ifdef SCST_KVER -#define SCST_KVER_STRING SCST_STRINGIFY(SCST_KVER) -#else -#define SCST_KVER_STRING "" -#endif - #ifdef SCST_BUILD_DATE #define SCST_BUILD_DATE_STRING SCST_STRINGIFY(SCST_BUILD_DATE) #else @@ -71,6 +65,12 @@ #define SCST_GIT_COMMIT_STRING "" #endif +#ifdef SCST_KVER +#define SCST_KVER_STRING SCST_STRINGIFY(SCST_KVER) +#else +#define SCST_KVER_STRING "" +#endif + #ifdef SCST_BUILD_NUMBER #define SCST_BUILD_NUMBER_STRING SCST_STRINGIFY(SCST_BUILD_NUMBER) #else diff --git a/scst/src/Kbuild b/scst/src/Kbuild index caf1a64..a91679c 100644 --- a/scst/src/Kbuild +++ b/scst/src/Kbuild @@ -16,9 +16,9 @@ ccflags-y := -I$(src)/../include \ -Wstrict-prototypes ccflags-y += $(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM) \ - $(shell [ -n "${KVER}" ] && echo -DSCST_KVER=${KVER}) \ $(shell [ -n "${BUILD_DATE}" ] && echo -DSCST_BUILD_DATE=${BUILD_DATE}) \ $(shell [ -n "${GIT_COMMIT}" ] && echo -DSCST_GIT_COMMIT=${GIT_COMMIT}) \ + $(shell [ -n "${KVER}" ] && echo -DSCST_KVER=${KVER_SEMVER}) \ $(shell [ -n "${BUILD_NUMBER}" ] && echo -DSCST_BUILD_NUMBER=${BUILD_NUMBER}) \ $(shell [ -n "${ARCH_TYPE}" ] && echo -DSCST_ARCH_TYPE=${ARCH_TYPE}) diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 62b760a..c7655e6 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -2475,9 +2475,9 @@ static int __init init_scst(void) scst_max_cmd_mem, scst_max_dev_cmd_mem); #endif PRINT_INFO("SCST version: %s", SCST_VERSION_STRING); - PRINT_INFO("SCST kver: %s", SCST_KVER_STRING); PRINT_INFO("SCST build date: %s", SCST_BUILD_DATE_STRING); PRINT_INFO("SCST git commit sha1: %s", SCST_GIT_COMMIT_STRING); + PRINT_INFO("SCST kver: %s", SCST_KVER_STRING); PRINT_INFO("SCST build number: %s", SCST_BUILD_NUMBER_STRING); PRINT_INFO("SCST arch type: %s", SCST_ARCH_TYPE_STRING); scst_print_config(); @@ -2632,8 +2632,8 @@ MODULE_AUTHOR("Vladislav Bolkhovitin"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI target core"); MODULE_VERSION(SCST_VERSION_STRING); -MODULE_INFO(kver, SCST_KVER_STRING); MODULE_INFO(build_date, SCST_BUILD_DATE_STRING); MODULE_INFO(git_commit, SCST_GIT_COMMIT_STRING); +MODULE_INFO(kver, SCST_KVER_STRING); MODULE_INFO(build_number, SCST_BUILD_NUMBER_STRING); MODULE_INFO(arch_type, SCST_ARCH_TYPE_STRING); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 92a13c2..bf4b31e 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -3987,7 +3987,7 @@ static ssize_t scst_dev_dif_mode_show(struct kobject *kobj, struct kobj_attribut if (dev->dev_dif_mode & SCST_DIF_MODE_TGT) ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "%s%s", ret == pos ? "" : "|", SCST_DIF_MODE_TGT_STR); + "%s", SCST_DIF_MODE_TGT_STR); if (dev->dev_dif_mode & SCST_DIF_MODE_SCST) ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, @@ -7446,15 +7446,15 @@ static ssize_t scst_version_show(struct kobject *kobj, ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST version: %s\n", SCST_VERSION_STRING); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST kver: %s\n", - SCST_KVER_STRING); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST build date: %s\n", SCST_BUILD_DATE_STRING); ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST git commit sha1: %s\n", SCST_GIT_COMMIT_STRING); + ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST kver: %s\n", + SCST_KVER_STRING); + ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST build number: %s\n", SCST_BUILD_NUMBER_STRING); |