-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
61 lines (51 loc) · 1.44 KB
/
Copy pathmain.c
File metadata and controls
61 lines (51 loc) · 1.44 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "fat16.h"
#include "options.h"
#include <stdio.h>
#include <assert.h>
static void show_help(const char *progname)
{
printf("usage: %s [options] <mountpoint>\n\n", progname);
printf("FileSystem Options: \n");
printf("--name filename to store data\n");
}
static const struct fuse_opt options[] = {
OPTION("--name=%s", filename),
OPTION("-h", show_help),
OPTION("--help", show_help),
FUSE_OPT_END
};
static const struct fuse_operations operations = {
.init = fat16_init,
.getattr = fat16_getattr,
.open = fat16_open,
.opendir = fat16_opendir,
.readdir = fat16_readdir,
.read = fat16_read,
.write = fat16_write,
.flush = fat16_flush,
.rename = fat16_rename,
.create = fat16_create,
.mkdir = fat16_mkdir,
.rmdir = fat16_rmdir,
.truncate = fat16_truncate,
.chmod = fat16_chmod,
.chown = fat16_chown,
.access = fat16_access,
.unlink = fat16_unlink,
.release = fat16_release,
.destroy = fat16_destroy,
};
int main(int argc, char *argv[]){
int ret;
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
if (fuse_opt_parse(&args, &g_options, options, NULL) == -1)
return 1;
if (g_options.show_help) {
show_help(argv[0]);
assert(fuse_opt_add_arg(&args, "--help") == 0);
args.argv[0][0] = '\0';
}
ret = fuse_main(args.argc, args.argv, &operations, NULL);
fuse_opt_free_args(&args);
return ret;
}