On 05.07.2016 17:24, Colin Lord wrote: > Isolates qcow2 probe as part of the modularization process. > > Signed-off-by: Colin Lord > --- > block/Makefile.objs | 2 +- > block/probe/qcow2.c | 16 ++++++++++++++++ > block/qcow2.c | 13 +------------ > include/block/probe.h | 1 + > 4 files changed, 19 insertions(+), 13 deletions(-) > create mode 100644 block/probe/qcow2.c Reviewed-by: Max Reitz > diff --git a/block/probe/qcow2.c b/block/probe/qcow2.c > new file mode 100644 > index 0000000..56f4e82 > --- /dev/null > +++ b/block/probe/qcow2.c > @@ -0,0 +1,16 @@ > +#include "qemu/osdep.h" > +#include "block/block_int.h" > +#include "block/probe.h" > +#include "block/qcow2.h" > + > +int qcow2_probe(const uint8_t *buf, int buf_size, const char *filename) > +{ > + const QCowHeader *cow_header = (const void *)buf; > + > + if (buf_size >= sizeof(QCowHeader) && > + be32_to_cpu(cow_header->magic) == QCOW_MAGIC && > + be32_to_cpu(cow_header->version) >= 2) > + return 100; > + else > + return 0; ...aaand even more of this... > +}