diff options
Diffstat (limited to 'include/loopdev.h')
-rw-r--r-- | include/loopdev.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/loopdev.h b/include/loopdev.h index 0e3a7517a..f8559afd6 100644 --- a/include/loopdev.h +++ b/include/loopdev.h @@ -11,6 +11,14 @@ #define LO_CRYPT_DES 2 #define LO_CRYPT_CRYPTOAPI 18 +/* + * loop_info.lo_file_fmt_type + */ +#define LO_FILE_FMT_RAW 0 +#define LO_FILE_FMT_QCOW 1 +#define LO_FILE_FMT_VDI 2 +#define LO_FILE_FMT_VMDK 3 + #define LOOP_SET_FD 0x4C00 #define LOOP_CLR_FD 0x4C01 /* @@ -42,6 +50,7 @@ enum { LO_FLAGS_AUTOCLEAR = 4, /* kernel >= 2.6.25 */ LO_FLAGS_PARTSCAN = 8, /* kernel >= 3.2 */ LO_FLAGS_DIRECT_IO = 16, /* kernel >= 4.2 */ + LO_FLAGS_FILE_FMT = 32 }; #define LO_NAME_SIZE 64 @@ -64,7 +73,8 @@ struct loop_info64 { uint8_t lo_crypt_name[LO_NAME_SIZE]; uint8_t lo_encrypt_key[LO_KEY_SIZE]; uint64_t lo_init[2]; -}; + uint32_t lo_file_fmt_type; +} __attribute__((packed)); #define LOOPDEV_MAJOR 7 /* loop major number */ #define LOOPDEV_DEFAULT_NNODES 8 /* default number of loop devices */ @@ -175,6 +185,7 @@ extern int loopcxt_ioctl_blocksize(struct loopdev_cxt *lc, uint64_t blocksize); int loopcxt_set_offset(struct loopdev_cxt *lc, uint64_t offset); int loopcxt_set_sizelimit(struct loopdev_cxt *lc, uint64_t sizelimit); int loopcxt_set_blocksize(struct loopdev_cxt *lc, uint64_t blocksize); +int loopcxt_set_file_fmt_type(struct loopdev_cxt *lc, uint32_t file_fmt_type); int loopcxt_set_flags(struct loopdev_cxt *lc, uint32_t flags); int loopcxt_set_backing_file(struct loopdev_cxt *lc, const char *filename); @@ -185,6 +196,8 @@ extern int loopcxt_get_offset(struct loopdev_cxt *lc, uint64_t *offset); extern int loopcxt_get_blocksize(struct loopdev_cxt *lc, uint64_t *blocksize); extern int loopcxt_get_sizelimit(struct loopdev_cxt *lc, uint64_t *size); extern int loopcxt_get_encrypt_type(struct loopdev_cxt *lc, uint32_t *type); +extern int loopcxt_get_file_fmt_type(struct loopdev_cxt *lc, uint32_t* file_fmt_type); +extern char *loopcxt_get_file_fmt_type_string(struct loopdev_cxt *lc); extern const char *loopcxt_get_crypt_name(struct loopdev_cxt *lc); extern int loopcxt_is_autoclear(struct loopdev_cxt *lc); extern int loopcxt_is_readonly(struct loopdev_cxt *lc); @@ -205,4 +218,6 @@ extern int loopcxt_is_used(struct loopdev_cxt *lc, uint64_t sizelimit, int flags); +extern int parse_file_fmt_type(const char *file_fmt_type_str, uint32_t *file_fmt_type); + #endif /* UTIL_LINUX_LOOPDEV_H */ |