1 #include <event2/event.h>
4 #include "lib/signals.h"
9 struct event_base *ev_base;
11 struct signals *signals;
15 struct evfuse *ev_fuse;
19 static struct simple_node node_list[] = {
20 { 1, S_IFDIR, 0555, 0, NULL, NULL },
21 { 2, S_IFREG, 0444, 1, "hello", "Hello World!\n" },
22 { 3, S_IFREG, 0444, 1, "foo", "Foo\n" },
23 { 4, S_IFREG, 0444, 1, "bar", "Bar\n" },
24 { 5, S_IFDIR, 0555, 1, "test", NULL },
25 { 6, S_IFREG, 0444, 5, "file0", "data0\n" },
26 { 7, S_IFREG, 0444, 5, "file1", "data1\n" },
27 { 8, S_IFLNK, 0444, 1, "lnk0", "test/file0" },
28 { 0, 0, 0, 0, NULL, NULL },
31 int main (int argc, char **argv) {
32 struct fuse_args fuse_args = FUSE_ARGS_INIT(argc, argv);
35 if ((ctx.ev_base = event_base_new()) == NULL)
36 ERROR("event_base_new");
39 if ((ctx.signals = signals_default(ctx.ev_base)) == NULL)
40 ERROR("signals_default");
43 if ((ctx.fs = simple_new(node_list)) == NULL)
47 if ((ctx.ev_fuse = evfuse_new(ctx.ev_base, &fuse_args, simple_init(), ctx.fs)) == NULL)
51 INFO("running libevent loop");
53 if (event_base_dispatch(ctx.ev_base))
54 PERROR("event_base_dispatch");
61 evfuse_free(ctx.ev_fuse);
69 signals_free(ctx.signals);
72 event_base_free(ctx.ev_base);
74 fuse_opt_free_args(&fuse_args);