-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibbcache.h
81 lines (61 loc) · 1.5 KB
/
libbcache.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
#ifndef _LIBBCACHE_H
#define _LIBBCACHE_H
#include <linux/bcache.h>
#include <linux/uuid.h>
#include "tools-util.h"
#include "vstructs.h"
#include "stdbool.h"
#include "tools-util.h"
struct cache_sb;
enum fsck_err_opts {
FSCK_ERR_ASK,
FSCK_ERR_YES,
FSCK_ERR_NO,
};
extern enum fsck_err_opts fsck_err_opt;
struct format_opts {
char *label;
uuid_le uuid;
unsigned on_error_action;
unsigned max_journal_entry_size; /* will be removed */
unsigned block_size;
unsigned btree_node_size;
unsigned meta_replicas;
unsigned data_replicas;
unsigned meta_replicas_required;
unsigned data_replicas_required;
unsigned meta_csum_type;
unsigned data_csum_type;
unsigned compression_type;
bool encrypted;
char *passphrase;
};
static inline struct format_opts format_opts_default()
{
return (struct format_opts) {
.on_error_action = BCH_ON_ERROR_RO,
.meta_csum_type = BCH_CSUM_CRC32C,
.data_csum_type = BCH_CSUM_CRC32C,
.meta_replicas = 1,
.data_replicas = 1,
.meta_replicas_required = 1,
.data_replicas_required = 1,
};
}
struct dev_opts {
int fd;
char *path;
u64 size; /* 512 byte sectors */
unsigned bucket_size;
unsigned tier;
bool discard;
u64 nbuckets;
u64 sb_offset;
u64 sb_end;
};
struct bch_sb *bcache_format(struct format_opts, struct dev_opts *, size_t);
void bcache_super_write(int, struct bch_sb *);
struct bch_sb *__bcache_super_read(int, u64);
struct bch_sb *bcache_super_read(const char *);
void bcache_super_print(struct bch_sb *, int);
#endif /* _LIBBCACHE_H */