From: Vladimir Bashkirtsev Date: Sun, 10 Jan 2021 01:07:56 +0000 (+1030) Subject: common/options.h: use uint64_t for TYPE_SIZE options regardless of CPU architecture X-Git-Tag: v16.1.0~75^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2745faac2783f2a77eb7a54aebd72eb0dae06a9e;p=ceph-ci.git common/options.h: use uint64_t for TYPE_SIZE options regardless of CPU architecture On 32 bit systems TYPE_SIZE should remain as 64 bit value as large number of default options of TYPE_SIZE easily overflow 32 bit word. Also cluster wide options from 64 bit systems should fit unmodified into options structures on 32 bit systems. Signed-off-by: Vladimir Bashkirtsev --- diff --git a/src/common/options.h b/src/common/options.h index 15a0bf50465..6adee886d03 100644 --- a/src/common/options.h +++ b/src/common/options.h @@ -36,7 +36,7 @@ struct Option { case TYPE_ADDR: return "entity_addr_t"; case TYPE_ADDRVEC: return "entity_addrvec_t"; case TYPE_UUID: return "uuid_d"; - case TYPE_SIZE: return "size_t"; + case TYPE_SIZE: return "uint64_t"; case TYPE_SECS: return "secs"; case TYPE_MILLISECS: return "millisecs"; default: return "unknown"; @@ -127,7 +127,7 @@ struct Option { }; struct size_t { - std::size_t value; + std::uint64_t value; operator uint64_t() const { return static_cast(value); } @@ -271,7 +271,7 @@ struct Option { case TYPE_BOOL: v = bool(new_value); break; case TYPE_SIZE: - v = size_t{static_cast(new_value)}; break; + v = size_t{static_cast(new_value)}; break; case TYPE_SECS: v = std::chrono::seconds{new_value}; break; case TYPE_MILLISECS: