[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 07/32] blockdev: Move dmg probe to its own file
From: |
Colin Lord |
Subject: |
[Qemu-devel] [PATCH v3 07/32] blockdev: Move dmg probe to its own file |
Date: |
Tue, 5 Jul 2016 11:24:07 -0400 |
Isolate dmg probe as part of the modularization process.
Signed-off-by: Colin Lord <address@hidden>
---
block/Makefile.objs | 2 +-
block/dmg.c | 16 +---------------
block/probe/dmg.c | 17 +++++++++++++++++
include/block/probe.h | 1 +
4 files changed, 20 insertions(+), 16 deletions(-)
create mode 100644 block/probe/dmg.c
diff --git a/block/Makefile.objs b/block/Makefile.objs
index 28a7ec3..1d744eb 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -24,7 +24,7 @@ block-obj-y += accounting.o dirty-bitmap.o
block-obj-y += write-threshold.o
block-obj-y += crypto.o
-block-obj-y += probe/bochs.o probe/cloop.o probe/luks.o
+block-obj-y += probe/bochs.o probe/cloop.o probe/luks.o probe/dmg.o
common-obj-y += stream.o
common-obj-y += commit.o
diff --git a/block/dmg.c b/block/dmg.c
index 06eb513..2c70687 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -25,6 +25,7 @@
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
+#include "block/probe.h"
#include "qemu/bswap.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
@@ -66,21 +67,6 @@ typedef struct BDRVDMGState {
#endif
} BDRVDMGState;
-static int dmg_probe(const uint8_t *buf, int buf_size, const char *filename)
-{
- int len;
-
- if (!filename) {
- return 0;
- }
-
- len = strlen(filename);
- if (len > 4 && !strcmp(filename + len - 4, ".dmg")) {
- return 2;
- }
- return 0;
-}
-
static int read_uint64(BlockDriverState *bs, int64_t offset, uint64_t *result)
{
uint64_t buffer;
diff --git a/block/probe/dmg.c b/block/probe/dmg.c
new file mode 100644
index 0000000..a40281b
--- /dev/null
+++ b/block/probe/dmg.c
@@ -0,0 +1,17 @@
+#include "qemu/osdep.h"
+#include "block/probe.h"
+
+int dmg_probe(const uint8_t *buf, int buf_size, const char *filename)
+{
+ int len;
+
+ if (!filename) {
+ return 0;
+ }
+
+ len = strlen(filename);
+ if (len > 4 && !strcmp(filename + len - 4, ".dmg")) {
+ return 2;
+ }
+ return 0;
+}
diff --git a/include/block/probe.h b/include/block/probe.h
index 35a8d00..267431d 100644
--- a/include/block/probe.h
+++ b/include/block/probe.h
@@ -5,5 +5,6 @@ int bochs_probe(const uint8_t *buf, int buf_size, const char
*filename);
int cloop_probe(const uint8_t *buf, int buf_size, const char *filename);
int block_crypto_probe_luks(const uint8_t *buf, int buf_size,
const char *filename);
+int dmg_probe(const uint8_t *buf, int buf_size, const char *filename);
#endif
--
2.5.5
- [Qemu-devel] [PATCH v3 03/32] blockdev: Add dynamic module loading for block drivers, (continued)
- [Qemu-devel] [PATCH v3 03/32] blockdev: Add dynamic module loading for block drivers, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 01/32] blockdev: prepare iSCSI block driver for dynamic loading, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 12/32] blockdev: Move raw probe to its own file, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 10/32] blockdev: Move qcow2 probe to its own file, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 09/32] blockdev: Move qcow probe to its own file, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 07/32] blockdev: Move dmg probe to its own file,
Colin Lord <=
- [Qemu-devel] [PATCH v3 08/32] blockdev: Move parallels probe to its own file, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 02/32] blockdev: Add dynamic generation of module_block.h, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 20/32] blockdev: Separate dmg probe from its driver, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 15/32] blockdev: Move vmdk probe to its own file, Colin Lord, 2016/07/05