moved fuse_main to operations

pull/10/head
Falk Werner 6 years ago
parent 21fbc199f6
commit 0c5d66e434

@ -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

@ -7,6 +7,7 @@ extern "C" {
#define FUSE_USE_VERSION 31
#include <fuse.h>
#include <fuse_lowlevel.h>
#ifdef __cplusplus
}

@ -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;
}

@ -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,

Loading…
Cancel
Save