On 05.07.2016 17:24, Colin Lord wrote: > Isolate dmg probe as part of the modularization process. > > Signed-off-by: Colin Lord > --- > 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 Reviewed-by: Max Reitz [...] > 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")) { Reading this probing code makes me feel all funny inside. :-) > + return 2; > + } > + return 0; > +}