]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Removed unnecessary inclusion of iostream 4707/head
authorMichal Jarzabek <stiopa@gmail.com>
Mon, 11 May 2015 16:46:12 +0000 (17:46 +0100)
committerMichal Jarzabek <stiopa@gmail.com>
Tue, 9 Jun 2015 06:26:56 +0000 (07:26 +0100)
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 <stiopa@gmail.com>
29 files changed:
src/common/ConfUtils.cc
src/common/Formatter.h
src/common/buffer.cc
src/common/ceph_context.h
src/common/ceph_json.h
src/crush/CrushWrapper.h
src/erasure-code/ErasureCode.cc
src/erasure-code/ErasureCodeInterface.h
src/global/global_context.h
src/include/Context.h
src/include/buffer.h
src/include/filepath.h
src/include/object.h
src/include/rangeset.h
src/librbd/WatchNotifyTypes.h
src/mds/CDir.h
src/mds/CInode.h
src/msg/xio/XioPool.h
src/rgw/rgw_acl.h
src/rgw/rgw_acl_s3.cc
src/rgw/rgw_acl_s3.h
src/rgw/rgw_acl_swift.h
src/rgw/rgw_cors.h
src/rgw/rgw_cors_s3.h
src/rgw/rgw_cors_swift.h
src/rgw/rgw_xml.h
src/test/Makefile-client.am
src/test/librados/test.cc
src/test/osd/Object.cc

index 5efde8d4ae005231dd4d6e75975295ef2834d685..1ae5df54088955a7b4bb604d698905f6d17d1bc9 100644 (file)
@@ -24,6 +24,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <iostream>
 
 #include "include/buffer.h"
 #include "common/errno.h"
index c61138dac36720e38239def8488feb9ea3b2e7d7..3ce5996ce22bab7c19ecc1df9aab2b8a62d9c27a 100644 (file)
@@ -6,10 +6,9 @@
 #include "include/int_types.h"
 
 #include <deque>
-#include <iostream>
+#include <iosfwd>
 #include <list>
 #include <vector>
-#include <ostream>
 #include <sstream>
 #include <stdarg.h>
 #include <string>
index 258880b011d45e63fbd0174e080057b7029e90d0..7b3d89406cbe0fe19fa1c5a4db5a53d25d08d9db 100644 (file)
@@ -34,6 +34,7 @@
 #include <sys/uio.h>
 #include <limits.h>
 
+#include <ostream>
 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<buffer::ptr>::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();
+}
 
 }
index 47aceb0f88e550fba93eb72c9f955ccd340b35d8..cf2334206958fb855feeec47942b5b5baf8198e2 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef CEPH_CEPHCONTEXT_H
 #define CEPH_CEPHCONTEXT_H
 
-#include <iostream>
+#include <iosfwd>
 #include <stdint.h>
 #include <string>
 #include <set>
index 604230a59e66a1b912e05478c40cd1d9d319a80a..4bc0b9a863a7cdf3dc93dc99dcfe62b95973b7a8 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef CEPH_JSON_H
 #define CEPH_JSON_H
 
-#include <iostream>
+#include <iosfwd>
 #include <include/types.h>
 #include <list>
 
index 31a1f4b9c72c69a57856d76b188ee4546fc15239..315e543ffccdc0869bc753e81946e7cf8d7e6c71 100644 (file)
@@ -9,7 +9,7 @@
 #include <set>
 #include <string>
 
-#include <iostream> //for testing, remove
+#include <iosfwd>
 
 #include "include/types.h"
 
index e7a10aec4675b2ab40cf1859474a4849bd485d89..d8d54907eb2ec3fa55b0f2ea5353d3e4b3cff7fc 100644 (file)
@@ -18,6 +18,7 @@
 #include <errno.h>
 #include <vector>
 #include <algorithm>
+#include <ostream>
 
 #include "common/strtol.h"
 #include "ErasureCode.h"
index 9e04348cd297db79c3c19e487a14774faa73dd6b..5eb55714120d8bd0e4f47ec5531c3dc2c3a862f4 100644 (file)
 #include <map>
 #include <set>
 #include <vector>
+#include <iostream>
 #include "include/memory.h"
 #include "include/buffer.h"
 
index 6586b5ca7944998b0f8c7b021d35127271504593..bf59c7840fac89d0f93700284f404c09cd94d626 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "common/ceph_context.h"
 
-#include <iostream>
 #include <stdint.h>
 
 struct md_config_t;
