From 4cc122cc9379088d63cbbc432b2bdfd1efbe0aac Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 25 May 2012 22:36:49 -0700 Subject: [PATCH] entity_name: is_*() methods Signed-off-by: Sage Weil --- src/common/entity_name.cc | 12 ------------ src/common/entity_name.h | 9 +++++++-- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/common/entity_name.cc b/src/common/entity_name.cc index 6f9214e8b8ec6..2e0b0cb1d9efe 100644 --- a/src/common/entity_name.cc +++ b/src/common/entity_name.cc @@ -121,18 +121,6 @@ get_type_str() const return ceph_entity_type_name(type); } -bool EntityName:: -is_admin() const -{ - return (id.compare("admin") == 0); -} - -uint32_t EntityName:: -get_type() const -{ - return type; -} - const char *EntityName:: get_type_name() const { diff --git a/src/common/entity_name.h b/src/common/entity_name.h index 07ac730e3bf2f..550bf1dedc60e 100644 --- a/src/common/entity_name.h +++ b/src/common/entity_name.h @@ -55,8 +55,13 @@ struct EntityName void set_name(entity_name_t n); const char* get_type_str() const; - bool is_admin() const; - uint32_t get_type() const; + + uint32_t get_type() const { return type; } + bool is_osd() const { return get_type() == CEPH_ENTITY_TYPE_OSD; } + bool is_mds() const { return get_type() == CEPH_ENTITY_TYPE_MDS; } + bool is_client() const { return get_type() == CEPH_ENTITY_TYPE_CLIENT; } + bool is_mon() const { return get_type() == CEPH_ENTITY_TYPE_MON; } + const char * get_type_name() const; const std::string &get_id() const; bool has_default_id() const; -- 2.39.5