From: Michal Jarzabek Date: Mon, 11 May 2015 16:46:12 +0000 (+0100) Subject: Removed unnecessary inclusion of iostream X-Git-Tag: v9.0.2~22^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F4707%2Fhead;p=ceph.git Removed unnecessary inclusion of iostream In several files the iostream wasn't being used, so it got removed. In other files the iostream inclusion was replaced by including iosfwd (for forward declarations), which is much smaller header than iostream, so in theory should reduce compilation time. To make this work some of the functions must have been moved from .h to .cc file. 3 functions also needed to have inline removed - this shouldn't affect performance in any way: two of them are probably too long to have been inlined anyway and the third one is for error reporting, so probably won't be called too often. test/Makefile-client.am: added linker libs This was required to avoid linker error when linking src/test/cls_rbd/test_cls_rbd.cc file. Makefile was specyfing libcommon.a as a part of a linker command even though this wasn't required and wasn't being linked against. When inline functions from buffer.h were moved to buffer.cc(and inline was removed) the libcommon.a library became necessary. This wouldn't link without also including additional libraries(CRYPTO_LIBS and EXTRA_LIBS) Signed-off-by: Michal Jarzabek --- diff --git a/src/common/ConfUtils.cc b/src/common/ConfUtils.cc index 5efde8d4ae0..1ae5df54088 100644 --- a/src/common/ConfUtils.cc +++ b/src/common/ConfUtils.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include "include/buffer.h" #include "common/errno.h" diff --git a/src/common/Formatter.h b/src/common/Formatter.h index c61138dac36..3ce5996ce22 100644 --- a/src/common/Formatter.h +++ b/src/common/Formatter.h @@ -6,10 +6,9 @@ #include "include/int_types.h" #include -#include +#include #include #include -#include #include #include #include diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 258880b011d..7b3d89406cb 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -34,6 +34,7 @@ #include #include +#include namespace ceph { #ifdef BUFFER_DEBUG @@ -1917,5 +1918,34 @@ std::ostream& operator<<(std::ostream& out, const buffer::raw &r) { return out << "buffer::raw(" << (void*)r.data << " len " << r.len << " nref " << r.nref.read() << ")"; } +std::ostream& operator<<(std::ostream& out, const buffer::ptr& bp) { + if (bp.have_raw()) + out << "buffer::ptr(" << bp.offset() << "~" << bp.length() + << " " << (void*)bp.c_str() + << " in raw " << (void*)bp.raw_c_str() + << " len " << bp.raw_length() + << " nref " << bp.raw_nref() << ")"; + else + out << "buffer:ptr(" << bp.offset() << "~" << bp.length() << " no raw)"; + return out; +} + +std::ostream& operator<<(std::ostream& out, const buffer::list& bl) { + out << "buffer::list(len=" << bl.length() << "," << std::endl; + + std::list::const_iterator it = bl.buffers().begin(); + while (it != bl.buffers().end()) { + out << "\t" << *it; + if (++it == bl.buffers().end()) break; + out << "," << std::endl; + } + out << std::endl << ")"; + return out; +} + +std::ostream& operator<<(std::ostream& out, buffer::error& e) +{ + return out << e.what(); +} } diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index 47aceb0f88e..cf233420695 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -15,7 +15,7 @@ #ifndef CEPH_CEPHCONTEXT_H #define CEPH_CEPHCONTEXT_H -#include +#include #include #include #include diff --git a/src/common/ceph_json.h b/src/common/ceph_json.h index 604230a59e6..4bc0b9a863a 100644 --- a/src/common/ceph_json.h +++ b/src/common/ceph_json.h @@ -1,7 +1,7 @@ #ifndef CEPH_JSON_H #define CEPH_JSON_H -#include +#include #include #include diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 31a1f4b9c72..315e543ffcc 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -9,7 +9,7 @@ #include #include -#include //for testing, remove +#include #include "include/types.h" diff --git a/src/erasure-code/ErasureCode.cc b/src/erasure-code/ErasureCode.cc index e7a10aec467..d8d54907eb2 100644 --- a/src/erasure-code/ErasureCode.cc +++ b/src/erasure-code/ErasureCode.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "common/strtol.h" #include "ErasureCode.h" diff --git a/src/erasure-code/ErasureCodeInterface.h b/src/erasure-code/ErasureCodeInterface.h index 9e04348cd29..5eb55714120 100644 --- a/src/erasure-code/ErasureCodeInterface.h +++ b/src/erasure-code/ErasureCodeInterface.h @@ -143,6 +143,7 @@ #include #include #include +#include #include "include/memory.h" #include "include/buffer.h" diff --git a/src/global/global_context.h b/src/global/global_context.h index 6586b5ca794..bf59c7840fa 100644 --- a/src/global/global_context.h +++ b/src/global/global_context.h @@ -17,7 +17,6 @@ #include "common/ceph_context.h" -#include #include struct md_config_t; diff --git a/src/include/Context.h b/src/include/Context.h index 01214f63755..16c7c43e292 100644 --- a/src/include/Context.h +++ b/src/include/Context.h @@ -22,7 +22,6 @@ #include #include -#include #include "include/assert.h" #include "include/memory.h" diff --git a/src/include/buffer.h b/src/include/buffer.h index 9af95ae9a06..4a17a07be0d 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -36,8 +36,7 @@ # include #endif -#include -#include +#include #include #include #include @@ -557,41 +556,18 @@ inline bool operator<=(bufferlist& l, bufferlist& r) { } -inline std::ostream& operator<<(std::ostream& out, const buffer::ptr& bp) { - if (bp.have_raw()) - out << "buffer::ptr(" << bp.offset() << "~" << bp.length() - << " " << (void*)bp.c_str() - << " in raw " << (void*)bp.raw_c_str() - << " len " << bp.raw_length() - << " nref " << bp.raw_nref() << ")"; - else - out << "buffer:ptr(" << bp.offset() << "~" << bp.length() << " no raw)"; - return out; -} +std::ostream& operator<<(std::ostream& out, const buffer::ptr& bp); -inline std::ostream& operator<<(std::ostream& out, const buffer::list& bl) { - out << "buffer::list(len=" << bl.length() << "," << std::endl; - std::list::const_iterator it = bl.buffers().begin(); - while (it != bl.buffers().end()) { - out << "\t" << *it; - if (++it == bl.buffers().end()) break; - out << "," << std::endl; - } - out << std::endl << ")"; - return out; -} +std::ostream& operator<<(std::ostream& out, const buffer::list& bl); -inline std::ostream& operator<<(std::ostream& out, buffer::error& e) -{ - return out << e.what(); -} + +std::ostream& operator<<(std::ostream& out, buffer::error& e); inline bufferhash& operator<<(bufferhash& l, bufferlist &r) { l.update(r); return l; } - } #endif diff --git a/src/include/filepath.h b/src/include/filepath.h index 6d2128b22ae..f7318470011 100644 --- a/src/include/filepath.h +++ b/src/include/filepath.h @@ -23,7 +23,7 @@ */ -#include +#include #include #include using namespace std; diff --git a/src/include/object.h b/src/include/object.h index b2a4e85b7c8..57f099a57b6 100644 --- a/src/include/object.h +++ b/src/include/object.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include using namespace std; diff --git a/src/include/rangeset.h b/src/include/rangeset.h index 9eb0b709b0a..547af26e2b6 100644 --- a/src/include/rangeset.h +++ b/src/include/rangeset.h @@ -23,7 +23,6 @@ */ #include -#include using namespace std; //typedef int T; diff --git a/src/librbd/WatchNotifyTypes.h b/src/librbd/WatchNotifyTypes.h index 1e9d089e5f1..1ded0bacd37 100644 --- a/src/librbd/WatchNotifyTypes.h +++ b/src/librbd/WatchNotifyTypes.h @@ -6,7 +6,7 @@ #include "include/int_types.h" #include "include/buffer.h" #include "include/encoding.h" -#include +#include #include #include #include diff --git a/src/mds/CDir.h b/src/mds/CDir.h index e36d134adcb..9deabccb4c0 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -23,7 +23,7 @@ #include "common/config.h" #include "common/DecayCounter.h" -#include +#include #include #include diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 321ef0bc8ac..e63bce8208c 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -36,7 +36,6 @@ #include #include #include -//#include class Context; class CDentry; diff --git a/src/msg/xio/XioPool.h b/src/msg/xio/XioPool.h index 9e124d3b569..2df24b07195 100644 --- a/src/msg/xio/XioPool.h +++ b/src/msg/xio/XioPool.h @@ -20,7 +20,6 @@ extern "C" { #include #include "libxio.h" } -#include #include #include "include/atomic.h" #include "common/likely.h" diff --git a/src/rgw/rgw_acl.h b/src/rgw/rgw_acl.h index 2de62e768dc..cb9bedf5446 100644 --- a/src/rgw/rgw_acl.h +++ b/src/rgw/rgw_acl.h @@ -6,7 +6,6 @@ #include #include -#include #include #include "common/debug.h" diff --git a/src/rgw/rgw_acl_s3.cc b/src/rgw/rgw_acl_s3.cc index 785324c9987..f0ed08118df 100644 --- a/src/rgw/rgw_acl_s3.cc +++ b/src/rgw/rgw_acl_s3.cc @@ -140,6 +140,15 @@ bool ACLOwner_S3::xml_end(const char *el) { return true; } +void ACLOwner_S3::to_xml(ostream& out) { + if (id.empty()) + return; + out << "" << "" << id << ""; + if (!display_name.empty()) + out << "" << display_name << ""; + out << ""; +} + bool ACLGrant_S3::xml_end(const char *el) { ACLGrantee_S3 *acl_grantee; ACLID_S3 *acl_id; @@ -257,6 +266,16 @@ bool RGWAccessControlList_S3::xml_end(const char *el) { return true; } +void RGWAccessControlList_S3::to_xml(ostream& out) { + multimap::iterator iter; + out << ""; + for (iter = grant_map.begin(); iter != grant_map.end(); ++iter) { + ACLGrant_S3& grant = static_cast(iter->second); + grant.to_xml(cct, out); + } + out << ""; +} + struct s3_acl_header { int rgw_perm; const char *http_header; @@ -412,6 +431,15 @@ bool RGWAccessControlPolicy_S3::xml_end(const char *el) { return true; } +void RGWAccessControlPolicy_S3::to_xml(ostream& out) { + out << ""; + ACLOwner_S3& _owner = static_cast(owner); + RGWAccessControlList_S3& _acl = static_cast(acl); + _owner.to_xml(out); + _acl.to_xml(out); + out << ""; +} + static const s3_acl_header acl_header_perms[] = { {RGW_PERM_READ, "HTTP_X_AMZ_GRANT_READ"}, {RGW_PERM_WRITE, "HTTP_X_AMZ_GRANT_WRITE"}, diff --git a/src/rgw/rgw_acl_s3.h b/src/rgw/rgw_acl_s3.h index 13a11c16768..694cc1d4a07 100644 --- a/src/rgw/rgw_acl_s3.h +++ b/src/rgw/rgw_acl_s3.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include @@ -61,15 +61,7 @@ public: ~RGWAccessControlList_S3() {} bool xml_end(const char *el); - void to_xml(ostream& out) { - multimap::iterator iter; - out << ""; - for (iter = grant_map.begin(); iter != grant_map.end(); ++iter) { - ACLGrant_S3& grant = static_cast(iter->second); - grant.to_xml(cct, out); - } - out << ""; - } + void to_xml(ostream& out); int create_canned(ACLOwner& owner, ACLOwner& bucket_owner, const string& canned_acl); int create_from_grants(std::list& grants); @@ -82,14 +74,7 @@ public: ~ACLOwner_S3() {} bool xml_end(const char *el); - void to_xml(ostream& out) { - if (id.empty()) - return; - out << "" << "" << id << ""; - if (!display_name.empty()) - out << "" << display_name << ""; - out << ""; - } + void to_xml(ostream& out); }; class RGWEnv; @@ -102,14 +87,7 @@ public: bool xml_end(const char *el); - void to_xml(ostream& out) { - out << ""; - ACLOwner_S3& _owner = static_cast(owner); - RGWAccessControlList_S3& _acl = static_cast(acl); - _owner.to_xml(out); - _acl.to_xml(out); - out << ""; - } + void to_xml(ostream& out); int rebuild(RGWRados *store, ACLOwner *owner, RGWAccessControlPolicy& dest); bool compare_group_name(string& id, ACLGroupTypeEnum group); diff --git a/src/rgw/rgw_acl_swift.h b/src/rgw/rgw_acl_swift.h index b26a39ece71..9a5fbf736e0 100644 --- a/src/rgw/rgw_acl_swift.h +++ b/src/rgw/rgw_acl_swift.h @@ -6,7 +6,6 @@ #include #include -#include #include #include diff --git a/src/rgw/rgw_cors.h b/src/rgw/rgw_cors.h index 124ebf92a7f..239cfd7332f 100644 --- a/src/rgw/rgw_cors.h +++ b/src/rgw/rgw_cors.h @@ -17,7 +17,6 @@ #include #include -#include #include #define RGW_CORS_GET 0x1 diff --git a/src/rgw/rgw_cors_s3.h b/src/rgw/rgw_cors_s3.h index 0db03c3ea14..3a961600695 100644 --- a/src/rgw/rgw_cors_s3.h +++ b/src/rgw/rgw_cors_s3.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include diff --git a/src/rgw/rgw_cors_swift.h b/src/rgw/rgw_cors_swift.h index 8037b4f5112..6aef5e13561 100644 --- a/src/rgw/rgw_cors_swift.h +++ b/src/rgw/rgw_cors_swift.h @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/src/rgw/rgw_xml.h b/src/rgw/rgw_xml.h index 164e97a70dc..c4722abfd8f 100644 --- a/src/rgw/rgw_xml.h +++ b/src/rgw/rgw_xml.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include diff --git a/src/test/Makefile-client.am b/src/test/Makefile-client.am index c3aaacc460c..c56f89240db 100644 --- a/src/test/Makefile-client.am +++ b/src/test/Makefile-client.am @@ -127,7 +127,8 @@ bin_DEBUGPROGRAMS += ceph_multi_stress_watch ceph_test_cls_rbd_SOURCES = test/cls_rbd/test_cls_rbd.cc ceph_test_cls_rbd_LDADD = \ $(LIBRADOS) libcls_rbd_client.la libcls_lock_client.la \ - $(LIBCOMMON) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD) + $(LIBCOMMON) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD) $(CRYPTO_LIBS) \ + $(EXTRALIBS) ceph_test_cls_rbd_CXXFLAGS = $(UNITTEST_CXXFLAGS) bin_DEBUGPROGRAMS += ceph_test_cls_rbd diff --git a/src/test/librados/test.cc b/src/test/librados/test.cc index f8a92a2ffad..acf12276ac1 100644 --- a/src/test/librados/test.cc +++ b/src/test/librados/test.cc @@ -10,6 +10,7 @@ #include #include #include +#include using namespace librados; diff --git a/src/test/osd/Object.cc b/src/test/osd/Object.cc index c5ff040eaf0..37d09c3cf56 100644 --- a/src/test/osd/Object.cc +++ b/src/test/osd/Object.cc @@ -4,6 +4,7 @@ #include #include #include +#include #include "Object.h"