From 92d70cf63e59905a880fb24faddb9030ef991eb8 Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Mon, 24 Jun 2024 08:22:46 +0000 Subject: [PATCH] build: split ceph_ver.h Split ceph_ver.h into: 1) ceph_ver.h containing git-related macros 2) ceph_release.h containing just human written ceph version number / ceph version name. The benefit is that denc.h which needs to know CEPH_RELEASE value can skip including git-related macros. There are many compilation units that use denc.h and only few that need git-related macros. Reduces amount of files to recompile after SHA1 changes. It is only relevant for developer environment. Signed-off-by: Adam Kupczyk (cherry picked from commit 1a56293f2c890d9222fab5e1e91c34e2d864aef9) --- src/CMakeLists.txt | 4 ++++ src/ceph_release.h.in.cmake | 8 ++++++++ src/ceph_ver.h.in.cmake | 5 ++--- src/include/denc.h | 7 ++++--- 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 src/ceph_release.h.in.cmake diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 90c9c48e06e12..da3102f9e5a29 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -70,6 +70,10 @@ configure_file( ${CMAKE_SOURCE_DIR}/src/ceph_ver.h.in.cmake ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h @ONLY) +configure_file( + ${CMAKE_SOURCE_DIR}/src/ceph_release.h.in.cmake + ${CMAKE_BINARY_DIR}/src/include/ceph_release.h + @ONLY) add_definitions( -DHAVE_CONFIG_H diff --git a/src/ceph_release.h.in.cmake b/src/ceph_release.h.in.cmake new file mode 100644 index 0000000000000..f622fc565f169 --- /dev/null +++ b/src/ceph_release.h.in.cmake @@ -0,0 +1,8 @@ +#ifndef CEPH_RELEASE_H +#define CEPH_RELEASE_H + +#define CEPH_RELEASE @CEPH_RELEASE@ +#define CEPH_RELEASE_NAME "@CEPH_RELEASE_NAME@" +#define CEPH_RELEASE_TYPE "@CEPH_RELEASE_TYPE@" + +#endif diff --git a/src/ceph_ver.h.in.cmake b/src/ceph_ver.h.in.cmake index d7e1c8e9bddff..028a1c527b444 100644 --- a/src/ceph_ver.h.in.cmake +++ b/src/ceph_ver.h.in.cmake @@ -3,8 +3,7 @@ #define CEPH_GIT_VER @CEPH_GIT_VER@ #define CEPH_GIT_NICE_VER "@CEPH_GIT_NICE_VER@" -#define CEPH_RELEASE @CEPH_RELEASE@ -#define CEPH_RELEASE_NAME "@CEPH_RELEASE_NAME@" -#define CEPH_RELEASE_TYPE "@CEPH_RELEASE_TYPE@" + +#include "ceph_release.h" #endif diff --git a/src/include/denc.h b/src/include/denc.h index 1ebc395e70ee4..00a2901656557 100644 --- a/src/include/denc.h +++ b/src/include/denc.h @@ -51,7 +51,7 @@ #include "common/convenience.h" #include "common/error_code.h" -#include "ceph_ver.h" +#include "ceph_release.h" template struct denc_traits { @@ -1849,13 +1849,14 @@ inline std::enable_if_t decode_nohead( // DENC_START interface suggests it is checking compatibility, // but the feature was unimplemented until SQUID. // Due to -2 compatibility rule we cannot bump up compat until U____ release. +// SQUID=19 T____=20 U____=21 #define DENC_START(v, compat, p) \ __u8 struct_v = v; \ __u8 struct_compat = compat; \ char *_denc_pchar; \ uint32_t _denc_u32; \ - static_assert(CEPH_RELEASE >= 21 || compat == 1); \ + static_assert(CEPH_RELEASE >= (19/*squid*/ + 2) || compat == 1); \ _denc_start(p, &struct_v, &struct_compat, &_denc_pchar, &_denc_u32); \ do { @@ -1865,7 +1866,7 @@ inline std::enable_if_t decode_nohead( __u8 struct_compat = compat; \ char *_denc_pchar; \ uint32_t _denc_u32; \ - static_assert(CEPH_RELEASE >= 21 || compat == 2); \ + static_assert(CEPH_RELEASE >= (19/*squid*/ + 2) || compat == 2); \ _denc_start(p, &struct_v, &struct_compat, &_denc_pchar, &_denc_u32); \ do { -- 2.39.5