-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.c
83 lines (71 loc) · 1.76 KB
/
main.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* copyfs - copy on write filesystem http://n0x.org/copyfs/
* Copyright (C) 2004 Nicolas Vigier <[email protected]>
* Thomas Joubert <[email protected]>
* This program can be distributed under the terms of the GNU GPL.
* See the file COPYING.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <strings.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <fuse.h>
#include "helper.h"
#include "structs.h"
#include "cache.h"
#include "create.h"
char *rcs_version_path = "/home/widan/versions";
void rcs_free_metadata(metadata_t *metadata)
{
version_t *version, *next;
version = metadata->md_versions;
while (version)
{
next = version->v_next;
free(version->v_rfile);
free(version);
version = next;
}
if (metadata->md_vpath)
helper_free_array(metadata->md_vpath);
free(metadata->md_vfile);
free(metadata);
}
#if 0
void set_config()
{
gl_config = getenv("CPYFS_MIRROR");
if (gl_config.mirrored_dir == NULL) {
gl_config.mirrored_dir = "/var";
}
gl_config.backup_dir = getenv("CPYFS_BACKDIR");
if (gl_config.backup_dir == NULL) {
gl_config.backup_dir = "/tmp";
}
}
int main(int argc, char *argv[])
{
fuse_main(argc, argv, &callback_oper);
return 0;
}
#endif
extern struct fuse_operations callback_oper;
int main(int argc, char **argv)
{
rcs_version_path = getenv("RCS_VERSION_PATH");
if (!rcs_version_path)
{
fprintf(stderr, "RCS_VERSION_PATH not defined in environment.\n");
fprintf(stderr, "You really should use he `copyfs-mount' script.\n");
exit(1);
}
/* Restrict permissions on create files */
umask(0077);
cache_initialize();
fuse_main(argc, argv, &callback_oper);
cache_finalize();
exit(0);
}