On 05.07.2016 17:24, Colin Lord wrote: > This commit finalizes the separation of the block driver and probe > function by removing the .bdrv_probe field from all BlockDrivers. > Probing is now accomplished solely by iterating over the array of probe > function pointers in the format_probes array. > > Signed-off-by: Colin Lord > --- > block.c | 20 +------------------- > block/raw-posix.c | 1 - > include/block/block_int.h | 1 - > scripts/modules/module_block.py | 10 ++-------- > 4 files changed, 3 insertions(+), 29 deletions(-) > > diff --git a/block.c b/block.c > index 8226124..7e441fe 100644 > --- a/block.c > +++ b/block.c > @@ -599,34 +599,16 @@ BlockDriver *bdrv_probe_all(const uint8_t *buf, int buf_size, > const char *format_max = NULL; > const char *format; > size_t i; > - BlockDriver *drv = NULL, *d; > - > - for (i = 0; i < ARRAY_SIZE(block_driver_modules); ++i) { > - if (block_driver_modules[i].has_probe) { > - block_module_load_one(block_driver_modules[i].library_name); > - } > - } > - > - QLIST_FOREACH(d, &bdrv_drivers, list) { > - if (d->bdrv_probe) { > - score = d->bdrv_probe(buf, buf_size, filename); > - if (score > score_max) { > - score_max = score; > - drv = d; > - } > - } > - } > > for (i = 0; i < ARRAY_SIZE(format_probes); i++) { > format = format_probes[i](buf, buf_size, filename, &score); > if (score > score_max) { > score_max = score; > format_max = format; > - drv = bdrv_find_format(format_max); > } > } > > - return drv; > + return bdrv_find_format(format_max); OK, so you move that function call here. Then, I'd at least like to see a comment in patch 17 that you are going to do this later (like "TODO: Move this call outside of this loop"). For this patch, however: Reviewed-by: Max Reitz > } > > static int find_image_format(BlockDriverState *bs, const char *filename,