-
Notifications
You must be signed in to change notification settings - Fork 2
/
defrag_lessfs.c
64 lines (55 loc) · 1.02 KB
/
defrag_lessfs.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
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <fuse.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <tcutil.h>
#include <tchdb.h>
#include <tcbdb.h>
#include <stdbool.h>
#include "lib_log.h"
#include "lib_safe.h"
#include "lib_cfg.h"
#include "lib_str.h"
#include "retcodes.h"
#ifdef LZO
#include "lib_lzo.h"
#endif
#include "lib_qlz.h"
#include "lib_tc.h"
#include "commons.h"
#ifdef i386
#define ITERATIONS 30
#else
#define ITERATIONS 500
#endif
u_int32_t db_flags, env_flags;
void usage(char *name)
{
printf("Usage: %s /path_to_config.cfg\n", name);
exit(-1);
}
int main(int argc, char *argv[])
{
char *dbg = NULL;
if (argc < 2)
usage(argv[0]);
dbg = getenv("DEBUG");
if (NULL != dbg)
debug = atoi(dbg);
FUNC;
if (-1 == r_env_cfg(argv[1]))
usage(argv[0]);
parseconfig(0);
tc_defrag();
tc_close(1);
sync();
exit(0);
}