From a8f1ae35af664bfaff0ce57be4f81b4e0f20cb10 Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Sat, 20 Apr 2024 22:56:13 +0200 Subject: [PATCH] example/: Convert all fuse_session_loop_mt users to 3.12 API (#931) Convert all the remaining users of fuse_session_loop_mt() to the new 3.12 config api. --- example/hello_ll.c | 11 +++++++---- example/notify_inval_entry.c | 11 +++++++---- example/notify_inval_inode.c | 11 +++++++---- example/notify_store_retrieve.c | 11 +++++++---- example/passthrough_ll.c | 13 ++++++++----- 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/example/hello_ll.c b/example/hello_ll.c index 803528d..10f4b4a 100644 --- a/example/hello_ll.c +++ b/example/hello_ll.c @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_session *se; struct fuse_cmdline_opts opts; - struct fuse_loop_config config; + struct fuse_loop_config *config; int ret = -1; if (fuse_parse_cmdline(&args, &opts) != 0) @@ -259,9 +259,12 @@ int main(int argc, char *argv[]) if (opts.singlethread) ret = fuse_session_loop(se); else { - config.clone_fd = opts.clone_fd; - config.max_idle_threads = opts.max_idle_threads; - ret = fuse_session_loop_mt(se, &config); + config = fuse_loop_cfg_create(); + fuse_loop_cfg_set_clone_fd(config, opts.clone_fd); + fuse_loop_cfg_set_max_threads(config, opts.max_threads); + ret = fuse_session_loop_mt(se, config); + fuse_loop_cfg_destroy(config); + config = NULL; } fuse_session_unmount(se); diff --git a/example/notify_inval_entry.c b/example/notify_inval_entry.c index 0d085df..83b24d2 100644 --- a/example/notify_inval_entry.c +++ b/example/notify_inval_entry.c @@ -307,7 +307,7 @@ int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_session *se; struct fuse_cmdline_opts opts; - struct fuse_loop_config config; + struct fuse_loop_config *config; pthread_t updater; int ret = -1; @@ -362,9 +362,12 @@ int main(int argc, char *argv[]) { if (opts.singlethread) { ret = fuse_session_loop(se); } else { - config.clone_fd = opts.clone_fd; - config.max_idle_threads = opts.max_idle_threads; - ret = fuse_session_loop_mt(se, &config); + config = fuse_loop_cfg_create(); + fuse_loop_cfg_set_clone_fd(config, opts.clone_fd); + fuse_loop_cfg_set_max_threads(config, opts.max_threads); + ret = fuse_session_loop_mt(se, config); + fuse_loop_cfg_destroy(config); + config = NULL; } fuse_session_unmount(se); diff --git a/example/notify_inval_inode.c b/example/notify_inval_inode.c index b1fb8f7..c0b1112 100644 --- a/example/notify_inval_inode.c +++ b/example/notify_inval_inode.c @@ -311,7 +311,7 @@ int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_session *se; struct fuse_cmdline_opts opts; - struct fuse_loop_config config; + struct fuse_loop_config *config; pthread_t updater; int ret = -1; @@ -364,9 +364,12 @@ int main(int argc, char *argv[]) { if (opts.singlethread) ret = fuse_session_loop(se); else { - config.clone_fd = opts.clone_fd; - config.max_idle_threads = opts.max_idle_threads; - ret = fuse_session_loop_mt(se, &config); + config = fuse_loop_cfg_create(); + fuse_loop_cfg_set_clone_fd(config, opts.clone_fd); + fuse_loop_cfg_set_max_threads(config, opts.max_threads); + ret = fuse_session_loop_mt(se, config); + fuse_loop_cfg_destroy(config); + config = NULL; } fuse_session_unmount(se); diff --git a/example/notify_store_retrieve.c b/example/notify_store_retrieve.c index d7e1c4b..1298591 100644 --- a/example/notify_store_retrieve.c +++ b/example/notify_store_retrieve.c @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_session *se; struct fuse_cmdline_opts opts; - struct fuse_loop_config config; + struct fuse_loop_config *config; int ret = -1; if (fuse_opt_parse(&args, &options, option_spec, NULL) == -1) @@ -436,9 +436,12 @@ int main(int argc, char *argv[]) { if (opts.singlethread) ret = fuse_session_loop(se); else { - config.clone_fd = opts.clone_fd; - config.max_idle_threads = opts.max_idle_threads; - ret = fuse_session_loop_mt(se, &config); + config = fuse_loop_cfg_create(); + fuse_loop_cfg_set_clone_fd(config, opts.clone_fd); + fuse_loop_cfg_set_max_threads(config, opts.max_threads); + ret = fuse_session_loop_mt(se, config); + fuse_loop_cfg_destroy(config); + config = NULL; } assert(retrieve_status != 1); diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c index 9d38a7f..da9de53 100644 --- a/example/passthrough_ll.c +++ b/example/passthrough_ll.c @@ -35,7 +35,7 @@ */ #define _GNU_SOURCE -#define FUSE_USE_VERSION 34 +#define FUSE_USE_VERSION FUSE_MAKE_VERSION(3, 12) #include #include @@ -1198,7 +1198,7 @@ int main(int argc, char *argv[]) struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_session *se; struct fuse_cmdline_opts opts; - struct fuse_loop_config config; + struct fuse_loop_config *config; struct lo_data lo = { .debug = 0, .writeback = 0 }; int ret = -1; @@ -1304,9 +1304,12 @@ int main(int argc, char *argv[]) if (opts.singlethread) ret = fuse_session_loop(se); else { - config.clone_fd = opts.clone_fd; - config.max_idle_threads = opts.max_idle_threads; - ret = fuse_session_loop_mt(se, &config); + config = fuse_loop_cfg_create(); + fuse_loop_cfg_set_clone_fd(config, opts.clone_fd); + fuse_loop_cfg_set_max_threads(config, opts.max_threads); + ret = fuse_session_loop_mt(se, config); + fuse_loop_cfg_destroy(config); + config = NULL; } fuse_session_unmount(se); -- 2.30.2