From da749d633607786f16dc4c0c5d59d840cf47f314 Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Sat, 8 Sep 2018 02:06:47 +0900 Subject: [PATCH] common,rgw: rename sha1_digest_t rename existing sha1_digest_t to sha1_digest_array_t and add a new sha1_digest_t Signed-off-by: Myoungwon Oh --- src/common/buffer.cc | 4 ++-- src/include/buffer.h | 4 ++-- src/include/types.h | 8 ++++---- src/osd/PrimaryLogPG.cc | 2 +- src/rgw/rgw_common.h | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 60359223afb..10b88152822 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -2467,7 +2467,7 @@ void buffer::list::invalidate_crc() #include "common/ceph_crypto.h" using ceph::crypto::SHA1; -boost::optional buffer::list::sha1() +boost::optional buffer::list::sha1() { ptr nb; unsigned pos = 0; @@ -2486,7 +2486,7 @@ boost::optional buffer::list::sha1() SHA1 sha1_gen; sha1_gen.Update((const unsigned char *)nb.c_str(), size); sha1_gen.Final(fingerprint); - sha1_digest_info_t fp_t(fingerprint); + sha1_digest_t fp_t(fingerprint); return fp_t; } diff --git a/src/include/buffer.h b/src/include/buffer.h index 9af7e7869a7..a69fb65eacd 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -82,7 +82,7 @@ class packet; } #endif // HAVE_SEASTAR class deleter; -struct sha1_digest_info_t; +struct sha1_digest_t; namespace ceph { @@ -956,7 +956,7 @@ namespace buffer CEPH_BUFFER_API { } uint32_t crc32c(uint32_t crc) const; void invalidate_crc(); - boost::optional sha1(); + boost::optional sha1(); // These functions return a bufferlist with a pointer to a single // static buffer. They /must/ not outlive the memory they diff --git a/src/include/types.h b/src/include/types.h index 4bf8e0182c3..73123bc9733 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -541,7 +541,7 @@ WRITE_CLASS_ENCODER(errorcode32_t) WRITE_EQ_OPERATORS_1(errorcode32_t, code) WRITE_CMP_OPERATORS_1(errorcode32_t, code) -struct sha1_digest_info_t { +struct sha1_digest_t { #define SHA1_DIGEST_SIZE 20 unsigned char v[SHA1_DIGEST_SIZE] = {0}; @@ -553,13 +553,13 @@ struct sha1_digest_info_t { } return string(str); } - sha1_digest_info_t(unsigned char *_v) { + sha1_digest_t(unsigned char *_v) { memcpy(v, _v, 20); }; - sha1_digest_info_t() {} + sha1_digest_t() {} }; -inline ostream& operator<<(ostream& out, const sha1_digest_info_t& b) +inline ostream& operator<<(ostream& out, const sha1_digest_t& b) { string str = b.to_str(); return out << str; diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index f4012fb0c3c..ba0efb0d876 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -2619,7 +2619,7 @@ int PrimaryLogPG::do_manifest_flush(OpRequestRef op, ObjectContextRef obc, Flush switch (fp_algo_t) { case pg_pool_t::TYPE_FINGERPRINT_SHA1: { - boost::optional fp_t = chunk_data.sha1(); + boost::optional fp_t = chunk_data.sha1(); object_t fp_oid; bufferlist in; if (fp_t != boost::none) { diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index f3a0ed928d0..97a1cbf87f7 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -2319,12 +2319,12 @@ extern std::string url_encode(const std::string& src, bool encode_slash = true); extern void calc_hmac_sha1(const char *key, int key_len, const char *msg, int msg_len, char *dest); -using sha1_digest_t = \ +using sha1_digest_array_t = \ std::array; -static inline sha1_digest_t +static inline sha1_digest_array_t calc_hmac_sha1(const boost::string_view& key, const boost::string_view& msg) { - sha1_digest_t dest; + sha1_digest_array_t dest; calc_hmac_sha1(key.data(), key.size(), msg.data(), msg.size(), dest.data()); return dest; }