@@ -68,6 +68,7 @@ static BdrvProbeFunc *format_probes[] = {
parallels_probe,
qcow_probe,
qcow2_probe,
+ bdrv_qed_probe,
};
static QTAILQ_HEAD(, BlockDriverState) graph_bdrv_states =
@@ -3,16 +3,22 @@
#include "block/probe.h"
#include "block/qed.h"
-int bdrv_qed_probe(const uint8_t *buf, int buf_size,
- const char *filename)
+const char *bdrv_qed_probe(const uint8_t *buf, int buf_size,
+ const char *filename, int *score)
{
+ const char *format = "qed";
const QEDHeader *header = (const QEDHeader *)buf;
+ assert(score);
+ *score = 0;
if (buf_size < sizeof(*header)) {
- return 0;
+ return format;
}
+
if (le32_to_cpu(header->magic) != QED_MAGIC) {
- return 0;
+ return format;
}
- return 100;
+
+ *score = 100;
+ return format;
}
@@ -1638,7 +1638,6 @@ static BlockDriver bdrv_qed = {
.create_opts = &qed_create_opts,
.supports_backing = true,
- .bdrv_probe = bdrv_qed_probe,
.bdrv_open = bdrv_qed_open,
.bdrv_close = bdrv_qed_close,
.bdrv_reopen_prepare = bdrv_qed_reopen_prepare,
@@ -1,7 +1,6 @@
#ifndef PROBE_H
#define PROBE_H
-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);
@@ -21,5 +20,7 @@ const char *qcow_probe(const uint8_t *buf, int buf_size, const char *filename,
int *score);
const char *qcow2_probe(const uint8_t *buf, int buf_size, const char *filename,
int *score);
+const char *bdrv_qed_probe(const uint8_t *buf, int buf_size,
+ const char *filename, int *score);
#endif
Completes the separation of the qed probe from the qed driver. The qed probe now returns the format in addition to the score, allowing correlation of the score and driver without the probe function being part of the driver itself. Signed-off-by: Colin Lord <clord@redhat.com> --- block.c | 1 + block/probe/qed.c | 16 +++++++++++----- block/qed.c | 1 - include/block/probe.h | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-)