mirror of
https://github.com/libfuse/libfuse.git
synced 2024-11-27 06:04:27 +08:00
Updated example code to work with new API (#547)
This commit is contained in:
parent
dfb4054bb7
commit
86f40b8584
@ -18,7 +18,7 @@
|
||||
* \include hello_ll.c
|
||||
*/
|
||||
|
||||
#define FUSE_USE_VERSION 31
|
||||
#define FUSE_USE_VERSION 34
|
||||
|
||||
#include <fuse_lowlevel.h>
|
||||
#include <stdio.h>
|
||||
@ -166,6 +166,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;
|
||||
int ret = -1;
|
||||
|
||||
if (fuse_parse_cmdline(&args, &opts) != 0)
|
||||
@ -206,8 +207,11 @@ int main(int argc, char *argv[])
|
||||
/* Block until ctrl+c or fusermount -u */
|
||||
if (opts.singlethread)
|
||||
ret = fuse_session_loop(se);
|
||||
else
|
||||
ret = fuse_session_loop_mt(se, opts.clone_fd);
|
||||
else {
|
||||
config.clone_fd = opts.clone_fd;
|
||||
config.max_idle_threads = opts.max_idle_threads;
|
||||
ret = fuse_session_loop_mt(se, &config);
|
||||
}
|
||||
|
||||
fuse_session_unmount(se);
|
||||
err_out3:
|
||||
|
@ -25,7 +25,7 @@
|
||||
* \include @file
|
||||
*/
|
||||
|
||||
#define FUSE_USE_VERSION 31
|
||||
#define FUSE_USE_VERSION 34
|
||||
|
||||
#include <fuse.h>
|
||||
#include <fuse_lowlevel.h> /* for fuse_cmdline_opts */
|
||||
@ -212,6 +212,7 @@ int main(int argc, char *argv[]) {
|
||||
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
|
||||
struct fuse *fuse;
|
||||
struct fuse_cmdline_opts opts;
|
||||
struct fuse_loop_config config;
|
||||
int res;
|
||||
|
||||
/* Initialize the files */
|
||||
@ -271,8 +272,11 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (opts.singlethread)
|
||||
res = fuse_loop(fuse);
|
||||
else
|
||||
res = fuse_loop_mt(fuse, opts.clone_fd);
|
||||
else {
|
||||
config.clone_fd = opts.clone_fd;
|
||||
config.max_idle_threads = opts.max_idle_threads;
|
||||
res = fuse_loop_mt(fuse, &config);
|
||||
}
|
||||
if (res)
|
||||
res = 1;
|
||||
|
||||
|
@ -73,7 +73,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#define FUSE_USE_VERSION 31
|
||||
#define FUSE_USE_VERSION 34
|
||||
|
||||
#include <fuse_lowlevel.h>
|
||||
#include <stdio.h>
|
||||
@ -273,6 +273,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;
|
||||
pthread_t updater;
|
||||
int ret = -1;
|
||||
|
||||
@ -321,8 +322,11 @@ int main(int argc, char *argv[]) {
|
||||
/* Block until ctrl+c or fusermount -u */
|
||||
if (opts.singlethread)
|
||||
ret = fuse_session_loop(se);
|
||||
else
|
||||
ret = fuse_session_loop_mt(se, opts.clone_fd);
|
||||
else {
|
||||
config.clone_fd = opts.clone_fd;
|
||||
config.max_idle_threads = opts.max_idle_threads;
|
||||
ret = fuse_session_loop_mt(se, &config);
|
||||
}
|
||||
|
||||
fuse_session_unmount(se);
|
||||
err_out3:
|
||||
|
@ -59,7 +59,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#define FUSE_USE_VERSION 31
|
||||
#define FUSE_USE_VERSION 34
|
||||
|
||||
#include <fuse_lowlevel.h>
|
||||
#include <stdio.h>
|
||||
@ -289,6 +289,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;
|
||||
pthread_t updater;
|
||||
int ret = -1;
|
||||
|
||||
@ -340,8 +341,11 @@ int main(int argc, char *argv[]) {
|
||||
/* Block until ctrl+c or fusermount -u */
|
||||
if (opts.singlethread)
|
||||
ret = fuse_session_loop(se);
|
||||
else
|
||||
ret = fuse_session_loop_mt(se, opts.clone_fd);
|
||||
else {
|
||||
config.clone_fd = opts.clone_fd;
|
||||
config.max_idle_threads = opts.max_idle_threads;
|
||||
ret = fuse_session_loop_mt(se, &config);
|
||||
}
|
||||
|
||||
fuse_session_unmount(se);
|
||||
err_out3:
|
||||
|
@ -58,7 +58,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#define FUSE_USE_VERSION 31
|
||||
#define FUSE_USE_VERSION 34
|
||||
|
||||
#include <fuse_lowlevel.h>
|
||||
#include <stdio.h>
|
||||
@ -350,6 +350,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;
|
||||
pthread_t updater;
|
||||
int ret = -1;
|
||||
|
||||
@ -398,8 +399,11 @@ int main(int argc, char *argv[]) {
|
||||
/* Block until ctrl+c or fusermount -u */
|
||||
if (opts.singlethread)
|
||||
ret = fuse_session_loop(se);
|
||||
else
|
||||
ret = fuse_session_loop_mt(se, opts.clone_fd);
|
||||
else {
|
||||
config.clone_fd = opts.clone_fd;
|
||||
config.max_idle_threads = opts.max_idle_threads;
|
||||
ret = fuse_session_loop_mt(se, &config);
|
||||
}
|
||||
|
||||
assert(retrieve_status != 1);
|
||||
fuse_session_unmount(se);
|
||||
|
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#define FUSE_USE_VERSION 31
|
||||
#define FUSE_USE_VERSION 34
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@ -1156,6 +1156,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 lo_data lo = { .debug = 0,
|
||||
.writeback = 0 };
|
||||
int ret = -1;
|
||||
@ -1255,8 +1256,11 @@ int main(int argc, char *argv[])
|
||||
/* Block until ctrl+c or fusermount -u */
|
||||
if (opts.singlethread)
|
||||
ret = fuse_session_loop(se);
|
||||
else
|
||||
ret = fuse_session_loop_mt(se, opts.clone_fd);
|
||||
else {
|
||||
config.clone_fd = opts.clone_fd;
|
||||
config.max_idle_threads = opts.max_idle_threads;
|
||||
ret = fuse_session_loop_mt(se, &config);
|
||||
}
|
||||
|
||||
fuse_session_unmount(se);
|
||||
err_out3:
|
||||
|
Loading…
Reference in New Issue
Block a user