Browse Source

slight refactoring

pull/42/head
Antonio SJ Musumeci 10 years ago
parent
commit
031b87f674
  1. 51
      src/mergerfs.cpp

51
src/mergerfs.cpp

@ -71,12 +71,12 @@
#include "write.hpp" #include "write.hpp"
#include "write_buf.hpp" #include "write_buf.hpp"
static
struct fuse_operations
get_fuse_operations()
namespace local
{ {
struct fuse_operations ops = {0};
static
void
get_fuse_operations(struct fuse_operations &ops)
{
#if FLAG_NOPATH #if FLAG_NOPATH
ops.flag_nopath = false; ops.flag_nopath = false;
#endif #endif
@ -135,23 +135,38 @@ get_fuse_operations()
ops.write_buf = mergerfs::write_buf::write_buf; ops.write_buf = mergerfs::write_buf::write_buf;
#endif #endif
return ops;
return;
}
static
void
setup_resources(void)
{
std::srand(time(NULL));
mergerfs::resources::reset_umask();
mergerfs::resources::maxout_rlimit_nofile();
mergerfs::resources::maxout_rlimit_fsize();
}
} }
namespace mergerfs namespace mergerfs
{ {
int int
main(const struct fuse_args &args,
config::Config &config)
main(const int argc,
char **argv)
{ {
struct fuse_operations ops;
struct fuse_args args;
struct fuse_operations ops = {0};
mergerfs::config::Config config;
ops = get_fuse_operations();
args.argc = argc;
args.argv = argv;
args.allocated = 0;
std::srand(time(NULL));
resources::reset_umask();
resources::maxout_rlimit_nofile();
resources::maxout_rlimit_fsize();
mergerfs::options::parse(args,config);
local::setup_resources();
local::get_fuse_operations(ops);
return fuse_main(args.argc, return fuse_main(args.argc,
args.argv, args.argv,
@ -162,15 +177,11 @@ namespace mergerfs
int int
main(int argc, main(int argc,
char *argv[])
char **argv)
{ {
int rv; int rv;
mergerfs::config::Config config;
struct fuse_args args = FUSE_ARGS_INIT(argc,argv);
mergerfs::options::parse(args,config);
rv = mergerfs::main(args,config);
rv = mergerfs::main(argc,argv);
return rv; return rv;
} }
Loading…
Cancel
Save