scst: Fix a version string mismatch

Make the SCST_VERSION_STRING macro revision-independent, because it
causes a version string mismatch for SCST-dependent modules where the
revision is not exported.

Fixes: a86e5c55ea ("Makefile, scst: Add revision to SCST version macro")
Fixes: https://github.com/SCST-project/scst/issues/130
This commit is contained in:
Gleb Chesnokov
2023-02-09 19:50:03 +03:00
parent e76e3261a1
commit 250c9cd76a
4 changed files with 15 additions and 14 deletions

View File

@@ -49,15 +49,15 @@
#define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d)
#define SCST_VERSION_CODE SCST_VERSION(3, 8, 0, 0)
#ifdef SCST_VERSION_REVISION
#define SCST_VERSION_REVISION_SUFFIX "." SCST_STRINGIFY(SCST_VERSION_REVISION)
#else
#define SCST_VERSION_REVISION_SUFFIX ""
#endif
#define SCST_VERSION_STRING_SUFFIX
#define SCST_VERSION_NAME "3.8.0-pre"
#define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX SCST_VERSION_REVISION_SUFFIX
#define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX
#ifdef SCST_REVISION
#define SCST_REVISION_STRING SCST_STRINGIFY(SCST_REVISION)
#else
#define SCST_REVISION_STRING ""
#endif
#define SCST_CONST_VERSION SCST_CONST_INTF_VER

View File

@@ -3,7 +3,7 @@
ccflags-y += -I$(src)/../include \
-DDEFAULT_SYMBOL_NAMESPACE=SCST \
$(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM) \
$(shell [ -n "${REVISION}" ] && echo -DSCST_VERSION_REVISION=${REVISION})
$(shell [ -n "${REVISION}" ] && echo -DSCST_REVISION=${REVISION})
#ccflags-y += -DCONFIG_SCST_STRICT_SERIALIZING
#ccflags-y += -DCONFIG_SCST_USE_EXPECTED_VALUES

View File

@@ -2490,12 +2490,11 @@ static int __init init_scst(void)
goto out_thread_free;
#ifdef CONFIG_SCST_NO_TOTAL_MEM_CHECKS
PRINT_INFO("SCST version %s loaded successfully (global max mem for commands "
"ignored, per device %dMB)", SCST_VERSION_STRING, scst_max_dev_cmd_mem);
PRINT_INFO("SCST version %s (revision=%s) loaded successfully (global max mem for commands ignored, per device %dMB)",
SCST_VERSION_STRING, SCST_REVISION_STRING, scst_max_dev_cmd_mem);
#else
PRINT_INFO("SCST version %s loaded successfully (max mem for "
"commands %dMB, per device %dMB)", SCST_VERSION_STRING,
scst_max_cmd_mem, scst_max_dev_cmd_mem);
PRINT_INFO("SCST version %s (revision=%s) loaded successfully (max mem for commands %dMB, per device %dMB)",
SCST_VERSION_STRING, SCST_REVISION_STRING, scst_max_cmd_mem, scst_max_dev_cmd_mem);
#endif
scst_print_config();
@@ -2652,3 +2651,4 @@ MODULE_AUTHOR("Vladislav Bolkhovitin");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("SCSI target core");
MODULE_VERSION(SCST_VERSION_STRING);
MODULE_INFO(revision, SCST_REVISION_STRING);

View File

@@ -7517,7 +7517,8 @@ static ssize_t scst_version_show(struct kobject *kobj,
{
TRACE_ENTRY();
sprintf(buf, "%s\n", SCST_VERSION_STRING);
sprintf(buf, "%s (revision=%s)\n",
SCST_VERSION_STRING, SCST_REVISION_STRING);
#ifdef CONFIG_SCST_STRICT_SERIALIZING
strcat(buf, "STRICT_SERIALIZING\n");