On 3 August 2015 at 04:09, Fam Zheng <f...@redhat.com> wrote: > bdrv_probe_all is harder. If we modularize a format driver, its .bdrv_probe > code will be in the module. If we want to do the format detection, we need to > load all format drivers. This means if the command line has an unspecified > format, we'll still need to load all drivers at starting phase. (I wish all > formats are probed according to magic bytes at offset 0, so we can simplify > the > .bdrv_probe logic and do it with data matching in block.c like the protocol > case, but that's not true for VMDK :( )
If you wanted, you could have a might_be_format_foo() function which gives its best guess at whether a file is of that format, erring on the side of saying 'yes'. (So for VMDK you just always say 'yes', for ones where you can conveniently match you do the match test, and so on.) Then you can use that to decide whether to load the module for the format or not. So you'd end up still loading modules for formats that aren't trivially probed for, but you could avoid loading most of them. -- PMM