2016-08-18 00:23:03 +03:00
|
|
|
#ifndef _LIBBCACHE_H
|
|
|
|
#define _LIBBCACHE_H
|
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
#include "stdbool.h"
|
|
|
|
|
2016-10-04 12:10:24 +03:00
|
|
|
extern const char * const cache_state[];
|
|
|
|
extern const char * const replacement_policies[];
|
|
|
|
extern const char * const csum_types[];
|
|
|
|
extern const char * const compression_types[];
|
|
|
|
extern const char * const str_hash_types[];
|
|
|
|
extern const char * const error_actions[];
|
|
|
|
extern const char * const bdev_cache_mode[];
|
|
|
|
extern const char * const bdev_state[];
|
|
|
|
|
2016-08-18 00:23:03 +03:00
|
|
|
struct dev_opts {
|
|
|
|
int fd;
|
2016-08-24 06:50:31 +03:00
|
|
|
const char *path;
|
2016-08-18 00:23:03 +03:00
|
|
|
u64 size; /* 512 byte sectors */
|
|
|
|
unsigned bucket_size;
|
|
|
|
unsigned tier;
|
|
|
|
bool discard;
|
|
|
|
|
|
|
|
u64 first_bucket;
|
|
|
|
u64 nbuckets;
|
|
|
|
};
|
|
|
|
|
|
|
|
void bcache_format(struct dev_opts *devs, size_t nr_devs,
|
|
|
|
unsigned block_size,
|
|
|
|
unsigned btree_node_size,
|
|
|
|
unsigned meta_csum_type,
|
|
|
|
unsigned data_csum_type,
|
|
|
|
unsigned compression_type,
|
|
|
|
const char *passphrase,
|
|
|
|
unsigned meta_replicas,
|
|
|
|
unsigned data_replicas,
|
|
|
|
unsigned on_error_action,
|
|
|
|
char *label,
|
|
|
|
uuid_le uuid);
|
|
|
|
|
2016-10-04 12:10:24 +03:00
|
|
|
void bcache_super_print(struct cache_sb *, int);
|
|
|
|
|
|
|
|
struct cache_sb *bcache_super_read(const char *);
|
2016-08-18 00:23:03 +03:00
|
|
|
|
|
|
|
#endif /* _LIBBCACHE_H */
|