]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
merged trunk changes r1032:1037 into branches/sage/cephmds2 (csyn, Makefile tweaks)
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 25 Jan 2007 22:36:59 +0000 (22:36 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 25 Jan 2007 22:36:59 +0000 (22:36 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1038 29311d96-e01e-0410-9327-a35deaab8ce9

branches/sage/cephmds2/Makefile
branches/sage/cephmds2/csyn.cc [new file with mode: 0644]

index c35adbb514b9ce67939e6781b46176ae94582525..54ce406223b150b4612e04008ba5d4e15caa8078 100644 (file)
@@ -98,13 +98,16 @@ obfs: depend obfstest
 
 # real bits
 cmon: cmon.cc mon.o ebofs.o msg/SimpleMessenger.o common.o
-       ${CC} ${CFLAGS} ${MPILIBS} $^ -o $@
+       ${CC} ${CFLAGS} ${LIBS} $^ -o $@
 
 cosd: cosd.cc osd.o ebofs.o msg/SimpleMessenger.o common.o
-       ${CC} ${CFLAGS} ${MPILIBS} $^ -o $@
+       ${CC} ${CFLAGS} ${LIBS} $^ -o $@
 
 cmds: cmds.cc mds.o osdc.o msg/SimpleMessenger.o common.o
-       ${CC} ${CFLAGS} ${MPILIBS} $^ -o $@
+       ${CC} ${CFLAGS} ${LIBS} $^ -o $@
+
+csyn: csyn.cc client.o osdc.o msg/SimpleMessenger.o common.o
+       ${CC} ${CFLAGS} ${LIBS} $^ -o $@
 
 cfuse: cfuse.cc client.o osdc.o client/fuse.o msg/SimpleMessenger.o common.o
        ${CC} ${CFLAGS} ${LIBS} -lfuse $^ -o $@
diff --git a/branches/sage/cephmds2/csyn.cc b/branches/sage/cephmds2/csyn.cc
new file mode 100644 (file)
index 0000000..75da548
--- /dev/null
@@ -0,0 +1,93 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+/*
+ * 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 <sys/stat.h>
+#include <iostream>
+#include <string>
+using namespace std;
+
+#include "config.h"
+
+#include "client/SyntheticClient.h"
+#include "client/Client.h"
+#include "client/fuse.h"
+
+#include "msg/SimpleMessenger.h"
+
+#include "common/Timer.h"
+       
+#include <envz.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+int main(int argc, char **argv, char *envp[]) {
+
+  //cerr << "cfuse starting " << myrank << "/" << world << endl;
+  vector<char*> args;
+  argv_to_vec(argc, argv, args);
+  parse_config_options(args);
+  parse_syn_options(args);   // for SyntheticClient
+
+  // args for fuse
+  vec_to_argv(args, argc, argv);
+
+  // load monmap
+  bufferlist bl;
+  int fd = ::open(".ceph_monmap", O_RDONLY);
+  assert(fd >= 0);
+  struct stat st;
+  ::fstat(fd, &st);
+  bufferptr bp(st.st_size);
+  bl.append(bp);
+  ::read(fd, (void*)bl.c_str(), bl.length());
+  ::close(fd);
+  
+  MonMap *monmap = new MonMap;
+  monmap->decode(bl);
+
+  // start up network
+  rank.start_rank();
+
+  // start client
+  Client *client = new Client(rank.register_entity(MSG_ADDR_CLIENT_NEW), monmap);
+  client->init();
+    
+  // start syntheticclient
+  SyntheticClient *syn = new SyntheticClient(client);
+
+  // start up fuse
+  // use my argc, argv (make sure you pass a mount point!)
+  cout << "mounting" << endl;
+  client->mount();
+  
+  cout << "starting syn client" << endl;
+  syn->start_thread();
+
+  // wait
+  syn->join_thread();
+
+  // unmount
+  client->unmount();
+  cout << "unmounted" << endl;
+  client->shutdown();
+  
+  delete client;
+  
+  // wait for messenger to finish
+  rank.wait();
+  
+  return 0;
+}
+