#include <sys/stat.h>
#include <fcntl.h>
-int main(int argc, char **argv, char *envp[]) {
+int main(int argc, const char **argv, const char *envp[]) {
//cerr << "cfuse starting " << myrank << "/" << world << std::endl;
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
parse_config_options(args);
list<int> syn_iargs;
list<string> syn_sargs;
-void parse_syn_options(vector<char*>& args)
+void parse_syn_options(vector<const char*>& args)
{
- vector<char*> nargs;
+ vector<const char*> nargs;
for (unsigned i=0; i<args.size(); i++) {
if (strcmp(args[i],"--syn") == 0) {
-void parse_syn_options(vector<char*>& args);
+void parse_syn_options(vector<const char*>& args);
class SyntheticClient {
Client *client;
filepath sub;
char sub_s[50];
- const char *make_sub(char *base) {
+ const char *make_sub(const char *base) {
sprintf(sub_s, "%s.%d", base, rand() % 100);
string f = sub_s;
sub = cwd;
};
-int ceph_fuse_main(Client *c, int argc, char *argv[])
+int ceph_fuse_main(Client *c, int argc, const char *argv[])
{
// init client
client = c;
// set up fuse argc/argv
int newargc = 0;
- char **newargv = (char **) malloc((argc + 10) * sizeof(char *));
+ const char **newargv = (const char **) malloc((argc + 10) * sizeof(char *));
newargv[newargc++] = argv[0];
// allow other (all!) users to see my file system
// go fuse go
cout << "ok, calling fuse_main" << std::endl;
- int r = fuse_main(newargc, newargv, &ceph_oper, 0);
+ int r = fuse_main(newargc, (char**)newargv, &ceph_oper, 0);
return r;
}
* we will put fuse in the foreground so that it
* won't fork and we can see stdout.
*/
-int ceph_fuse_main(Client *cl, int argc, char *argv[]);
+int ceph_fuse_main(Client *cl, int argc, const char *argv[]);
bmap: 0
};
-int ceph_fuse_ll_main(Client *c, int argc, char *argv[])
+int ceph_fuse_ll_main(Client *c, int argc, const char *argv[])
{
cout << "ceph_fuse_ll_main starting fuse on pid " << getpid() << std::endl;
// set up fuse argc/argv
int newargc = 0;
- char **newargv = (char **) malloc((argc + 10) * sizeof(char *));
+ const char **newargv = (const char **) malloc((argc + 10) * sizeof(char *));
newargv[newargc++] = argv[0];
newargv[newargc++] = "-f"; // stay in foreground
for (int argctr = 1; argctr < argc; argctr++) newargv[newargc++] = argv[argctr];
// go go gadget fuse
- struct fuse_args args = FUSE_ARGS_INIT(newargc, newargv);
+ struct fuse_args args = FUSE_ARGS_INIT(newargc, (char**)newargv);
struct fuse_chan *ch;
char *mountpoint;
int err = -1;
*
*/
-int ceph_fuse_ll_main(Client *c, int argc, char *argv[]);
+int ceph_fuse_ll_main(Client *c, int argc, const char *argv[]);
};
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
parse_config_options(args);
};
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
parse_config_options(args);
// args
int whoami = -1;
- char *monmap_fn = ".ceph_monmap";
+ const char *monmap_fn = ".ceph_monmap";
for (unsigned i=0; i<args.size(); i++) {
if (strcmp(args[i], "--mon") == 0)
whoami = atoi(args[++i]);
}
} dispatcher;
-int main(int argc, char **argv, char *envp[]) {
+int main(int argc, const char **argv, const char *envp[]) {
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
parse_config_options(args);
#include <string.h>
-void env_to_vec(std::vector<char*>& args)
+void env_to_vec(std::vector<const char*>& args)
{
const char *p = getenv("CEPH_ARGS");
if (!p) return;
}
-void argv_to_vec(int argc, char **argv,
- std::vector<char*>& args)
+void argv_to_vec(int argc, const char **argv,
+ std::vector<const char*>& args)
{
for (int i=1; i<argc; i++)
args.push_back(argv[i]);
}
-void vec_to_argv(std::vector<char*>& args,
- int& argc, char **&argv)
+void vec_to_argv(std::vector<const char*>& args,
+ int& argc, const char **&argv)
{
- argv = (char**)malloc(sizeof(char*) * argc);
+ argv = (const char**)malloc(sizeof(char*) * argc);
argc = 1;
argv[0] = "asdf";
-void parse_config_options(std::vector<char*>& args)
+void parse_config_options(std::vector<const char*>& args)
{
- std::vector<char*> nargs;
+ std::vector<const char*> nargs;
for (unsigned i=0; i<args.size(); i++) {
if (strcmp(args[i],"--bind") == 0)
// profiling
bool log;
int log_interval;
- char *log_name;
+ const char *log_name;
bool log_messages;
bool log_pins;
bool logger_calc_variance;
- char *dout_dir;
+ const char *dout_dir;
bool fake_clock;
bool fakemessenger_serialize;
bool tcp_multi_dispatch;
*/
- char *ms_hosts;
+ const char *ms_hosts;
bool ms_tcp_nodelay;
double ms_retry_interval;
double ms_fail_interval;
size_t client_bcache_align;
*/
- char *client_trace;
+ const char *client_trace;
int fuse_direct_io;
bool fuse_ll;
int fakestore_syncthreads; // such crap
bool fakestore_fake_attrs;
bool fakestore_fake_collections;
- char *fakestore_dev;
-
+ const char *fakestore_dev;
+
// ebofs
int ebofs;
bool ebofs_cloneable;
/**
* command line / environment argument parsing
*/
-void env_to_vec(std::vector<char*>& args);
-void argv_to_vec(int argc, char **argv,
- std::vector<char*>& args);
-void vec_to_argv(std::vector<char*>& args,
- int& argc, char **&argv);
+void env_to_vec(std::vector<const char*>& args);
+void argv_to_vec(int argc, const char **argv,
+ std::vector<const char*>& args);
+void vec_to_argv(std::vector<const char*>& args,
+ int& argc, const char **&argv);
-void parse_config_options(std::vector<char*>& args);
+void parse_config_options(std::vector<const char*>& args);
extern bool parse_ip_port(const char *s, entity_addr_t& addr);
};
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
parse_config_options(args);
if (g_conf.clock_tare) g_clock.tare();
// osd specific args
- char *dev = 0;
+ const char *dev = 0;
char dev_default[20];
int whoami = -1;
for (unsigned i=0; i<args.size(); i++) {
#include "client/SyntheticClient.h"
#include "client/Client.h"
-#include "client/fuse.h"
#include "msg/SimpleMessenger.h"
#include <sys/stat.h>
#include <fcntl.h>
-int main(int argc, char **argv, char *envp[]) {
+int main(int argc, const char **argv, char *envp[]) {
- //cerr << "cfuse starting " << myrank << "/" << world << std::endl;
- vector<char*> args;
+ //cerr << "csyn starting" << std::endl;
+ vector<const 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);
if (g_conf.clock_tare) g_clock.tare();
exit(0);
}
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
parse_config_options(args);
callback *cb;
Cond *cond;
int rval;
- char *note;
+ const char *note;
bool done;
Queue *in_queue;
- biovec(char t, block_t s, block_t l, bufferlist& b, callback *c, char *n=0) :
+ biovec(char t, block_t s, block_t l, bufferlist& b, callback *c, const char *n=0) :
type(t), start(s), length(l), bl(b), cb(c), cond(0), rval(0), note(n), done(false), in_queue(0) {}
- biovec(char t, block_t s, block_t l, bufferlist& b, Cond *c, char *n=0) :
+ biovec(char t, block_t s, block_t l, bufferlist& b, Cond *c, const char *n=0) :
type(t), start(s), length(l), bl(b), cb(0), cond(c), rval(0), note(n), done(false), in_queue(0) {}
};
friend ostream& operator<<(ostream& out, biovec &bio);
// ** blocking interface **
// read
- int read(block_t bno, unsigned num, bufferptr& bptr, char *n=0) {
+ int read(block_t bno, unsigned num, bufferptr& bptr, const char *n=0) {
bufferlist bl;
bl.push_back(bptr);
return read(bno, num, bl, n);
}
- int read(block_t bno, unsigned num, bufferlist& bl, char *n=0) {
+ int read(block_t bno, unsigned num, bufferlist& bl, const char *n=0) {
Cond c;
biovec bio(biovec::IO_READ, bno, num, bl, &c, n);
}
// write
- int write(unsigned bno, unsigned num, bufferptr& bptr, char *n=0) {
+ int write(unsigned bno, unsigned num, bufferptr& bptr, const char *n=0) {
bufferlist bl;
bl.push_back(bptr);
return write(bno, num, bl, n);
}
- int write(unsigned bno, unsigned num, bufferlist& bl, char *n=0) {
+ int write(unsigned bno, unsigned num, bufferlist& bl, const char *n=0) {
Cond c;
biovec bio(biovec::IO_WRITE, bno, num, bl, &c, n);
}
// ** non-blocking interface **
- ioh_t read(block_t bno, unsigned num, bufferlist& bl, callback *fin, char *n=0) {
+ ioh_t read(block_t bno, unsigned num, bufferlist& bl, callback *fin, const char *n=0) {
biovec *pbio = new biovec(biovec::IO_READ, bno, num, bl, fin, n);
lock.Lock();
_submit_io(pbio);
lock.Unlock();
return (ioh_t)pbio;
}
- ioh_t write(block_t bno, unsigned num, bufferlist& bl, callback *fin, char *n=0) {
+ ioh_t write(block_t bno, unsigned num, bufferlist& bl, callback *fin, const char *n=0) {
biovec *pbio = new biovec(biovec::IO_WRITE, bno, num, bl, fin, n);
lock.Lock();
_submit_io(pbio);
public:
- Ebofs(char *devfn, char *jfn=0) :
+ Ebofs(const char *devfn, char *jfn=0) :
fake_writes(false),
dev(devfn),
mounted(false), unmounting(false), dirty(false), readonly(false),
-int main(int argc, char **argv) {
+int main(int argc, const char **argv) {
cerr << "fakefuse starting" << std::endl;
// stop on our own (by default)
g_conf.mon_stop_on_last_unmount = true;
g_conf.mon_stop_with_last_mds = true;
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
parse_config_options(args);
//g_timer.add_event_after(5.0, new C_Test2);
//g_timer.add_event_after(10.0, new C_Test);
- vector<char*> nargs;
+ vector<const char*> nargs;
for (unsigned i=0; i<args.size(); i++) {
nargs.push_back(args[i]);
}
};
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
cerr << "fakesyn start" << std::endl;
//cerr << "inode_t " << sizeof(inode_t) << std::endl;
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
// stop on our own (by default)
parse_syn_options(args);
- vector<char*> nargs;
+ vector<const char*> nargs;
for (unsigned i=0; i<args.size(); i++) {
// unknown arg, pass it on.
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
MonMap monmap;
- char *outfn = ".ceph_monmap";
+ const char *outfn = ".ceph_monmap";
for (unsigned i=0; i<args.size(); i++) {
if (strcmp(args[i], "--out") == 0)
}
// read from/write to a file
- int write(char *fn) {
+ int write(const char *fn) {
// encode
bufferlist bl;
encode(bl);
return 0;
}
- int read(char *fn) {
+ int read(const char *fn) {
// read
bufferlist bl;
int fd = ::open(fn, O_RDONLY);
extern std::map<entity_name_t,float> g_fake_kill_after;
bool use_existing_monmap = false;
-char *monmap_fn = ".ceph_monmap";
+const char *monmap_fn = ".ceph_monmap";
/*
* start up NewMessenger via MPI.
*/
-pair<int,int> mpi_bootstrap_new(int& argc, char**& argv, MonMap *monmap)
+pair<int,int> mpi_bootstrap_new(int& argc, const char**& argv, MonMap *monmap)
{
- MPI_Init(&argc, &argv);
+ MPI_Init(&argc, (char***)&argv);
int mpi_world;
int mpi_rank;
};
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
- vector<char*> args;
+ vector<const char*> args;
argv_to_vec(argc, argv, args);
map<int,int> kill_osd_after;
int share_single_client = 0;
if (1) {
- vector<char*> nargs;
+ vector<const char*> nargs;
for (unsigned i=0; i<args.size(); i++) {
if (strcmp(args[i],"--kill_osd_after") == 0) {
int o = atoi(args[++i]);
g_timer.add_event_after(g_conf.tick, new C_Tick);
}
- vector<char*> nargs;
+ vector<const char*> nargs;
for (unsigned i=0; i<args.size(); i++) {
//cout << "a " << args[i] << std::endl;
// unknown arg, pass it on.
coll_t parse_coll(char *s);
public:
- FakeStore(char *base) :
+ FakeStore(const char *base) :
basedir(base),
unsync(0),
attrs(this), fake_attrs(false),
#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) *_dout << dbeginl << g_clock.now() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " "
#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) *_derr << dbeginl << g_clock.now() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " "
-char *osd_base_path = "./osddata";
-char *ebofs_base_path = "./dev";
+const char *osd_base_path = "./osddata";
+const char *ebofs_base_path = "./dev";
static const object_t SUPERBLOCK_OBJECT(0,0);
LogType osd_logtype;
-OSD::OSD(int id, Messenger *m, MonMap *mm, char *dev) :
+OSD::OSD(int id, Messenger *m, MonMap *mm, const char *dev) :
timer(osd_lock),
stat_oprate(5.0),
read_latency_calc(g_conf.osd_max_opq<1 ? 1:g_conf.osd_max_opq),
public:
- OSD(int id, Messenger *m, MonMap *mm, char *dev = 0);
+ OSD(int id, Messenger *m, MonMap *mm, const char *dev = 0);
~OSD();
// startup/shutdown