I have a small utility which uses libfuse3
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
struct fuse_cmdline_opts fuse_cmdline_opts;
if (fuse_parse_cmdline(&args, &fuse_cmdline_opts) != -1) {
struct fuse_session *se;
se = fuse_session_new(&args, &httpfs_oper, sizeof(httpfs_oper), NULL);
if (se != NULL) {
if (fuse_set_signal_handlers(se) != -1) {
fuse_session_mount(se, fuse_cmdline_opts.mountpoint);
fprintf(stderr, "resource ready\n");
err = fuse_session_loop_mt(se, NULL);
fuse_remove_signal_handlers(se);
fuse_session_unmount(se);
}
}
}
I do not undestand, how I can pass kernel options (like max_reads, max_write) to fuse?
fuse: unknown option(s): `-o max_write=1024'
I expected libfuse will grab options from command line by himself
There is no native way to pass max_write
through command line.
max_write
is a member of struct fuse_conn_info
. You can set it through the fuse ->init()
method. You can implement your own such cmd line arg and later set appropriately, like: conn->max_write = argv_parsed_value
.
See this libfuse example fs doing something similar: https://github.com/libfuse/libfuse/blob/a466241b45d1dd0bf685513bdeefd6448b63beb6/example/passthrough_ll.c#L168
Please notice your code tries to parse cmd line args into struct fuse_cmdline_opts
. max_write
is not included there: https://github.com/libfuse/libfuse/blob/a466241b45d1dd0bf685513bdeefd6448b63beb6/include/fuse_lowlevel.h#L1941