]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
various cruft to build under cygwin
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 1 Nov 2007 23:57:00 +0000 (23:57 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 1 Nov 2007 23:57:00 +0000 (23:57 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@2011 29311d96-e01e-0410-9327-a35deaab8ce9

20 files changed:
trunk/ceph/client/Client.cc
trunk/ceph/client/SyntheticClient.cc
trunk/ceph/common/Logger.cc
trunk/ceph/crush/crush.h
trunk/ceph/crush/mapper.c
trunk/ceph/ebofs/BlockDevice.cc
trunk/ceph/fakefuse.cc
trunk/ceph/include/ceph_fs.h
trunk/ceph/include/frag.h
trunk/ceph/include/hash.h
trunk/ceph/mds/MDCache.cc
trunk/ceph/mds/MDSMap.h
trunk/ceph/mon/MDSMonitor.cc
trunk/ceph/mon/Monitor.cc
trunk/ceph/mon/MonitorStore.cc
trunk/ceph/mon/OSDMonitor.cc
trunk/ceph/mon/PGMonitor.cc
trunk/ceph/osd/OSD.cc
trunk/ceph/osd/OSDMap.h
trunk/ceph/osdc/Objecter.cc

index 5ffbf890f42e98a5b15fe65957641670573cb0fb..3a62d3118d84d840b805984f906270b1c590a6ff 100644 (file)
@@ -2230,13 +2230,15 @@ void Client::_readdir_add_dirent(DirResult *dirp, const string& name, Inode *in)
 //};
 void Client::_readdir_fill_dirent(struct dirent *de, DirEntry *entry, off_t off)
 {
+  strncpy(de->d_name, entry->d_name.c_str(), 256);
+#ifndef __CYGWIN__
   de->d_ino = entry->st.st_ino;
   de->d_off = off + 1;
   de->d_reclen = 1;
   de->d_type = MODE_TO_DT(entry->st.st_mode);
-  strncpy(de->d_name, entry->d_name.c_str(), 256);
   dout(10) << "_readdir_fill_dirent '" << de->d_name << "' -> " << de->d_ino
           << " type " << (int)de->d_type << " at off " << off << dendl;
+#endif
 }
 
 void Client::_readdir_next_frag(DirResult *dirp)
index 1695631b8b8cb8035128da8f4b0f582d69bf105f..c44ab65a995a1082f865bb05a7096cb97bbc0a10 100644 (file)
@@ -1423,7 +1423,7 @@ int SyntheticClient::full_walk(string& basedir)
             (st.st_mode & 02) ? 'w':'-',
             (st.st_mode & 01) ? 'x':'-',
             (int)st.st_nlink,
-            st.st_uid, st.st_gid,
+            (int)st.st_uid, (int)st.st_gid,
             (int)st.st_size,
             tm,
             file.c_str());
index 2e7db26027a57037081aa9eaf31945a99361f51b..b271d4a363adc5057a2d764c79b0b6e6082733cb 100644 (file)
@@ -112,9 +112,9 @@ Logger::Logger(string fn, LogType *type, bool append)
   {
     filename = "";
     if (g_conf.use_abspaths) {
-      char *cwd = get_current_dir_name(); 
+      char cwd[200];
+      getcwd(cwd, 200);
       filename = cwd;
-      free(cwd);
       filename += "/";
     }
 
index 5cf6cff498f131d3f60cacf1d0d18e6e2813e9c2..48eeede4a161f3f4b353fda0f3275d5d1a3d3662 100644 (file)
@@ -5,7 +5,13 @@
 extern "C" {
 #endif
 
-#include <linux/types.h>  /* just for int types */
+#ifdef __CYGWIN__
+# include <asm/types.h>
+# include <inttypes.h>
+typedef uint64_t __u64;
+#else 
+# include <linux/types.h>  /* just for int types */
+#endif
 
 #ifndef BUG_ON
 # include <assert.h>
index e0a71f85631fff0e6178d0752daf97263c7de5e0..36341a272a656311007cec00e44a33a5b28d75f9 100644 (file)
@@ -190,6 +190,7 @@ static int crush_choose(struct crush_map *map,
                                        break;
                                default:
                                        BUG_ON(1);
+                                       item = in->items[0];
                                }
                                
                                /* desired type? */
index 94c108db2612c9cd9e80b5c0d6ce765f2d72df09..6fd899000063513240a877925e8170fa82334d48 100644 (file)
@@ -281,6 +281,7 @@ block_t BlockDevice::get_num_blocks()
               << bytes << " bytes" 
               << dendl;
 #else
+# ifdef BLKGETSIZE
     // hrm, try the 32 bit ioctl?
     unsigned long sectors = 0;
     r = ioctl(fd, BLKGETSIZE, &sectors);
@@ -289,6 +290,12 @@ block_t BlockDevice::get_num_blocks()
     if (r == 0) {
       dout(10) << "get_num_blocks ioctl BLKGETSIZE reports " << sectors << " sectors, "
               << num_blocks << " 4k blocks, " << bytes << " bytes" << dendl;
+# else
+    // probably CYGWIN or similar lame plaform...
+    unsigned long sectors = 0;
+    r = sectors;  // shut up compiler
+    if (0) {
+# endif
 #endif
     } else {
       // hmm, try stat!
index 3a778e1b64e392571a43f3fb7ecf08fade079961..4f058bd17fc29d471c19789eae5dd39ed49ad432 100644 (file)
@@ -131,7 +131,8 @@ int main(int argc, char **argv) {
     // use my argc, argv (make sure you pass a mount point!)
     client[i]->mount();
 
-    char *oldcwd = get_current_dir_name();  // note previous wd
+    char oldcwd[200];
+    getcwd(oldcwd, 200);
     cout << "starting fuse on pid " << getpid() << std::endl;
     if (g_conf.fuse_ll)
       ceph_fuse_ll_main(client[i], argc, argv);
@@ -139,7 +140,6 @@ int main(int argc, char **argv) {
       ceph_fuse_main(client[i], argc, argv);
     cout << "fuse finished on pid " << getpid() << std::endl;
     ::chdir(oldcwd);                        // return to previous wd
-    free(oldcwd);
 
     client[i]->unmount();
     client[i]->shutdown();
index 7be2afdd8e3a250826074da223a26d0884e7fdc0..d8f93816109f9f8b067620684fc6a35d0bc57123 100644 (file)
@@ -6,7 +6,12 @@
 #ifndef _FS_CEPH_CEPH_FS_H
 #define _FS_CEPH_CEPH_FS_H
 
-#include <linux/types.h>
+#ifdef __CYGWIN__
+# include <asm/types.h>
+typedef uint64_t __u64;
+#else
+# include <linux/types.h>
+#endif
 #include <netinet/in.h>
 
 
index eac9d5bfa9e36579104b1f5000e9d4b676139b92..e84ba208d6fff24cf0480568acc9e3cda98f476b 100644 (file)
@@ -180,7 +180,7 @@ class fragtree_t {
     return _splits.empty();
   }
   int get_split(const frag_t hb) const {
-    std::map<frag_t,__int32_t>::const_iterator p = _splits.find(hb);
+    std::map<frag_t,int32_t>::const_iterator p = _splits.find(hb);
     if (p == _splits.end())
       return 0;
     else
@@ -440,7 +440,7 @@ class fragtree_t {
 
   // verify that we describe a legal partition of the namespace.
   void verify() const {
-    std::map<frag_t,__int32_t> copy;
+    std::map<frag_t,int32_t> copy;
     std::list<frag_t> q;
     q.push_back(frag_t());
     
index 0c27d3535174fd67329c010b1bf92346c5b80693..fcd4fa556c251c2bf290679a0658b2d93c39c004 100644 (file)
@@ -63,6 +63,19 @@ template<> struct rjhash<uint64_t> {
   }
 };
   
+#ifdef __CYGWIN__
+template<> struct rjhash<size_t> {
+  inline size_t operator()(const size_t x) const {
+#ifdef __LP64__
+    return rjhash64(x);
+#else
+    return rjhash32(x);
+#endif
+  }
+};
+#endif
+
+
 //}
 
 
index 1fc19c2f5787436ed7938946a92774e9afdaf130..3417302cc9eb498b440dd75ec8f0d2f2b6bd9be5 100644 (file)
@@ -6248,7 +6248,7 @@ void MDCache::dump_cache()
   if (g_conf.debug_mds < 2) return;
 
   char fn[20];
-  sprintf(fn, "cachedump.%d.mds%d", mds->mdsmap->get_epoch(), mds->get_nodeid());
+  sprintf(fn, "cachedump.%d.mds%d", (int)mds->mdsmap->get_epoch(), mds->get_nodeid());
 
   dout(1) << "dump_cache to " << fn << dendl;
 
index 9a4371609c7ebeac1d44f52402aa786881e3526c..f93a3bbb6ff2792de6d7434a2736eafde57e22a6 100644 (file)
@@ -153,7 +153,7 @@ class MDSMap {
   }
   int get_num_mds(int state) {
     int n = 0;
-    for (map<int,int>::const_iterator p = mds_state.begin();
+    for (map<int32_t,int32_t>::const_iterator p = mds_state.begin();
         p != mds_state.end();
         p++)
       if (p->second == state) ++n;
@@ -162,7 +162,7 @@ class MDSMap {
 
   int get_num_in_mds() { 
     int n = 0;
-    for (map<int,int>::const_iterator p = mds_state.begin();
+    for (map<int32_t,int32_t>::const_iterator p = mds_state.begin();
         p != mds_state.end();
         p++)
       if (p->second > 0) ++n;
@@ -171,26 +171,26 @@ class MDSMap {
 
   // sets
   void get_mds_set(set<int>& s) {
-    for (map<int,int>::const_iterator p = mds_state.begin();
+    for (map<int32_t,int32_t>::const_iterator p = mds_state.begin();
         p != mds_state.end();
         p++)
       s.insert(p->first);
   }
   void get_mds_set(set<int>& s, int state) {
-    for (map<int,int>::const_iterator p = mds_state.begin();
+    for (map<int32_t,int32_t>::const_iterator p = mds_state.begin();
         p != mds_state.end();
         p++)
       if (p->second == state)
        s.insert(p->first);
   } 
   void get_up_mds_set(set<int>& s) {
-    for (map<int,int>::const_iterator p = mds_state.begin();
+    for (map<int32_t,int32_t>::const_iterator p = mds_state.begin();
         p != mds_state.end();
         p++)
       if (is_up(p->first)) s.insert(p->first);
   }
   void get_in_mds_set(set<int>& s) {
-    for (map<int,int>::const_iterator p = mds_state.begin();
+    for (map<int32_t,int32_t>::const_iterator p = mds_state.begin();
         p != mds_state.end();
         p++)
       if (is_in(p->first)) s.insert(p->first);
@@ -202,7 +202,7 @@ class MDSMap {
     get_mds_set(s, MDSMap::STATE_FAILED);
   }
   void get_recovery_mds_set(set<int>& s) {
-    for (map<int,int>::const_iterator p = mds_state.begin();
+    for (map<int32_t,int32_t>::const_iterator p = mds_state.begin();
         p != mds_state.end();
         p++)
       if (is_failed(p->first) || 
@@ -212,7 +212,7 @@ class MDSMap {
 
   int get_random_in_mds() {
     vector<int> v;
-    for (map<int,int>::const_iterator p = mds_state.begin();
+    for (map<int32_t,int32_t>::const_iterator p = mds_state.begin();
         p != mds_state.end();
         p++)
       if (p->second > 0) v.push_back(p->first);
@@ -277,7 +277,7 @@ class MDSMap {
 
   bool would_be_overfull_with(int mds) {
     int in = 1;  // mds!
-    for (map<int,int>::const_iterator p = mds_state.begin();
+    for (map<int32_t,int32_t>::const_iterator p = mds_state.begin();
         p != mds_state.end();
         p++) {
       if (p->first == mds) continue;
@@ -313,7 +313,7 @@ class MDSMap {
   }
   
   int get_addr_rank(const entity_addr_t& addr) {
-    for (map<int,entity_inst_t>::iterator p = mds_inst.begin();
+    for (map<int32_t,entity_inst_t>::iterator p = mds_inst.begin();
         p != mds_inst.end();
         ++p) {
       if (p->second.addr == addr) return p->first;
index 3b415232b8f148363c87f17cf8630a53bcf200b3..6c4c5fb1bd637e869e70fab8c499a45adaa86ff2 100644 (file)
@@ -634,7 +634,7 @@ void MDSMonitor::do_stop()
   dout(7) << "do_stop stopping active mds nodes" << dendl;
   print_map(mdsmap);
 
-  for (map<int,int>::iterator p = mdsmap.mds_state.begin();
+  for (map<int32_t,int32_t>::iterator p = mdsmap.mds_state.begin();
        p != mdsmap.mds_state.end();
        ++p) {
     switch (p->second) {
index 1db23b0270e577cf72ccedff26dde4c81d41129c..e690d68d94ef74be6ad65a8fedb70feeb1bf5906 100644 (file)
@@ -103,7 +103,7 @@ void Monitor::shutdown()
   
   if (is_leader()) {
     // stop osds.
-    for (set<int>::iterator it = osdmon->osdmap.get_osds().begin();
+    for (set<int32_t>::iterator it = osdmon->osdmap.get_osds().begin();
         it != osdmon->osdmap.get_osds().end();
         it++) {
       if (osdmon->osdmap.is_down(*it)) continue;
index 86df22bcd6590a1f016556b955f86bc15b96c561..015f1d60ca7919988dbbfd777f4de75d6211000d 100644 (file)
@@ -25,6 +25,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 
 void MonitorStore::mount()
 {
@@ -40,9 +41,9 @@ void MonitorStore::mount()
   if (g_conf.use_abspaths) {
     // combine it with the cwd, in case fuse screws things up (i.e. fakefuse)
     string old = dir;
-    char *cwd = get_current_dir_name();
+    char cwd[200];
+    getcwd(cwd, 200);
     dir = cwd;
-    free(cwd);
     dir += "/";
     dir += old;
   }
index 8c8fb91b2b18c4e86f881ab02b56bd547d5c14dd..71558f9ac2d5295dea00a296278558139307406e 100644 (file)
@@ -337,26 +337,26 @@ void OSDMonitor::encode_pending(bufferlist &bl)
   pending_inc.mon_epoch = mon->mon_epoch;
   
   // tell me about it
-  for (map<int,pair<entity_inst_t,bool> >::iterator i = pending_inc.new_down.begin();
+  for (map<int32_t,pair<entity_inst_t,bool> >::iterator i = pending_inc.new_down.begin();
        i != pending_inc.new_down.end();
        i++) {
     dout(2) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << dendl;
     derr(0) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << dendl;
     mon->messenger->mark_down(i->second.first.addr);
   }
-  for (map<int,entity_inst_t>::iterator i = pending_inc.new_up.begin();
+  for (map<int32_t,entity_inst_t>::iterator i = pending_inc.new_up.begin();
        i != pending_inc.new_up.end(); 
        i++) { 
     dout(2) << " osd" << i->first << " UP " << i->second << dendl;
     derr(0) << " osd" << i->first << " UP " << i->second << dendl;
   }
-  for (list<int>::iterator i = pending_inc.new_out.begin();
+  for (list<int32_t>::iterator i = pending_inc.new_out.begin();
        i != pending_inc.new_out.end();
        i++) {
     dout(2) << " osd" << *i << " OUT" << dendl;
     derr(0) << " osd" << *i << " OUT" << dendl;
   }
-  for (list<int>::iterator i = pending_inc.new_in.begin();
+  for (list<int32_t>::iterator i = pending_inc.new_in.begin();
        i != pending_inc.new_in.end();
        i++) {
     dout(2) << " osd" << *i << " IN" << dendl;
@@ -700,9 +700,9 @@ void OSDMonitor::bcast_latest_osd()
   dout(1) << "bcast_latest_osd epoch " << e << dendl;
 
   // tell osds
-  set<int> osds;
+  set<int32_t> osds;
   osdmap.get_all_osds(osds);
-  for (set<int>::iterator it = osds.begin();
+  for (set<int32_t>::iterator it = osds.begin();
        it != osds.end();
        it++) {
     if (osdmap.is_down(*it)) continue;
@@ -717,9 +717,9 @@ void OSDMonitor::bcast_full_osd()
   dout(1) << "bcast_full_osd epoch " << e << dendl;
 
   // tell osds
-  set<int> osds;
+  set<int32_t> osds;
   osdmap.get_all_osds(osds);
-  for (set<int>::iterator it = osds.begin();
+  for (set<int32_t>::iterator it = osds.begin();
        it != osds.end();
        it++) {
     if (osdmap.is_down(*it)) continue;
@@ -789,7 +789,7 @@ void OSDMonitor::mark_all_down()
 
   dout(7) << "mark_all_down" << dendl;
 
-  for (set<int>::iterator it = osdmap.get_osds().begin();
+  for (set<int32_t>::iterator it = osdmap.get_osds().begin();
        it != osdmap.get_osds().end();
        it++) {
     if (osdmap.is_down(*it)) continue;
index 6e571fea7f612dbd2370fa971bd2ebf4698300bc..ca8eea6b46a5bb485fe30375db9a078da0b092b7 100644 (file)
@@ -175,7 +175,11 @@ void PGMonitor::handle_statfs(MStatfs *statfs)
   reply->stfs.f_ffree   = 1024 * 1024;
   reply->stfs.f_favail  = 1024 * 1024;
   reply->stfs.f_namemax = 1024;
+#ifdef __CYGWIN__
+  reply->stfs.f_flag = 0;
+#else
   reply->stfs.f_flag = ST_NOATIME|ST_NODIRATIME;  // for now.
+#endif
 
   // reply
   mon->messenger->send_message(reply, statfs->get_source_inst());
index ab57f0c603302ade5e302675a340ebc0021a8b0e..58edaddc2dd2b62a2a9e45ca619881aa2de39f5d 100644 (file)
@@ -1190,7 +1190,7 @@ void OSD::handle_osd_map(MOSDMap *m)
       t.write( get_osdmap_object_name(cur+1), 0, bl.length(), bl);
 
       // notify messenger
-      for (map<int,pair<entity_inst_t,bool> >::iterator i = inc.new_down.begin();
+      for (map<int32_t,pair<entity_inst_t,bool> >::iterator i = inc.new_down.begin();
            i != inc.new_down.end();
            i++) {
         int osd = i->first;
@@ -1209,7 +1209,7 @@ void OSD::handle_osd_map(MOSDMap *m)
          pg->unlock();
         }
       }
-      for (map<int,entity_inst_t>::iterator i = inc.new_up.begin();
+      for (map<int32_t,entity_inst_t>::iterator i = inc.new_up.begin();
            i != inc.new_up.end();
            i++) {
         if (i->first == whoami) continue;
index 2b476e04561686e0f785e1b2c103bbd0bfbdaa73..87b3477960fe60f3baa2cf47834e9c1f5cd5ba8f 100644 (file)
@@ -175,7 +175,7 @@ private:
 
   /***** cluster state *****/
   int num_osds() { return osds.size(); }
-  void get_all_osds(set<int>& ls) { ls = osds; }
+  void get_all_osds(set<int32_t>& ls) { ls = osds; }
 
   const set<int32_t>& get_osds() { return osds; }
   const map<int32_t,bool>& get_down_osds() { return down_osds; }
index 84563b0af97205f441295ae537ae76b5928b06dc..cd39bb2395da364c826f151cec8bfc83f4361ca0 100644 (file)
@@ -94,7 +94,7 @@ void Objecter::handle_osd_map(MOSDMap *m)
         osdmap->apply_incremental(inc);
     
         // notify messenger
-        for (map<int,pair<entity_inst_t,bool> >::iterator i = inc.new_down.begin();
+        for (map<int32_t,pair<entity_inst_t,bool> >::iterator i = inc.new_down.begin();
              i != inc.new_down.end();
              i++) 
           messenger->mark_down(i->second.first.addr);