]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: Move globbing flags to header
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 27 Feb 2017 19:00:56 +0000 (14:00 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 17 May 2017 18:22:18 +0000 (14:22 -0400)
So they can be used when calling the function

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_common.cc
src/rgw/rgw_common.h

index 8f8791528f3a02cd98e4108a5ce46ab8267f6c9e..cb9040d64ab7861469bd8ba6ae6a2b32202a3fdd 100644 (file)
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_rgw
 
-#define POLICY_ACTION           0x01
-#define POLICY_RESOURCE         0x02
-#define POLICY_ARN              0x04
-#define POLICY_STRING           0x08
-
 PerfCounters *perfcounter = NULL;
 
 const uint32_t RGWBucketInfo::NUM_SHARDS_BLIND_BUCKET(UINT32_MAX);
@@ -1749,7 +1744,7 @@ static int matchignorecase(const char& c1, const char& c2)
   return 0;
 }
 
-int match(const string& pattern, const string& input, int flag)
+int match(const string& pattern, const string& input, uint32_t flag)
 {
   auto last_pos_input = 0, last_pos_pattern = 0;
 
@@ -1761,7 +1756,7 @@ int match(const string& pattern, const string& input, int flag)
     string substr_pattern = pattern.substr(last_pos_pattern, cur_pos_pattern);
 
     int res;
-    if (flag & POLICY_ACTION || flag & POLICY_ARN) {
+    if (flag & MATCH_POLICY_ACTION || flag & MATCH_POLICY_ARN) {
       res = match_internal(substr_pattern, substr_input, &matchignorecase);
     } else {
       res = match_internal(substr_pattern, substr_input, &matchcase);
index 63854015c8728b168fb5530727716c559dda85f4..c615008e27134a64797adfe667140ceb91449e74 100644 (file)
@@ -2176,5 +2176,12 @@ extern string  calc_hash_sha256_close_stream(SHA256 **hash);
 
 extern int rgw_parse_op_type_list(const string& str, uint32_t *perm);
 
-int match(const string& pattern, const string& input, int flag);
+namespace {
+  constexpr uint32_t MATCH_POLICY_ACTION = 0x01;
+  constexpr uint32_t MATCH_POLICY_RESOURCE = 0x02;
+  constexpr uint32_t MATCH_POLICY_ARN = 0x04;
+  constexpr uint32_t MATCH_POLICY_STRING = 0x08;
+}
+
+int match(const std::string& pattern, const std::string& input, uint32_t flag);
 #endif