]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: make enums statically castable
authorDmitrii Sharshakov <d3dx12.xx@gmail.com>
Thu, 1 Jan 2026 12:32:07 +0000 (13:32 +0100)
committerDmitrii Sharshakov <d3dx12.xx@gmail.com>
Fri, 9 Jan 2026 18:14:55 +0000 (19:14 +0100)
Fix the following compiler error:

in-class initializer for static data member is not a constant expression

Co-authored-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
src/cls/rbd/cls_rbd_types.h
src/librbd/journal/Types.h
src/librbd/mirroring_watcher/Types.h
src/librbd/trash_watcher/Types.h
src/rbd_replay/ActionTypes.h
src/tools/rbd_mirror/image_map/Types.h
src/tools/rbd_mirror/instance_watcher/Types.h
src/tools/rbd_mirror/leader_watcher/Types.h

index cd7cad2e88dca759c1e6531bcd4a581ed63e02bc..c81d49bb6b3d29e2878ceef4d876a3f88b559aef 100644 (file)
@@ -423,7 +423,7 @@ struct GroupSpec {
 
 WRITE_CLASS_ENCODER(GroupSpec);
 
-enum SnapshotNamespaceType {
+enum SnapshotNamespaceType : uint32_t {
   SNAPSHOT_NAMESPACE_TYPE_USER   = 0,
   SNAPSHOT_NAMESPACE_TYPE_GROUP  = 1,
   SNAPSHOT_NAMESPACE_TYPE_TRASH  = 2,
index a7d2f4ef4465cd0b33d7551d183e35877dd05076..544a1aca7bd69b33aab7e38fe748c0a2526efc39 100644 (file)
@@ -25,7 +25,7 @@ class Formatter;
 namespace librbd {
 namespace journal {
 
-enum EventType {
+enum EventType : uint32_t {
   EVENT_TYPE_AIO_DISCARD           = 0,
   EVENT_TYPE_AIO_WRITE             = 1,
   EVENT_TYPE_AIO_FLUSH             = 2,
@@ -464,7 +464,7 @@ private:
 
 // Journal Client data structures
 
-enum ClientMetaType {
+enum ClientMetaType : uint32_t {
   IMAGE_CLIENT_META_TYPE       = 0,
   MIRROR_PEER_CLIENT_META_TYPE = 1,
   CLI_CLIENT_META_TYPE         = 2
index c837e208d3ecfa28bface1b07f5d30cb202ad988..1d0c6b8b46bca82d574ae35976054f0267140796 100644 (file)
@@ -18,7 +18,7 @@ namespace ceph { class Formatter; }
 namespace librbd {
 namespace mirroring_watcher {
 
-enum NotifyOp {
+enum NotifyOp : uint32_t {
   NOTIFY_OP_MODE_UPDATED  = 0,
   NOTIFY_OP_IMAGE_UPDATED = 1
 };
index ba6cd9ff2f8cc82833aa2f17dd4aeaa64c3887cc..b3b42ba2163d728145360f370b90fc164e6ca38b 100644 (file)
@@ -17,7 +17,7 @@
 namespace librbd {
 namespace trash_watcher {
 
-enum NotifyOp {
+enum NotifyOp : uint32_t {
   NOTIFY_OP_IMAGE_ADDED = 0,
   NOTIFY_OP_IMAGE_REMOVED = 1
 };
index 585d756ea9d698422d51cce072769f106e93e939..e4103d1dcde906f6dcacee1030a92c1a02c77b83 100644 (file)
@@ -61,7 +61,7 @@ WRITE_CLASS_ENCODER(Dependency);
 
 typedef std::vector<Dependency> Dependencies;
 
-enum ActionType {
+enum ActionType : uint8_t {
   ACTION_TYPE_START_THREAD    = 0,
   ACTION_TYPE_STOP_THREAD     = 1,
   ACTION_TYPE_READ            = 2,
index 871bc5ffffa0d22bfb1311413572e1c2fbbd9ad1..77efda17dc3243c6f8614555ac207cda3a649551 100644 (file)
@@ -60,7 +60,7 @@ typedef std::vector<std::string> InstanceIds;
 typedef std::set<std::string> GlobalImageIds;
 typedef std::map<std::string, ActionType> ImageActionTypes;
 
-enum PolicyMetaType {
+enum PolicyMetaType : uint32_t {
   POLICY_META_TYPE_NONE = 0,
 };
 
index 6bb430d36aae4c325db63b6bc3ab5902e41a828a..549113a2853ac35f77ff7a027d1b6264d9f78d2c 100644 (file)
@@ -18,7 +18,7 @@ namespace rbd {
 namespace mirror {
 namespace instance_watcher {
 
-enum NotifyOp {
+enum NotifyOp : uint32_t {
   NOTIFY_OP_IMAGE_ACQUIRE      = 0,
   NOTIFY_OP_IMAGE_RELEASE      = 1,
   NOTIFY_OP_PEER_IMAGE_REMOVED = 2,
index 0e987c4eb04e521bcd5f1b3bb2c4340408c82c36..2f20e4518431de147719b348410e0ff9e359fbf1 100644 (file)
@@ -35,7 +35,7 @@ struct Listener {
   virtual void handle_instances_removed(const InstanceIds& instance_ids) = 0;
 };
 
-enum NotifyOp {
+enum NotifyOp : uint32_t {
   NOTIFY_OP_HEARTBEAT        = 0,
   NOTIFY_OP_LOCK_ACQUIRED    = 1,
   NOTIFY_OP_LOCK_RELEASED    = 2,