]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libceph: SimpleMessenger usage bugfix, added testceph.cc, fixed dependencies
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 9 Jul 2009 21:04:06 +0000 (14:04 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 9 Jul 2009 21:04:06 +0000 (14:04 -0700)
src/Makefile.am
src/client/libceph.cc
src/client/libceph.h
src/client/testceph.cc [new file with mode: 0644]

index bf4a248def78f398d290a5986742f847d384dacc..c51e41b92836a389a039fbc1ca6536941f93f8c4 100644 (file)
@@ -49,7 +49,7 @@ bin_PROGRAMS = \
        ceph cconf \
        mkmonfs monmaptool osdmaptool crushtool \
        streamtest dupstore dumpjournal testmsgr \
-       testrados testradospp \
+       testceph testrados testradospp \
        rados radosacl s3gw
 
 sbin_PROGRAMS = \
@@ -97,13 +97,19 @@ lib_LTLIBRARIES =
 # libceph
 libceph_la_SOURCES = \
        client/libceph.cc \
+       client/Client.cc \
        msg/SimpleMessenger.cc \
-       ${libcommon_a_SOURCES}
+       ${libcommon_a_SOURCES} \
+       ${libcrush_a_SOURCES} \
+       ${libosdc_a_SOURCES}
+
 libceph_la_CFLAGS = ${AM_CFLAGS}
 libceph_la_CXXFLAGS= ${AM_CXXFLAGS}
 libceph_la_LDFLAGS = -version-info 1:0:0 -export-symbols-regex 'ceph_.*'
 lib_LTLIBRARIES += libceph.la
 
+testceph_SOURCES = client/testceph.cc
+testceph_LDADD = libceph.la
 # libcrush.so
 libcrush_la_SOURCES = \
        crush/builder.c \
index fdeab755e93b6f2a29170230d071c7319eb81f5e..a8ff9d6b44c4e6661721a638adf640660a70f721 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <string.h>
 #include <fcntl.h>
+#include <iostream>
 
 #include "common/Mutex.h"
 #include "messages/MMonMap.h"
@@ -37,13 +38,15 @@ extern "C" int ceph_initialize(int argc, const char **argv)
     //network connection
     rank = new SimpleMessenger();
     rank->bind();
+
+    //at last the client
+    client = new Client(rank->register_entity(entity_name_t::CLIENT()), monclient);
+
     rank->start();
     rank->set_policy(entity_name_t::TYPE_MON, SimpleMessenger::Policy::lossy_fast_fail());
     rank->set_policy(entity_name_t::TYPE_MDS, SimpleMessenger::Policy::lossless());
     rank->set_policy(entity_name_t::TYPE_OSD, SimpleMessenger::Policy::lossless());
 
-    //at last the client
-    client = new Client(rank->register_entity(entity_name_t::CLIENT()), monclient);
     client->init();
 
     ++client_initialized;
index 5c4d36025f1e5bbe51110c1b74bb460b5c02012c..d6094b5c0ed19fdd54c6b7c84b76cad80cad5c0a 100644 (file)
@@ -15,7 +15,7 @@
 extern "C" {
 #endif
 
-int ceph_initialize(int argc, const char **argv); // FIX_ME
+int ceph_initialize(int argc, const char **argv);
 void ceph_deinitialize();
 
 int ceph_mount();
diff --git a/src/client/testceph.cc b/src/client/testceph.cc
new file mode 100644 (file)
index 0000000..9de0bbf
--- /dev/null
@@ -0,0 +1,38 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software 
+ * Foundation.  See file COPYING.
+ * 
+ */
+
+#include "libceph.h"
+#include <iostream>
+
+using namespace std;
+
+int main(int argc, const char **argv)
+{
+  if (ceph_initialize(argc, argv) < 0) {
+    cerr << "error initializing\n" << endl;
+    return(1);
+  }
+  cout << "Successfully initialized Ceph!" << std::endl;
+
+  if(ceph_mount() < 0) {
+    cerr << "error mounting\n" << endl;
+    return(1);
+  }
+  cout << "Successfully mounted Ceph!" << std::endl;
+
+  ceph_deinitialize();
+  cout << "Successfully deinitialized Ceph!" << std::endl;
+
+  return 0;
+}