From: Sage Weil Date: Mon, 29 Aug 2016 19:29:29 +0000 (-0400) Subject: Revert "moved to use boost uuid implementation, based on commit 4fe89a7b14c97b2ed7f35... X-Git-Tag: v0.94.9~1^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=27d805589552b63a2a152335e4932f996e979d86;p=ceph.git Revert "moved to use boost uuid implementation, based on commit 4fe89a7b14c97b2ed7f357132901beb2bdcec551" This reverts commit 174de7fce8080df6e02b363e7821e8cca6f8157f. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 08b1f1593214..dec1d626edb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,7 @@ CHECK_INCLUDE_FILES("fcgios.h" FASTCGI_FASTCGIOS_DIR) CHECK_INCLUDE_FILES("fcgi_stdio.h" HAVE_FASTCGI_STDIO_H) CHECK_INCLUDE_FILES("openssl/ssl.h" HAVE_SSL_H) CHECK_INCLUDE_FILES("snappy.h" HAVE_SNAPPY_H) +CHECK_INCLUDE_FILES("uuid/uuid.h" HAVE_UUID_H) CHECK_INCLUDE_FILES("atomic_ops.h" HAVE_ATOMIC_OPS) CHECK_INCLUDE_FILES("keyutils.h" HAVE_KEYUTILS_H) diff --git a/ceph.spec.in b/ceph.spec.in index b1c83c63436d..befd911482dc 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -63,6 +63,7 @@ BuildRequires: libaio-devel BuildRequires: libcurl-devel BuildRequires: libedit-devel BuildRequires: libxml2-devel +BuildRequires: libuuid-devel BuildRequires: libblkid-devel >= 2.17 BuildRequires: libudev-devel BuildRequires: libtool diff --git a/configure.ac b/configure.ac index ff2c35b2bd46..b09d432ed572 100644 --- a/configure.ac +++ b/configure.ac @@ -256,6 +256,7 @@ AX_C_PRETTY_FUNC # Checks for libraries. ACX_PTHREAD +AC_CHECK_LIB([uuid], [uuid_parse], [true], AC_MSG_FAILURE([libuuid not found])) # rbd {map,unmap,showmapped} dependencies, Linux only if test x"$linux" = x"yes" -a x"$with_rbd" = x"yes"; then diff --git a/debian/control b/debian/control index c16db0f550dd..2289ca304519 100644 --- a/debian/control +++ b/debian/control @@ -50,6 +50,8 @@ Build-Depends: autoconf, python-virtualenv, sdparm | hdparm, sed, + uuid-dev, + uuid-runtime, xfslibs-dev, xfsprogs, xmlstarlet, @@ -69,6 +71,7 @@ Depends: binutils, python, python-argparse, sdparm | hdparm, + uuid-runtime, xfsprogs, python-flask, ${misc:Depends}, diff --git a/src/Makefile-env.am b/src/Makefile-env.am index c28a355d1f32..8a00954c0331 100644 --- a/src/Makefile-env.am +++ b/src/Makefile-env.am @@ -120,7 +120,7 @@ AM_CCASFLAGS = -f elf64 ##################### ## library definitions and dependencies -EXTRALIBS = -lm +EXTRALIBS = -luuid -lm if FREEBSD EXTRALIBS += -lexecinfo endif # FREEBSD diff --git a/src/ceph_osd.cc b/src/ceph_osd.cc index 73fa937d6395..18bc46c86892 100644 --- a/src/ceph_osd.cc +++ b/src/ceph_osd.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include #include diff --git a/src/include/uuid.h b/src/include/uuid.h index df9e71a46622..942b80709226 100644 --- a/src/include/uuid.h +++ b/src/include/uuid.h @@ -8,48 +8,36 @@ #include "encoding.h" #include -#include -#include -#include +extern "C" { +#include +#include +} struct uuid_d { - boost::uuids::uuid uuid; + uuid_t uuid; uuid_d() { - boost::uuids::nil_generator gen; - uuid = gen(); + memset(&uuid, 0, sizeof(uuid)); } bool is_zero() const { - return uuid.is_nil(); + return uuid_is_null(uuid); } void generate_random() { - boost::uuids::random_generator gen; - uuid = gen(); + uuid_generate(uuid); } bool parse(const char *s) { - try { - boost::uuids::string_generator gen; - uuid = gen(s); - return true; - } catch (std::runtime_error& e) { - return false; - } - } - void print(char *s) const { - memcpy(s, boost::uuids::to_string(uuid).c_str(), 37); + return uuid_parse(s, uuid) == 0; } - - char *bytes() const { - return (char*)uuid.data; + void print(char *s) { + return uuid_unparse(uuid, s); } void encode(bufferlist& bl) const { ::encode_raw(uuid, bl); } - void decode(bufferlist::iterator& p) const { ::decode_raw(uuid, p); } @@ -58,15 +46,15 @@ WRITE_CLASS_ENCODER(uuid_d) inline std::ostream& operator<<(std::ostream& out, const uuid_d& u) { char b[37]; - u.print(b); + uuid_unparse(u.uuid, b); return out << b; } inline bool operator==(const uuid_d& l, const uuid_d& r) { - return l.uuid == r.uuid; + return uuid_compare(l.uuid, r.uuid) == 0; } inline bool operator!=(const uuid_d& l, const uuid_d& r) { - return l.uuid != r.uuid; + return uuid_compare(l.uuid, r.uuid) != 0; } diff --git a/src/messages/MCommand.h b/src/messages/MCommand.h index d5f0b22f0247..802ef6942f59 100644 --- a/src/messages/MCommand.h +++ b/src/messages/MCommand.h @@ -16,6 +16,7 @@ #define CEPH_MCOMMAND_H #include +#include #include "msg/Message.h" diff --git a/src/messages/MGetPoolStats.h b/src/messages/MGetPoolStats.h index b66a5b850d6b..d004e2968aad 100644 --- a/src/messages/MGetPoolStats.h +++ b/src/messages/MGetPoolStats.h @@ -16,6 +16,8 @@ #ifndef CEPH_MGETPOOLSTATS_H #define CEPH_MGETPOOLSTATS_H +#include + #include "messages/PaxosServiceMessage.h" class MGetPoolStats : public PaxosServiceMessage { diff --git a/src/messages/MGetPoolStatsReply.h b/src/messages/MGetPoolStatsReply.h index 9dc2cbe17597..07b99cffd17b 100644 --- a/src/messages/MGetPoolStatsReply.h +++ b/src/messages/MGetPoolStatsReply.h @@ -16,6 +16,8 @@ #ifndef CEPH_MGETPOOLSTATSREPLY_H #define CEPH_MGETPOOLSTATSREPLY_H +#include + class MGetPoolStatsReply : public PaxosServiceMessage { public: uuid_d fsid; diff --git a/src/messages/MLog.h b/src/messages/MLog.h index 8b64e07e6fc2..c71f56bdab45 100644 --- a/src/messages/MLog.h +++ b/src/messages/MLog.h @@ -19,6 +19,7 @@ #include "messages/PaxosServiceMessage.h" #include +#include class MLog : public PaxosServiceMessage { public: diff --git a/src/messages/MLogAck.h b/src/messages/MLogAck.h index 414008c3e501..713cee003a20 100644 --- a/src/messages/MLogAck.h +++ b/src/messages/MLogAck.h @@ -15,6 +15,8 @@ #ifndef CEPH_MLOGACK_H #define CEPH_MLOGACK_H +#include + class MLogAck : public Message { public: uuid_d fsid; diff --git a/src/messages/MMDSBeacon.h b/src/messages/MMDSBeacon.h index 60ce7d4e2e7a..48d5d04e5611 100644 --- a/src/messages/MMDSBeacon.h +++ b/src/messages/MMDSBeacon.h @@ -21,6 +21,8 @@ #include "mds/MDSMap.h" +#include + /** diff --git a/src/messages/MMDSMap.h b/src/messages/MMDSMap.h index 36b9e958144d..66566d01d313 100644 --- a/src/messages/MMDSMap.h +++ b/src/messages/MMDSMap.h @@ -20,6 +20,8 @@ #include "mds/MDSMap.h" #include "include/ceph_features.h" +#include + class MMDSMap : public Message { public: /* diff --git a/src/messages/MStatfsReply.h b/src/messages/MStatfsReply.h index 59312abe700f..6bf42d894d73 100644 --- a/src/messages/MStatfsReply.h +++ b/src/messages/MStatfsReply.h @@ -22,7 +22,7 @@ public: MStatfsReply() : Message(CEPH_MSG_STATFS_REPLY) {} MStatfsReply(uuid_d &f, ceph_tid_t t, epoch_t epoch) : Message(CEPH_MSG_STATFS_REPLY) { - memcpy(&h.fsid, f.bytes(), sizeof(h.fsid)); + memcpy(&h.fsid, f.uuid, sizeof(h.fsid)); header.tid = t; h.version = epoch; } diff --git a/src/os/FileJournal.h b/src/os/FileJournal.h index 8077e29f9bbd..9e07b4046d97 100644 --- a/src/os/FileJournal.h +++ b/src/os/FileJournal.h @@ -135,7 +135,7 @@ public: } uint64_t get_fsid64() const { - return *(uint64_t*)fsid.bytes(); + return *(uint64_t*)&fsid.uuid[0]; } void encode(bufferlist& bl) const { @@ -163,8 +163,8 @@ public: flags = 0; uint64_t tfsid; ::decode(tfsid, bl); - *(uint64_t*)&fsid.bytes()[0] = tfsid; - *(uint64_t*)&fsid.bytes()[8] = tfsid; + *(uint64_t*)&fsid.uuid[0] = tfsid; + *(uint64_t*)&fsid.uuid[8] = tfsid; ::decode(block_size, bl); ::decode(alignment, bl); ::decode(max_size, bl); diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 2a41d7402fc2..c7f9bea31a9e 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -944,8 +944,8 @@ int FileStore::read_fsid(int fd, uuid_d *uuid) return ret; if (ret == 8) { // old 64-bit fsid... mirror it. - *(uint64_t*)&uuid->bytes()[0] = *(uint64_t*)fsid_str; - *(uint64_t*)&uuid->bytes()[8] = *(uint64_t*)fsid_str; + *(uint64_t*)&uuid->uuid[0] = *(uint64_t*)fsid_str; + *(uint64_t*)&uuid->uuid[8] = *(uint64_t*)fsid_str; return 0; } diff --git a/src/os/KeyValueStore.cc b/src/os/KeyValueStore.cc index 95346e410ffe..1881f2dcc17a 100644 --- a/src/os/KeyValueStore.cc +++ b/src/os/KeyValueStore.cc @@ -693,8 +693,8 @@ int KeyValueStore::read_fsid(int fd, uuid_d *uuid) return ret; if (ret == 8) { // old 64-bit fsid... mirror it. - *(uint64_t*)&uuid->bytes()[0] = *(uint64_t*)fsid_str; - *(uint64_t*)&uuid->bytes()[8] = *(uint64_t*)fsid_str; + *(uint64_t*)&uuid->uuid[0] = *(uint64_t*)fsid_str; + *(uint64_t*)&uuid->uuid[8] = *(uint64_t*)fsid_str; return 0; } diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 315df9eadcb8..73e80840949e 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -958,6 +958,7 @@ if(${WITH_RADOSGW}) rgw_a global curl + uuid expat ${CMAKE_DL_LIBS} ${TCMALLOC_LIBS} ${UNITTEST_LIBS}) set_target_properties(test_cors PROPERTIES COMPILE_FLAGS @@ -983,6 +984,7 @@ if(${WITH_RADOSGW}) librados global curl + uuid expat ${CMAKE_DL_LIBS} ${TCMALLOC_LIBS} @@ -1003,6 +1005,7 @@ if(${WITH_RADOSGW}) rgw_a global curl + uuid expat cls_version_client cls_log_client @@ -1029,6 +1032,7 @@ if(${WITH_RADOSGW}) rgw_a global curl + uuid expat cls_version_client cls_log_client @@ -1065,6 +1069,7 @@ if(${WITH_RADOSGW}) cls_lock_client global curl + uuid expat ${CMAKE_DL_LIBS} ${TCMALLOC_LIBS} diff --git a/src/test/Makefile-client.am b/src/test/Makefile-client.am index 094c1c32def1..d5b506bb7c48 100644 --- a/src/test/Makefile-client.am +++ b/src/test/Makefile-client.am @@ -175,7 +175,7 @@ bin_DEBUGPROGRAMS += ceph_test_cls_hello ceph_test_rados_api_cmd_SOURCES = test/librados/cmd.cc ceph_test_rados_api_cmd_LDADD = \ $(LIBCOMMON) $(LIBRADOS) $(CRYPTO_LIBS) \ - $(UNITTEST_LDADD) $(RADOS_TEST_LDADD) + $(UNITTEST_LDADD) $(RADOS_TEST_LDADD) -luuid ceph_test_rados_api_cmd_CXXFLAGS = $(UNITTEST_CXXFLAGS) bin_DEBUGPROGRAMS += ceph_test_rados_api_cmd @@ -342,7 +342,7 @@ if LINUX ceph_test_librbd_fsx_SOURCES = test/librbd/fsx.cc ceph_test_librbd_fsx_LDADD = \ $(LIBKRBD) $(LIBRBD) $(LIBRADOS) \ - $(CRYPTO_LIBS) $(PTHREAD_LIBS) + $(CRYPTO_LIBS) $(PTHREAD_LIBS) -luuid ceph_test_librbd_fsx_CXXFLAGS = $(UNITTEST_CXXFLAGS) bin_DEBUGPROGRAMS += ceph_test_librbd_fsx endif @@ -485,7 +485,7 @@ ceph_test_cors_SOURCES = test/test_cors.cc ceph_test_cors_LDADD = \ $(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \ $(UNITTEST_LDADD) \ - -lcurl -lexpat + -lcurl -luuid -lexpat ceph_test_cors_CXXFLAGS = $(UNITTEST_CXXFLAGS) bin_DEBUGPROGRAMS += ceph_test_cors @@ -493,7 +493,7 @@ ceph_test_rgw_manifest_SOURCES = test/rgw/test_rgw_manifest.cc ceph_test_rgw_manifest_LDADD = \ $(LIBRADOS) $(LIBRGW) $(LIBRGW_DEPS) $(CEPH_GLOBAL) \ $(UNITTEST_LDADD) $(CRYPTO_LIBS) \ - -lcurl -lexpat + -lcurl -luuid -lexpat ceph_test_rgw_manifest_CXXFLAGS = $(UNITTEST_CXXFLAGS) bin_DEBUGPROGRAMS += ceph_test_rgw_manifest @@ -502,7 +502,7 @@ ceph_test_cls_rgw_meta_SOURCES = test/test_rgw_admin_meta.cc ceph_test_cls_rgw_meta_LDADD = \ $(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \ $(UNITTEST_LDADD) $(CRYPTO_LIBS) \ - -lcurl -lexpat \ + -lcurl -luuid -lexpat \ libcls_version_client.a libcls_log_client.a \ libcls_statelog_client.a libcls_refcount_client.la \ libcls_rgw_client.la libcls_user_client.a libcls_lock_client.la @@ -513,7 +513,7 @@ ceph_test_cls_rgw_log_SOURCES = test/test_rgw_admin_log.cc ceph_test_cls_rgw_log_LDADD = \ $(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \ $(UNITTEST_LDADD) $(CRYPTO_LIBS) \ - -lcurl -lexpat \ + -lcurl -luuid -lexpat \ libcls_version_client.a libcls_log_client.a \ libcls_statelog_client.a libcls_refcount_client.la \ libcls_rgw_client.la libcls_user_client.a libcls_lock_client.la @@ -524,7 +524,7 @@ ceph_test_cls_rgw_opstate_SOURCES = test/test_rgw_admin_opstate.cc ceph_test_cls_rgw_opstate_LDADD = \ $(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \ $(UNITTEST_LDADD) $(CRYPTO_LIBS) \ - -lcurl -lexpat \ + -lcurl -luuid -lexpat \ libcls_version_client.a libcls_log_client.a \ libcls_statelog_client.a libcls_refcount_client.la \ libcls_rgw_client.la libcls_user_client.a libcls_lock_client.la diff --git a/src/test/osd/TestOSDMap.cc b/src/test/osd/TestOSDMap.cc index ea4053f3f789..d4b05ac16e14 100644 --- a/src/test/osd/TestOSDMap.cc +++ b/src/test/osd/TestOSDMap.cc @@ -38,7 +38,7 @@ public: entity_addr_t sample_addr; uuid_d sample_uuid; for (int i = 0; i < num_osds; ++i) { - sample_uuid.generate_random(); + sample_uuid.uuid[i] = i; sample_addr.nonce = i; pending_inc.new_state[i] = CEPH_OSD_EXISTS | CEPH_OSD_NEW; pending_inc.new_up_client[i] = sample_addr;