1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00
falk-werner_webfuse/src/wsfs/operations.c

43 lines
1.1 KiB
C
Raw Normal View History

2019-01-27 02:45:03 +00:00
#include "wsfs/operations.h"
#include <string.h>
2019-02-02 08:37:18 +00:00
int wsfs_operations_loop(
char * mount_point,
struct wsfs_jsonrpc * rpc)
2019-02-02 10:45:38 +00:00
{
struct fuse_lowlevel_ops operations;
memset(&operations, 0, sizeof(struct fuse_lowlevel_ops));
2019-02-03 18:10:05 +00:00
operations.lookup = &wsfs_operation_lookup;
operations.getattr = &wsfs_operation_getattr;
operations.readdir = &wsfs_operation_readdir;
operations.open = &wsfs_operation_open;
operations.release = &wsfs_operation_close;
operations.read = &wsfs_operation_read;
2019-02-02 10:45:38 +00:00
int result = 1;
const int argc = 1;
char * argv[] = {"", NULL};
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
struct wsfs_operations_context context = {
.rpc = rpc,
.timeout = 1.0
};
struct fuse_session * session = fuse_session_new(&args, &operations, sizeof(operations), &context);
if (NULL != session)
{
fuse_set_signal_handlers(session);
result = fuse_session_mount(session, mount_point);
if (0 == result)
{
result = fuse_session_loop(session);
fuse_session_unmount(session);
}
fuse_remove_signal_handlers(session);
fuse_session_destroy(session);
}
2019-02-02 10:45:38 +00:00
fuse_opt_free_args(&args);
2019-02-02 10:45:38 +00:00
return 0;
}