#ifndef CBD_H #define CBD_H /* Kernel compatibility */ #include #include #include #ifndef BITS_PER_BYTE #define BITS_PER_BYTE 8 #endif #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef max #define max(a, b) ((a) < (b) ? (b) : (a)) #endif #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif #ifndef DIV_ROUND_UP #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #endif #ifndef ROUND_UP #define ROUND_UP(n, d) (DIV_ROUND_UP(n, d) * (n)) #endif typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; #include #include #define CBD_DEFAULT_COMPRESSION_FACTOR 2.0 #define CBD_DEFAULT_LOGICAL_BLOCK_SHIFT 4 /* XXX: move to types.h */ typedef enum { t_false, t_true, t_none } tristate_t; int cbd_format(const char* dev, uint64_t poff, uint64_t psize, uint64_t lsize, uint16_t lshift); int cbd_open(const char* dev, uint64_t loff, uint64_t lsize, const char* name); int cbd_close(const char* name); int cbd_stats(const char* name); int cbd_check(const char* dev, tristate_t auto_response); int cbd_resize(const char* dev, uint64_t poff, uint64_t psize); #endif