-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluf.h
66 lines (54 loc) · 1.67 KB
/
cluf.h
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
/**
* @author Matthias P. Nowak
* @copyright LGPL 3.0 https://opensource.org/licenses/lgpl-3.0.html
* can be precompiled
*/
#ifndef CLUF_H_
#define CLUF_H_
#define _GNU_SOURCE
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <linux/fs.h> // for RENAME_EXCHANGE
#include <pthread.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/fanotify.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
/*
* documentation to the function is in the corresponding files
*/
bool cluf_same(int fd1, int fd2);
int cluf_source2shortened2(char *in, char *entry, char *out);
int cluf_source2shortened(char *in, char *out);
int cluf_source2target(char *in, char *out, int *len);
int cluf_target2sourceShortened(char *in, char *entry, char *out);
int cluf_target2source(char *in, char *out);
void cluf_copyFile(char* dest, int fd);
void cluf_exit(char *msg);
void cluf_makeSymlinks(char *srcDir);
void cluf_setup_1();
void cluf_setup(char* recFile);
void cluf_handle_events();
void cluf_updateSymlinks(char *target,dev_t device);
struct cluf_global {
int debug; // increased verbosity
int fanotifyFD; // file descriptor for fanotify
FILE *fanotifyFile; // for recording opened files
char *sourceName; // source name where the proper files are
int sourceLen; // length of sourcefile mount point
char *targetName; // place to put symlinks and opened proper files
int targetLen;
bool shortenLinks; // indicate a use in a chrooted environment
time_t startTime;
};
extern struct cluf_global _cluf;
#endif /* CLUF_H_ */