-
Notifications
You must be signed in to change notification settings - Fork 2
/
fusenar.c
39 lines (32 loc) · 1002 Bytes
/
fusenar.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fuse.h>
#include "fusenar_core.h"
struct fuse_operations fusenar_oper = {
.getattr = fusenar_getattr,
.readlink = fusenar_readlink,
.open = fusenar_open,
.read = fusenar_read,
.readdir = fusenar_readdir,
.release = fusenar_release
};
int main(int argc, char** argv) {
if ((argc < 4) || (argv[argc-2][0] == '-') || (argv[argc-1][0] == '-')) {
printf("%s <cachedir> <nardir> <mountpoint>\n",argv[0]);
return -1;
}
struct fusenar_state fusenar_data;
fusenar_data.rootdir = realpath(argv[argc-2], NULL);
fusenar_data.cachedir = realpath(argv[argc-3], NULL);
argv[argc-3] = argv[argc-1];
argv[argc-2] = NULL;
argc--;
argc--;
int i;
for (i=0; i<argc; i++) {
printf("%d = %s\n",i,argv[i]);
}
printf("data %s\ncache %s\n",fusenar_data.rootdir,fusenar_data.cachedir);
return fuse_main(argc,argv,&fusenar_oper,&fusenar_data);
}