From: Adam Kupczyk Date: Tue, 21 May 2024 09:07:49 +0000 (+0000) Subject: include/encoding.h: Fix message on compat failure X-Git-Tag: testing/wip-jcollin-testing-20240718.061041-squid~6^2~4 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=35a7b9b34338e2cf900fcbce2f1546d92555a0a7;p=ceph-ci.git include/encoding.h: Fix message on compat failure Change misleading message printed when compat is not met. Was: FUNC no longer understand old encoding version 5 < 7 Is: Decoder at FUNC v=5 cant decode v=11 minimal_decoder=7 Signed-off-by: Adam Kupczyk (cherry picked from commit ebd8283e2f2923ca5787483919bb1ab9a3faddea) --- diff --git a/src/include/encoding.h b/src/include/encoding.h index 575580f41a8..d970d28b994 100644 --- a/src/include/encoding.h +++ b/src/include/encoding.h @@ -1466,7 +1466,11 @@ decode(std::array& v, bufferlist::const_iterator& p) #define ENCODE_FINISH(bl) ENCODE_FINISH_NEW_COMPAT(bl, 0) #define DECODE_ERR_OLDVERSION(func, v, compatv) \ - (std::string(func) + " no longer understand old encoding version " #v " < " + std::to_string(compatv)) + (std::string(func) + " no longer understands old encoding version " #v " < " + std::to_string(compatv)) + +#define DECODE_ERR_NO_COMPAT(func, code_v, v, compatv) \ + ("Decoder at '" + std::string(func) + "' v=" + std::to_string(code_v) + \ + " cannot decode v=" + std::to_string(v) + " minimal_decoder=" + std::to_string(compatv)) #define DECODE_ERR_PAST(func) \ (std::string(func) + " decode past end of struct encoding") @@ -1494,7 +1498,7 @@ decode(std::array& v, bufferlist::const_iterator& p) decode(struct_v, bl); \ decode(struct_compat, bl); \ if (v < struct_compat) \ - throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION(__PRETTY_FUNCTION__, v, struct_compat)); \ + throw ::ceph::buffer::malformed_input(DECODE_ERR_NO_COMPAT(__PRETTY_FUNCTION__, v, struct_v, struct_compat)); \ __u32 struct_len; \ decode(struct_len, bl); \ if (struct_len > bl.get_remaining()) \ @@ -1512,7 +1516,7 @@ decode(std::array& v, bufferlist::const_iterator& p) __u8 struct_compat; \ decode(struct_compat, bl); \ if (v < struct_compat) \ - throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION(__PRETTY_FUNCTION__, v, struct_compat)); \ + throw ::ceph::buffer::malformed_input(DECODE_ERR_NO_COMPAT(__PRETTY_FUNCTION__, v, struct_v, struct_compat)); \ } else if (skip_v) { \ if (bl.get_remaining() < skip_v) \ throw ::ceph::buffer::malformed_input(DECODE_ERR_PAST(__PRETTY_FUNCTION__)); \ @@ -1554,8 +1558,8 @@ decode(std::array& v, bufferlist::const_iterator& p) __u8 struct_compat; \ decode(struct_compat, bl); \ if (v < struct_compat) \ - throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION( \ - __PRETTY_FUNCTION__, v, struct_compat)); \ + throw ::ceph::buffer::malformed_input(DECODE_ERR_NO_COMPAT( \ + __PRETTY_FUNCTION__, v, struct_v, struct_compat)); \ } \ unsigned struct_end = 0; \ if (struct_v >= lenv) { \