-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlayers_def.h
68 lines (58 loc) · 2.38 KB
/
layers_def.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
/*
SafeFS
(c) 2016 2016 INESC TEC. Written by J. Paulo and R. Pontes
*/
#ifndef __LAYERSDEF_H__
#define __LAYERSDEF_H__
#ifdef __linux__
#ifndef FUSE_USE_VERSION
#define FUSE_USE_VERSION 26
#endif /* FUSE_USE_VERSION */
#endif /* __linux__ */
#if defined(_POSIX_C_SOURCE)
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#endif
#include <stdio.h>
#include <fuse.h>
#include <stdlib.h>
#include <sys/stat.h>
// This is used by the sfuse layer drivers
struct key_info {
const char *path;
uint64_t offset;
};
struct encode_driver {
int (*encode)(unsigned char *dest, const unsigned char *src, int size, void *ident);
int (*decode)(unsigned char *dest, const unsigned char *src, int size, void *ident);
off_t (*get_file_size)(const char *path, off_t orig_size, struct fuse_file_info *fi,
struct fuse_operations nextlayer);
int (*get_cyphered_block_size)(int orig_size);
uint64_t (*get_cyphered_block_offset)(uint64_t orig_offset);
off_t (*get_truncate_size)(off_t size);
int (*copy_dbkeys)(const char *from, const char *to);
int (*delete_dbkeys)(const char *path);
};
struct align_driver {
int (*align_read)(const char *path, char *buf, size_t size, off_t offset, void *fi,
struct fuse_operations nextlayer);
int (*align_write)(const char *path, const char *buf, size_t size, off_t offset, void *fi,
struct fuse_operations nextlayer);
int (*align_create)(const char *path, mode_t mode, void *fi, struct fuse_operations nextlayer);
int (*align_open)(const char *path, void *fi, struct fuse_operations nextlayer);
int (*align_truncate)(const char *path, off_t size, struct fuse_file_info *fi, struct fuse_operations nextlayer);
};
struct multi_driver {
void (*get_driver_offset)(const char *path, off_t offset, off_t *driver_offset);
void (*get_driver_size)(const char *path, off_t offset, uint64_t *driver_size);
void (*encode)(const char *path, unsigned char **magicblocks, unsigned char *block, off_t offset, int size,
int ndevs);
void (*decode)(unsigned char *block, unsigned char **magicblocks, int size, int ndevs);
uint64_t (*get_file_size)(const char *path);
void (*rename)(char *from, char *to);
void (*create)(char *path);
void (*clean)();
};
#endif /*__LAYERSDEF_H__*/