//};
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)
(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());
{
filename = "";
if (g_conf.use_abspaths) {
- char *cwd = get_current_dir_name();
+ char cwd[200];
+ getcwd(cwd, 200);
filename = cwd;
- free(cwd);
filename += "/";
}
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>
break;
default:
BUG_ON(1);
+ item = in->items[0];
}
/* desired type? */
<< bytes << " bytes"
<< dendl;
#else
+# ifdef BLKGETSIZE
// hrm, try the 32 bit ioctl?
unsigned long sectors = 0;
r = ioctl(fd, BLKGETSIZE, §ors);
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!
// 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);
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();
#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>
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
// 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());
}
};
+#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
+
+
//}
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;
}
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;
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;
// 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);
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) ||
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);
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;
}
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;
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) {
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;
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
+#include <unistd.h>
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;
}
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;
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;
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;
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;
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());
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;
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;
/***** 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; }
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);