@@ -26,7 +26,7 @@ block-obj-y += write-threshold.o
block-obj-y += crypto.o
block-obj-y += bochs-probe.o cloop-probe.o crypto-probe.o dmg-probe.o
block-obj-y += parallels-probe.o qcow-probe.o qcow2-probe.o qed-probe.o
-block-obj-y += raw-probe.o vdi-probe.o
+block-obj-y += raw-probe.o vdi-probe.o vhdx-probe.o
common-obj-y += stream.o
common-obj-y += backup.o
new file mode 100644
@@ -0,0 +1,21 @@
+#include "qemu/osdep.h"
+#include "block/probe.h"
+
+/*
+ * Per the MS VHDX Specification, for every VHDX file:
+ * - The header section is fixed size - 1 MB
+ * - The header section is always the first "object"
+ * - The first 64KB of the header is the File Identifier
+ * - The first uint64 (8 bytes) is the VHDX Signature ("vhdxfile")
+ * - The following 512 bytes constitute a UTF-16 string identifiying the
+ * software that created the file, and is optional and diagnostic only.
+ *
+ * Therefore, we probe by looking for the vhdxfile signature "vhdxfile"
+ */
+int vhdx_probe(const uint8_t *buf, int buf_size, const char *filename)
+{
+ if (buf_size >= 8 && !memcmp(buf, "vhdxfile", 8)) {
+ return 100;
+ }
+ return 0;
+}
@@ -19,6 +19,7 @@
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
+#include "block/probe.h"
#include "sysemu/block-backend.h"
#include "qemu/module.h"
#include "qemu/crc32c.h"
@@ -273,25 +274,6 @@ static void vhdx_set_shift_bits(BDRVVHDXState *s)
}
/*
- * Per the MS VHDX Specification, for every VHDX file:
- * - The header section is fixed size - 1 MB
- * - The header section is always the first "object"
- * - The first 64KB of the header is the File Identifier
- * - The first uint64 (8 bytes) is the VHDX Signature ("vhdxfile")
- * - The following 512 bytes constitute a UTF-16 string identifiying the
- * software that created the file, and is optional and diagnostic only.
- *
- * Therefore, we probe by looking for the vhdxfile signature "vhdxfile"
- */
-static int vhdx_probe(const uint8_t *buf, int buf_size, const char *filename)
-{
- if (buf_size >= 8 && !memcmp(buf, "vhdxfile", 8)) {
- return 100;
- }
- return 0;
-}
-
-/*
* Writes the header to the specified offset.
*
* This will optionally read in buffer data from disk (otherwise zero-fill),
@@ -12,5 +12,6 @@ int qcow2_probe(const uint8_t *buf, int buf_size, const char *filename);
int bdrv_qed_probe(const uint8_t *buf, int buf_size, const char *filename);
int raw_probe(const uint8_t *buf, int buf_size, const char *filename);
int vdi_probe(const uint8_t *buf, int buf_size, const char *filename);
+int vhdx_probe(const uint8_t *buf, int buf_size, const char *filename);
#endif