Browse Source

slight refactoring

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

49
src/mergerfs.cpp

@ -71,12 +71,12 @@
#include "write.hpp"
#include "write_buf.hpp"
namespace local
{
static
struct fuse_operations
get_fuse_operations()
void
get_fuse_operations(struct fuse_operations &ops)
{
struct fuse_operations ops = {0};
#if FLAG_NOPATH
ops.flag_nopath = false;
#endif
@ -135,23 +135,38 @@ get_fuse_operations()
ops.write_buf = mergerfs::write_buf::write_buf;
#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
{
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,
args.argv,
@ -162,15 +177,11 @@ namespace mergerfs
int
main(int argc,
char *argv[])
char **argv)
{
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;
}
Loading…
Cancel
Save