-
Notifications
You must be signed in to change notification settings - Fork 2
/
multi_loopback.h
97 lines (84 loc) · 1.77 KB
/
multi_loopback.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
SafeFS
(c) 2016 2016 INESC TEC. Written by J. Paulo and R. Pontes
*/
#ifndef __MULTI_LOOPBACK_LINUX_H__
#define __MULTI_LOOPBACK_LINUX_H__
#define FUSE_USE_VERSION 26
#define _GNU_SOURCE
#include <fuse.h>
#include "logdef.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include <errno.h>
#include <sys/time.h>
#include "utils.h"
#include "SFSConfig.h"
#include "layers_def.h"
#include "multi_loop_drivers/xor.h"
#include "multi_loop_drivers/rep.h"
#include "multi_loop_drivers/erasure.h"
#include <glib.h>
#define REP 0
#define XOR 1
#define ERASURE 2
#define READ_OP 0
#define WRITE_OP 1
#define RELEASE_OP 2
#define RENAME_OP 4
#define FLUSH_OP 5
#define FSYNC_OP 6
#define TRUNCATE_OP 7
#define FTRUNCATE_OP 8
#define OPENDIR 9
#define MKNOD_OP 10
#define MKDIR_OP 11
#define UNLINK_OP 12
#define RMDIR_OP 13
#define CREATE_OP 14
#define OPEN_OP 15
#define OPENDIR_OP 16
#define RELEASEDIR_OP 17
#define SYMLINK_OP 18
#define LINK_OP 19
#define CHMOD_OP 20
#define CHOWN_OP 21
struct loopback_dirp {
DIR *dp;
struct dirent *entry;
off_t offset;
};
struct mpath_aux {
struct loopback_dirp *ldp;
unsigned long *devs_fd;
};
struct op_info {
int op_type;
int op_res;
off_t fd;
char *path;
char *frompath;
char *topath;
char *buf;
uid_t uid;
gid_t gid;
off_t size;
uint64_t magicblocksize;
off_t magicblockoffset;
off_t offset;
mode_t mode;
dev_t rdev;
int flags;
struct loopback_dirp *d;
pthread_mutex_t *lock;
pthread_cond_t *cond;
int *ops_done;
int op_error;
};
int init_multi_loopback_driver(struct fuse_operations **fuse_operations, configuration data);
int clean_multi_loopback_driver(configuration data);
#endif