summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorManuel Bentele2019-06-23 15:23:45 +0200
committerManuel Bentele2019-06-23 15:23:45 +0200
commitb800dbf06bef3004aa37dc93ec6d2a311cc8ac23 (patch)
tree060505ba4fd2a3abe654dc8478ef174a9a94c5cf /include
parentbuild-sys: release++ (v2.34) (diff)
downloadkernel-qcow2-util-linux-b800dbf06bef3004aa37dc93ec6d2a311cc8ac23.tar.gz
kernel-qcow2-util-linux-b800dbf06bef3004aa37dc93ec6d2a311cc8ac23.tar.xz
kernel-qcow2-util-linux-b800dbf06bef3004aa37dc93ec6d2a311cc8ac23.zip
lib/losetup: added file format support
losetup can set the file format of each loop device during creation. Signed-off-by: Manuel Bentele <development@manuel-bentele.de>
Diffstat (limited to 'include')
-rw-r--r--include/loopdev.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/loopdev.h b/include/loopdev.h
index 0e3a7517a..bc68e526b 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
/*
@@ -64,6 +72,7 @@ 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;
};
#define LOOPDEV_MAJOR 7 /* loop major number */
@@ -175,6 +184,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 +195,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 +217,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 */