index 01214f637550c0a5f769df6fbd055ad5fb9b3abe..16c7c43e2920dbc0272d52d373a5227e6fd4484a 100644 (file)
@@ -22,7 +22,6 @@
 #include <list>
 #include <set>
 
-#include <iostream>
 #include "include/assert.h"
 #include "include/memory.h"
 
index 9af95ae9a06b6f99c9686b56a5acccc044317b4b..4a17a07be0dafc1c3657e6eff8ba2eab11ad093b 100644 (file)
@@ -36,8 +36,7 @@
 # include <sys/mman.h>
 #endif
 
-#include <iostream>
-#include <istream>
+#include <iosfwd>
 #include <iomanip>
 #include <list>
 #include <string>
@@ -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<buffer::ptr>::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
index 6d2128b22aeb1994a9801127d4e9f30e1a76f6aa..f7318470011e7757b4bafdd09ca9a825cd8581e8 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 
-#include <iostream>
+#include <iosfwd>
 #include <string>
 #include <vector>
 using namespace std;
index b2a4e85b7c83c80e1a9133253cdf48525e95847f..57f099a57b6d525481dbf644c3ee1ca0bdf2fc44 100644 (file)
@@ -18,7 +18,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
-#include <iostream>
+#include <iosfwd>
 #include <iomanip>
 using namespace std;
 
index 9eb0b709b0a8d71cfeb7c651281ceb2b278a16b3..547af26e2b6654f3c9e71c0f280cd22c191631bf 100644 (file)
@@ -23,7 +23,6 @@
  */
 
 #include <map>
-#include <iostream>
 using namespace std;
 
 //typedef int T;
index 1e9d089e5f1d75eb3658fb7a4fe8bb3df3f9cec5..1ded0bacd3773d2e82509f23706c1b14251d2b11 100644 (file)
@@ -6,7 +6,7 @@
 #include "include/int_types.h"
 #include "include/buffer.h"
 #include "include/encoding.h"
-#include <iostream>
+#include <iosfwd>
 #include <list>
 #include <string>
 #include <boost/variant.hpp>
index e36d134adcb250dd87d1780cd832ab4e0f4703e9..9deabccb4c0afe4cc84ea1c99abb3773cf372de6 100644 (file)
@@ -23,7 +23,7 @@
 #include "common/config.h"
 #include "common/DecayCounter.h"
 
-#include <iostream>
+#include <iosfwd>
 
 #include <list>
 #include <set>
index 321ef0bc8ac1b926ea800f5b19a4534567823cf6..e63bce8208c05e776e9ebb1299d685c7c813c038 100644 (file)
@@ -36,7 +36,6 @@
 #include <list>
 #include <set>
 #include <map>
-//#include <iostream>
 
 class Context;
 class CDentry;
index 9e124d3b569b616e932028add46c1f49c9c9ed29..2df24b07195a1b4d2e55678ccaef516f390ce95f 100644 (file)
@@ -20,7 +20,6 @@ extern "C" {
 #include <stdint.h>
 #include "libxio.h"
 }
-#include <iostream>
 #include <vector>
 #include "include/atomic.h"
 #include "common/likely.h"
index 2de62e768dcb29a4ee3bf6779d7b33901553bb1d..cb9bedf5446259f2d3cc7a6395b15e5df41a3121 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <map>
 #include <string>
-#include <iostream>
 #include <include/types.h>
 
 #include "common/debug.h"
index 785324c99872a727c2681e4f35e5fd13c750fef2..f0ed08118dfaa66e2d3dca4efa2dec77c5feee85 100644 (file)
@@ -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 << "<Owner>" << "<ID>" << id << "</ID>";
+  if (!display_name.empty())
+    out << "<DisplayName>" << display_name << "</DisplayName>";
+  out << "</Owner>";
+}
+
 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<string, ACLGrant>::iterator iter;
+  out << "<AccessControlList>";
+  for (iter = grant_map.begin(); iter != grant_map.end(); ++iter) {
+    ACLGrant_S3& grant = static_cast<ACLGrant_S3 &>(iter->second);
+    grant.to_xml(cct, out);
+  }
+  out << "</AccessControlList>";
+}
+
 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 << "<AccessControlPolicy xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">";
