mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-10 13:04:15 -04:00
Clean up FUSE driver
This commit is contained in:
parent
60d44d90e5
commit
35d27e8e24
@ -92,8 +92,8 @@ using native_off_t = ::off_t;
|
|||||||
namespace dwarfs {
|
namespace dwarfs {
|
||||||
|
|
||||||
struct options {
|
struct options {
|
||||||
char const* progname{nullptr};
|
std::filesystem::path progname;
|
||||||
std::string fsimage;
|
std::filesystem::path fsimage;
|
||||||
int seen_mountpoint{0};
|
int seen_mountpoint{0};
|
||||||
char const* cachesize_str{nullptr}; // TODO: const?? -> use string?
|
char const* cachesize_str{nullptr}; // TODO: const?? -> use string?
|
||||||
char const* debuglevel_str{nullptr}; // TODO: const?? -> use string?
|
char const* debuglevel_str{nullptr}; // TODO: const?? -> use string?
|
||||||
@ -934,14 +934,15 @@ int op_rename(char const* from, char const* to, unsigned int flags) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void usage(char const* progname) {
|
void usage(std::filesystem::path const& progname) {
|
||||||
std::cerr
|
std::cerr
|
||||||
<< tool_header("dwarfs",
|
<< tool_header("dwarfs",
|
||||||
fmt::format(", fuse version {}", FUSE_USE_VERSION))
|
fmt::format(", fuse version {}", FUSE_USE_VERSION))
|
||||||
#if !DWARFS_FUSE_LOWLEVEL
|
#if !DWARFS_FUSE_LOWLEVEL
|
||||||
<< "USING HIGH-LEVEL FUSE API\n\n"
|
<< "USING HIGH-LEVEL FUSE API\n\n"
|
||||||
#endif
|
#endif
|
||||||
<< "usage: " << progname << " image mountpoint [options]\n\n"
|
<< "usage: " << progname.filename().string()
|
||||||
|
<< " <image> <mountpoint> [options]\n\n"
|
||||||
<< "DWARFS options:\n"
|
<< "DWARFS options:\n"
|
||||||
<< " -o cachesize=SIZE set size of block cache (512M)\n"
|
<< " -o cachesize=SIZE set size of block cache (512M)\n"
|
||||||
<< " -o workers=NUM number of worker threads (2)\n"
|
<< " -o workers=NUM number of worker threads (2)\n"
|
||||||
@ -962,6 +963,7 @@ void usage(char const* progname) {
|
|||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
#if DWARFS_FUSE_LOWLEVEL && FUSE_USE_VERSION >= 30
|
#if DWARFS_FUSE_LOWLEVEL && FUSE_USE_VERSION >= 30
|
||||||
|
std::cerr << "FUSE options:\n";
|
||||||
fuse_cmdline_help();
|
fuse_cmdline_help();
|
||||||
#else
|
#else
|
||||||
struct fuse_args args = FUSE_ARGS_INIT(0, nullptr);
|
struct fuse_args args = FUSE_ARGS_INIT(0, nullptr);
|
||||||
@ -991,7 +993,7 @@ int option_hdl(void* data, char const* arg, int key,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
opts->fsimage = arg;
|
opts->fsimage = std::filesystem::canonical(std::filesystem::path(arg));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1206,7 +1208,7 @@ int dwarfs_main(int argc, char** argv) {
|
|||||||
dwarfs_userdata userdata(std::cerr);
|
dwarfs_userdata userdata(std::cerr);
|
||||||
auto& opts = userdata.opts;
|
auto& opts = userdata.opts;
|
||||||
|
|
||||||
opts.progname = argv[0];
|
opts.progname = std::filesystem::path(argv[0]);
|
||||||
opts.cache_image = 0;
|
opts.cache_image = 0;
|
||||||
opts.cache_files = 1;
|
opts.cache_files = 1;
|
||||||
|
|
||||||
@ -1244,8 +1246,6 @@ int dwarfs_main(int argc, char** argv) {
|
|||||||
try {
|
try {
|
||||||
// TODO: foreground mode, stderr vs. syslog?
|
// TODO: foreground mode, stderr vs. syslog?
|
||||||
|
|
||||||
opts.fsimage = std::filesystem::canonical(opts.fsimage).string();
|
|
||||||
|
|
||||||
if (opts.debuglevel_str) {
|
if (opts.debuglevel_str) {
|
||||||
opts.debuglevel = logger::parse_level(opts.debuglevel_str);
|
opts.debuglevel = logger::parse_level(opts.debuglevel_str);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user