]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: add ceph_str_hash_valid() to verify hash type
authorhuanwen ren <ren.huanwen@zte.com.cn>
Tue, 7 Jun 2016 07:06:36 +0000 (15:06 +0800)
committerhuanwen ren <ren.huanwen@zte.com.cn>
Tue, 21 Jun 2016 11:47:31 +0000 (19:47 +0800)
if hash type is CEPH_STR_HASH_LINUX/CEPH_STR_HASH_RJENKINS then return true,
if not return false

Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
src/common/ceph_hash.cc
src/include/ceph_hash.h

index c581806d83ddcc930edc4d488d04bf5fe728ca1a..63082fcb8f594db4408b03607adf4203216c26c3 100644 (file)
@@ -115,3 +115,14 @@ const char *ceph_str_hash_name(int type)
                return "unknown";
        }
 }
+
+bool ceph_str_hash_valid(int type)
+{
+        switch (type) {
+        case CEPH_STR_HASH_LINUX:
+        case CEPH_STR_HASH_RJENKINS:
+                return true;
+        default:
+                return false;
+        }
+}
index d099c3f90236276976586dfbf505ff46141e7ddb..f9d80ac36ad66d4a0ad4dd87096a6228cc6bd18c 100644 (file)
@@ -9,5 +9,6 @@ extern unsigned ceph_str_hash_rjenkins(const char *s, unsigned len);
 
 extern unsigned ceph_str_hash(int type, const char *s, unsigned len);
 extern const char *ceph_str_hash_name(int type);
+extern bool ceph_str_hash_valid(int type);
 
 #endif