example/: Convert all fuse_session_loop_mt users to 3.12 API (#931)
authorBernd Schubert <bschubert@ddn.com>
Sat, 20 Apr 2024 20:56:13 +0000 (22:56 +0200)
committerGitHub <noreply@github.com>
Sat, 20 Apr 2024 20:56:13 +0000 (22:56 +0200)
Convert all the remaining users of fuse_session_loop_mt() to
the new 3.12 config api.

example/hello_ll.c
example/notify_inval_entry.c
example/notify_inval_inode.c
example/notify_store_retrieve.c
example/passthrough_ll.c

index 803528d816671c444bb1879da2f7c76fbcd4a476..10f4b4ac243e2ebfa17985504c1222bb6c66c715 100644 (file)
@@ -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);
index 0d085df7dad13eebc8def2550fe2eb9c6ec149ad..83b24d27cb1aecb4ef0f4d9cbfc0f7caa5d9c70a 100644 (file)
@@ -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);
index b1fb8f7570edf5552ba3e28e75ec6be019078d16..c0b1112a061e266fe8065110dedca241a937e90f 100644 (file)
@@ -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);
index d7e1c4b2dcb29688c9ad5fa662a0476bd2a105f1..1298591f5011f2145c58703b2b720a9261c7883c 100644 (file)
@@ -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);
index 9d38a7f2faec625091dcd93c9863a82265b1c346..da9de53d14568057e7ec51a9fcb1a8075dde66a1 100644 (file)
@@ -35,7 +35,7 @@
  */
 
 #define _GNU_SOURCE
-#define FUSE_USE_VERSION 34
+#define FUSE_USE_VERSION FUSE_MAKE_VERSION(3, 12)
 
 #include <fuse_lowlevel.h>
 #include <unistd.h>
@@ -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);