]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/options.h: use uint64_t for TYPE_SIZE options regardless of CPU architecture 38837/head
authorVladimir Bashkirtsev <vladimir@bashkirtsev.com>
Sun, 10 Jan 2021 01:07:56 +0000 (11:37 +1030)
committerVladimir Bashkirtsev <vladimir@bashkirtsev.com>
Sun, 10 Jan 2021 01:07:56 +0000 (11:37 +1030)
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 <vladimir@bashkirtsev.com>
src/common/options.h

index 15a0bf504658c88ec01c3c398ce64d4673229d2c..6adee886d0303ecd809fed9e0b9cc6bde5f97f53 100644 (file)
@@ -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<uint64_t>(value);
     }
@@ -271,7 +271,7 @@ struct Option {
     case TYPE_BOOL:
       v = bool(new_value); break;
     case TYPE_SIZE:
-      v = size_t{static_cast<std::size_t>(new_value)}; break;
+      v = size_t{static_cast<std::uint64_t>(new_value)}; break;
     case TYPE_SECS:
       v = std::chrono::seconds{new_value}; break;
     case TYPE_MILLISECS: