diff options
Diffstat (limited to 'libbcache.h')
-rw-r--r-- | libbcache.h | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/libbcache.h b/libbcache.h index 6ec3f42..779b470 100644 --- a/libbcache.h +++ b/libbcache.h @@ -1,6 +1,7 @@ #ifndef _LIBBCACHE_H #define _LIBBCACHE_H +#include <linux/bcache.h> #include <linux/uuid.h> #include "tools-util.h" #include "vstructs.h" @@ -18,32 +19,56 @@ enum fsck_err_opts { 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_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, + }; +} + struct dev_opts { int fd; - const char *path; + char *path; u64 size; /* 512 byte sectors */ unsigned bucket_size; unsigned tier; bool discard; - u64 first_bucket; u64 nbuckets; + + u64 sb_offset; + u64 sb_end; }; -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, - unsigned max_journal_entry_size, - char *label, - uuid_le uuid); +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); |