1*5937835aSCoiby Xu #ifndef BLOCK_HELPERS_H 2*5937835aSCoiby Xu #define BLOCK_HELPERS_H 3*5937835aSCoiby Xu 4*5937835aSCoiby Xu #include "qemu/units.h" 5*5937835aSCoiby Xu 6*5937835aSCoiby Xu /* lower limit is sector size */ 7*5937835aSCoiby Xu #define MIN_BLOCK_SIZE INT64_C(512) 8*5937835aSCoiby Xu #define MIN_BLOCK_SIZE_STR "512 B" 9*5937835aSCoiby Xu /* 10*5937835aSCoiby Xu * upper limit is arbitrary, 2 MiB looks sufficient for all sensible uses, and 11*5937835aSCoiby Xu * matches qcow2 cluster size limit 12*5937835aSCoiby Xu */ 13*5937835aSCoiby Xu #define MAX_BLOCK_SIZE (2 * MiB) 14*5937835aSCoiby Xu #define MAX_BLOCK_SIZE_STR "2 MiB" 15*5937835aSCoiby Xu 16*5937835aSCoiby Xu void check_block_size(const char *id, const char *name, int64_t value, 17*5937835aSCoiby Xu Error **errp); 18*5937835aSCoiby Xu 19*5937835aSCoiby Xu #endif /* BLOCK_HELPERS_H */ 20