+  ACLOwner_S3& _owner = static_cast<ACLOwner_S3 &>(owner);
+  RGWAccessControlList_S3& _acl = static_cast<RGWAccessControlList_S3 &>(acl);
+  _owner.to_xml(out);
+  _acl.to_xml(out);
+  out << "</AccessControlPolicy>";
+}
+
 static const s3_acl_header acl_header_perms[] = {
   {RGW_PERM_READ, "HTTP_X_AMZ_GRANT_READ"},
   {RGW_PERM_WRITE, "HTTP_X_AMZ_GRANT_WRITE"},
index 13a11c1676865032cc92d8033a4b4cccb13e0e50..694cc1d4a0701b92e3bd3bc4d873a98a658309f6 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <map>
 #include <string>
-#include <iostream>
+#include <iosfwd>
 #include <include/types.h>
 
 #include <expat.h>
@@ -61,15 +61,7 @@ public:
   ~RGWAccessControlList_S3() {}
 
   bool xml_end(const char *el);
-  void to_xml(ostream& out) {
-    multimap<string, ACLGrant>::iterator iter;
-    out << "<AccessControlList>";
-    for (iter = grant_map.begin(); iter != grant_map.end(); ++iter) {
-      ACLGrant_S3& grant = static_cast<ACLGrant_S3 &>(iter->second);
-      grant.to_xml(cct, out);
-    }
-    out << "</AccessControlList>";
-  }
+  void to_xml(ostream& out);
 
   int create_canned(ACLOwner& owner, ACLOwner& bucket_owner, const string& canned_acl);
   int create_from_grants(std::list<ACLGrant>& grants);
@@ -82,14 +74,7 @@ public:
   ~ACLOwner_S3() {}
 
   bool xml_end(const char *el);
-  void to_xml(ostream& out) {
-    if (id.empty())
-      return;
-    out << "<Owner>" << "<ID>" << id << "</ID>";
-    if (!display_name.empty())
-      out << "<DisplayName>" << display_name << "</DisplayName>";
-    out << "</Owner>";
-  }
+  void to_xml(ostream& out);
 };
 
 class RGWEnv;
@@ -102,14 +87,7 @@ public:
 
   bool xml_end(const char *el);
 
-  void to_xml(ostream& out) {
-    out << "<AccessControlPolicy xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">";
-    ACLOwner_S3& _owner = static_cast<ACLOwner_S3 &>(owner);
-    RGWAccessControlList_S3& _acl = static_cast<RGWAccessControlList_S3 &>(acl);
-    _owner.to_xml(out);
-    _acl.to_xml(out);
-    out << "</AccessControlPolicy>";
-  }
+  void to_xml(ostream& out);
   int rebuild(RGWRados *store, ACLOwner *owner, RGWAccessControlPolicy& dest);
   bool compare_group_name(string& id, ACLGroupTypeEnum group);
 
index b26a39ece7187dfff13eeb7a3e74967bcae3a12e..9a5fbf736e0afebe075aa617bd89128a32f19e97 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <map>
 #include <string>
-#include <iostream>
 #include <vector>
 #include <include/types.h>
 
index 124ebf92a7f23dfafcfda4fa076784068dbdda43..239cfd7332f7e5ca9dd9c6e47f531c1dde6b9bd8 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <map>
 #include <string>
-#include <iostream>
 #include <include/types.h>
 
 #define RGW_CORS_GET    0x1
index 0db03c3ea1420cd65b941e01fcde5b7b291b99dc..3a9616006959e7d58c7c375850eb507096fca652 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <map>
 #include <string>
-#include <iostream>
+#include <iosfwd>
 #include <expat.h>
 
 #include <include/types.h>
index 8037b4f51129fdd0d29c32f5846771396c17963c..6aef5e1356136ca51efbddfc943f93c3e8154491 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <map>
 #include <string>
-#include <iostream>
 #include <vector>
 #include <include/types.h>
 #include <include/str_list.h>
index 164e97a70dc52762f5128082674799af0ac6e90e..c4722abfd8f077e8b231d0d3b70858f1b9b52a4b 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <map>
 #include <string>
-#include <iostream>
+#include <iosfwd>
 #include <include/types.h>
 
 #include <expat.h>
index c3aaacc460c4b0e92c123df9f7b7976142d57467..c56f89240dbf3f6131c12adb8043ea9cb7ae3ffd 100644 (file)
@@ -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
 
index f8a92a2ffad330f119133d7cb416ea07dbc4247e..acf12276ac1c9221945b45f573d15f86867c9159 100644 (file)
@@ -10,6 +10,7 @@
 #include <string>
 #include <time.h>
 #include <unistd.h>
+#include <iostream>
 
 using namespace librados;
 
index c5ff040eaf07310577f40dcb229fe12ada35af7f..37d09c3cf5669e0938b28876ace256d70108a2b3 100644 (file)
@@ -4,6 +4,7 @@
 #include <list>
 #include <map>
 #include <set>
+#include <iostream>
 
 #include "Object.h"