]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "moved to use boost uuid implementation, based on commit 4fe89a7b14c97b2ed7f35... 10913/head
authorSage Weil <sage@redhat.com>
Mon, 29 Aug 2016 19:29:29 +0000 (15:29 -0400)
committerSage Weil <sage@redhat.com>
Mon, 29 Aug 2016 19:29:29 +0000 (15:29 -0400)
This reverts commit 174de7fce8080df6e02b363e7821e8cca6f8157f.

21 files changed:
CMakeLists.txt
ceph.spec.in
configure.ac
debian/control
src/Makefile-env.am
src/ceph_osd.cc
src/include/uuid.h
src/messages/MCommand.h
src/messages/MGetPoolStats.h
src/messages/MGetPoolStatsReply.h
src/messages/MLog.h
src/messages/MLogAck.h
src/messages/MMDSBeacon.h
src/messages/MMDSMap.h
src/messages/MStatfsReply.h
src/os/FileJournal.h
src/os/FileStore.cc
src/os/KeyValueStore.cc
src/test/CMakeLists.txt
src/test/Makefile-client.am
src/test/osd/TestOSDMap.cc

index 08b1f1593214b60a9be99d54a2de40e79932248b..dec1d626edb7bddfa1a143a1590ba328c9d32c39 100644 (file)
@@ -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)
 
index b1c83c63436df1bdd555154e5bf2987213bc6696..befd911482dce0ecf139ae2598c07be5213a6386 100644 (file)
@@ -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
index ff2c35b2bd46ff8917bbd15a957c02af68a46773..b09d432ed572b871674dd7c8b73755cb9a553802 100644 (file)
@@ -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
index c16db0f550ddbdc0be1eae743fec49a187d339d5..2289ca304519057b8966a20a67e624fc4d423106 100644 (file)
@@ -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},
index c28a355d1f32add332647f6c80f499c461637123..8a00954c0331d6134875a5b4c5dccd7718296c9e 100644 (file)
@@ -120,7 +120,7 @@ AM_CCASFLAGS = -f elf64
 #####################
 ## library definitions and dependencies
 
-EXTRALIBS = -lm
+EXTRALIBS = -luuid -lm
 if FREEBSD
 EXTRALIBS += -lexecinfo
 endif # FREEBSD
index 73fa937d6395aba3dbec5fda3204a5a957d9c2c6..18bc46c8689210118a6bf371c41f576bef4e7df1 100644 (file)
@@ -15,6 +15,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <uuid/uuid.h>
 #include <boost/scoped_ptr.hpp>
 
 #include <iostream>
index df9e71a466224ca31d6060817322f6a7d4a653b1..942b80709226254d5e3ec90e525c57c7c76b5203 100644 (file)
@@ -8,48 +8,36 @@
 #include "encoding.h"
 #include <ostream>
 
-#include <boost/uuid/uuid.hpp>
-#include <boost/uuid/uuid_generators.hpp>
-#include <boost/uuid/uuid_io.hpp>
+extern "C" {
+#include <uuid/uuid.h>
+#include <unistd.h>
+}
 
 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;
 }
 
 
index d5f0b22f02472f7f2c9076614653876576a77615..802ef6942f5987e08c7a1c68a3fac8e04bd89cdf 100644 (file)
@@ -16,6 +16,7 @@
 #define CEPH_MCOMMAND_H
 
 #include <vector>
+#include <uuid/uuid.h>
 
 #include "msg/Message.h"
 
index b66a5b850d6bc0b2b09c2357ebab4ef199263495..d004e2968aadcf32c9946834b1962ee696af6c2e 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef CEPH_MGETPOOLSTATS_H
 #define CEPH_MGETPOOLSTATS_H
 
+#include <uuid/uuid.h>
+
 #include "messages/PaxosServiceMessage.h"
 
 class MGetPoolStats : public PaxosServiceMessage {
index 9dc2cbe17597ca6df86588562d82a3ae609fc528..07b99cffd17b749a59a0404888a066cb33154be0 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef CEPH_MGETPOOLSTATSREPLY_H
 #define CEPH_MGETPOOLSTATSREPLY_H
 
+#include <uuid/uuid.h>
+
 class MGetPoolStatsReply : public PaxosServiceMessage {
 public:
   uuid_d fsid;
index 8b64e07e6fc2da9783752ee50147f388967ca505..c71f56bdab451f462937280fa4b0bf0ce16396b2 100644 (file)
@@ -19,6 +19,7 @@
 #include "messages/PaxosServiceMessage.h"
 
 #include <deque>
+#include <uuid/uuid.h>
 
 class MLog : public PaxosServiceMessage {
 public:
index 414008c3e501a5f36aff6d88e2e16ee72b7f3c6e..713cee003a20f8091d65accae942c59c5d6390f0 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef CEPH_MLOGACK_H
 #define CEPH_MLOGACK_H
 
+#include <uuid/uuid.h>
+
 class MLogAck : public Message {
 public:
   uuid_d fsid;
index 60ce7d4e2e7ad9fc7a2e1dc11a0f0864ece1cc29..48d5d04e561146537d464437ea36b686a6c00eb9 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "mds/MDSMap.h"
 
+#include <uuid/uuid.h>
+
 
 
 /**
index 36b9e958144da2ecd6bf8597683ef64acf03da5c..66566d01d31322461ae66b151457995eb504ca0e 100644 (file)
@@ -20,6 +20,8 @@
 #include "mds/MDSMap.h"
 #include "include/ceph_features.h"
 
+#include <uuid/uuid.h>
+
 class MMDSMap : public Message {
  public:
   /*
index 59312abe700fe80c1af34656ee0bee94a5f492a4..6bf42d894d73a5d160f9a58d1ee67c70afb8a3d1 100644 (file)
@@ -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;
   }
index 8077e29f9bbd9c790e5059540fd9b2a39443a28c..9e07b4046d97dc958b07becdeb572d5ae400e2aa 100644 (file)
@@ -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);
index 2a41d7402fc26c57546d3a2de44b3ba74cc64452..c7f9bea31a9e3303bc43d4c276952f574bc578a1 100644 (file)
@@ -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;
   }
 
index 95346e410ffe84a9b8d3044364923f2ba3b38133..1881f2dcc17ac43ad9c6a91d60416d4a1190d581 100644 (file)
@@ -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;
   }
 
index 315df9eadcb8b9aca2f7d6219b80691b87ec4740..73e80840949e0109f70ac061ea45776cb3fc9ee5 100644 (file)
@@ -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}
index 094c1c32def1fd30c6a8eb226b76409733ec2200..d5b506bb7c48a47e72dc8f785eaa22059ea15e81 100644 (file)
@@ -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
index ea4053f3f7891be01784dcb7631271706590ab61..d4b05ac16e14a931c298ba4ed879ddefe65d9df8 100644 (file)
@@ -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;