From 9e8172b8404efd9978bbe6a2b6db8c8f0be50d6d Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Mon, 27 Feb 2017 14:00:56 -0500 Subject: [PATCH] rgw: Move globbing flags to header So they can be used when calling the function Signed-off-by: Adam C. Emerson --- src/rgw/rgw_common.cc | 9 ++------- src/rgw/rgw_common.h | 9 ++++++++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 8f8791528f3..cb9040d64ab 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -34,11 +34,6 @@ #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); diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 63854015c87..c615008e271 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -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