On 06.07.2016 16:19, Max Reitz wrote: > On 05.07.2016 17:24, Colin Lord wrote: >> This puts the bochs probe function into its own separate file as part of >> the process of modularizing block drivers. Having the probe functions >> separate from the rest of the driver allows us to probe without having >> to potentially unnecessarily load the driver. >> >> Signed-off-by: Colin Lord >> --- >> block/Makefile.objs | 1 + >> block/bochs.c | 55 ++------------------------------------------ >> block/probe/bochs.c | 21 +++++++++++++++++ >> include/block/driver/bochs.h | 40 ++++++++++++++++++++++++++++++++ >> include/block/probe.h | 6 +++++ >> 5 files changed, 70 insertions(+), 53 deletions(-) >> create mode 100644 block/probe/bochs.c >> create mode 100644 include/block/driver/bochs.h >> create mode 100644 include/block/probe.h >> > > [...] > >> diff --git a/block/probe/bochs.c b/block/probe/bochs.c >> new file mode 100644 >> index 0000000..8adc09f >> --- /dev/null >> +++ b/block/probe/bochs.c >> @@ -0,0 +1,21 @@ >> +#include "qemu/osdep.h" >> +#include "block/block_int.h" >> +#include "block/probe.h" >> +#include "block/driver/bochs.h" >> + >> +int bochs_probe(const uint8_t *buf, int buf_size, const char *filename) >> +{ >> + const struct bochs_header *bochs = (const void *)buf; >> + >> + if (buf_size < HEADER_SIZE) >> + return 0; >> + >> + if (!strcmp(bochs->magic, HEADER_MAGIC) && >> + !strcmp(bochs->type, REDOLOG_TYPE) && >> + !strcmp(bochs->subtype, GROWING_TYPE) && >> + ((le32_to_cpu(bochs->version) == HEADER_VERSION) || >> + (le32_to_cpu(bochs->version) == HEADER_V1))) >> + return 100; >> + >> + return 0; >> +} > > Not sure what to do about the coding style here. Some people prefer code > movement to be pure, but I feel bad about doing code movement and then > leaving the code wrongly formatted. That is, in my opinion, every patch > should pass checkpatch.pl (but I won't object to a patch that doesn't > pass checkpatch.pl simply because of pre-existing code). I've just seen that you indeed fix this later in this series. That's good enough for me. Max