diff --git a/src/app/main.c b/src/app/main.c index 0df6f2a..c238e8d 100644 --- a/src/app/main.c +++ b/src/app/main.c @@ -131,9 +131,6 @@ int main(int argc, char * argv[]) }; int result = parse_arguments(argc, argv, &args); - - struct fuse_operations operations; - wsfs_operations_init(&operations); if (!args.show_help) { @@ -143,8 +140,7 @@ int main(int argc, char * argv[]) wsfs_server_start(server); struct wsfs_jsonrpc * const rpc = wsfs_server_get_jsonrpc_service(server); - char * fuse_args[] = { "-s", "-f", args.mount_point, NULL }; - result = fuse_main(3, fuse_args, &operations, rpc); + result = wsfs_operations_loop(args.mount_point, rpc); wsfs_server_dispose(server); } else diff --git a/src/wsfs/fuse_wrapper.h b/src/wsfs/fuse_wrapper.h index 006ef6d..3266494 100644 --- a/src/wsfs/fuse_wrapper.h +++ b/src/wsfs/fuse_wrapper.h @@ -7,6 +7,7 @@ extern "C" { #define FUSE_USE_VERSION 31 #include +#include #ifdef __cplusplus } diff --git a/src/wsfs/operations.c b/src/wsfs/operations.c index d6a9ef6..73ad029 100644 --- a/src/wsfs/operations.c +++ b/src/wsfs/operations.c @@ -15,7 +15,7 @@ static void* wsfs_operation_init( return context->private_data; } -void wsfs_operations_init( +static void wsfs_operations_init( struct fuse_operations * operations) { memset(operations, 0, sizeof(struct fuse_operations)); @@ -27,3 +27,15 @@ void wsfs_operations_init( operations->read = &wsfs_operation_read; } +int wsfs_operations_loop( + char * mount_point, + struct wsfs_jsonrpc * rpc) +{ + struct fuse_operations operations; + wsfs_operations_init(&operations); + + char * fuse_args[] = { "app", "-s", "-f", mount_point, NULL }; + int const result = fuse_main(4, fuse_args, &operations, rpc); + + return result; +} diff --git a/src/wsfs/operations.h b/src/wsfs/operations.h index 84080ed..38a9c00 100644 --- a/src/wsfs/operations.h +++ b/src/wsfs/operations.h @@ -3,12 +3,15 @@ #include "wsfs/fuse_wrapper.h" +struct wsfs_jsonrpc; + #ifdef __cplusplus extern "C" { #endif -extern void wsfs_operations_init( - struct fuse_operations * operations); +extern int wsfs_operations_loop( + char * mount_point, + struct wsfs_jsonrpc * rpc); extern int wsfs_operation_readdir( char const * path,