]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: define C ceph_entity_type_name
authorSage Weil <sage@newdream.net>
Thu, 22 Oct 2009 20:44:20 +0000 (13:44 -0700)
committerSage Weil <sage@newdream.net>
Thu, 22 Oct 2009 20:44:20 +0000 (13:44 -0700)
src/include/msgr.h
src/msg/msg_types.h

index e311c4a4a3ad0b7a3ebb26252d650235b5a5c8c9..706d64282aeb8b8338870a794ef4335efcd01f27 100644 (file)
@@ -46,11 +46,13 @@ struct ceph_entity_name {
        __le64 num;
 } __attribute__ ((packed));
 
-#define CEPH_ENTITY_TYPE_MON    1
-#define CEPH_ENTITY_TYPE_MDS    2
-#define CEPH_ENTITY_TYPE_OSD    3
-#define CEPH_ENTITY_TYPE_CLIENT 4
-#define CEPH_ENTITY_TYPE_ADMIN  5
+#define CEPH_ENTITY_TYPE_MON     1
+#define CEPH_ENTITY_TYPE_MDS     2
+#define CEPH_ENTITY_TYPE_OSD     4
+#define CEPH_ENTITY_TYPE_CLIENT  8
+#define CEPH_ENTITY_TYPE_ADMIN  16
+
+const char *ceph_entity_type_name(int type);
 
 /*
  * entity_addr -- network address
index a9578701b7fc3cec278ad5eb611d5d05b9639829..061714b4cd1114e2bc5b8b255aa2c3ad804deee5 100644 (file)
@@ -50,14 +50,7 @@ public:
   __s64 num() const { return _num; }
   int type() const { return _type; }
   const char *type_str() const {
-    switch (type()) {
-    case TYPE_MDS: return "mds"; 
-    case TYPE_OSD: return "osd"; 
-    case TYPE_MON: return "mon"; 
-    case TYPE_CLIENT: return "client"; 
-    case TYPE_ADMIN: return "admin";
-    default: return "unknown";
-    }    
+    return ceph_entity_type_name(type());
   }
 
   bool is_new() const { return num() < 0; }