On Thu, Apr 21, 2022 at 02:27:55PM -0500, Eric Blake wrote: > On Thu, Apr 21, 2022 at 06:50:48PM +0200, Dirk Müller wrote: > > Change --help output for aio option to only list the aio backend options > > that > > are actually available. io_uring is an optional, linux only backend > > option so hide it for cases where it isn't there. > > As pointed out by Dan, this commit message is not quite accurate. It > hides only one of the two conditional options, but 'native' is also a > Linux-only optional backend (CONFIG_LINUX_AIO).
Stepping back a bit - we already said that making --help machine-parseable is a non-goal, and so the intent of this patch is for human readers. But adding an #ifdef ladder to show all 4 possible combinations gets hairy; adding another option turns it into 8 combinations. Is there a better way? What if we just document ALL strings possible in at least one build (no #ifdef ladder in the help text), but add --aio=help as a way to do a runtime list of which aio modes are understood by THIS build? It would match how we have --device=help for qemu proper, and may even be able to reuse some of that framework code (for parsing out when help is requested). Yes, that would be a bigger patch, but it may also be easier to maintain down the road. And even though there is an #ifdef ladder at runtime, it only has O(n) growth rather than O(n^2) for each possible combination of which options are enabled, and would appear only once in the runtime rather than duplicated across each place which documents similar help text across multiple utilities. > > > > > Reviewed-by: Eric Blake <ebl...@redhat.com> > > Signed-off-by: Dirk Müller <dmuel...@suse.de> > > --- > > block/file-posix.c | 4 ++++ > > qemu-nbd.c | 4 ++++ > > qemu-options.hx | 6 +++++- > > 3 files changed, 13 insertions(+), 1 deletion(-) > > -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org