Gerd Hoffmann <kra...@redhat.com> writes: > On 11/25/09 23:31, H. Peter Anvin wrote: >> On 11/25/2009 02:26 PM, H. Peter Anvin wrote: >>> >>> As such, I think there is still a place for the simple command line >>> options like "-hda", "-serial" and my proposed "-debugcon", in addition >>> to the full-featured connect-anything options and configuration files. >>> That's all. >>> >> >> I guess one question is if the simplified options could be better >> implemented via some kind of builtin macros or translation submodule >> rather than being treated as first-class options which they basically >> are now. Still, that's a future development task. > > Wouldn't be that hard I think. Something along the lines of > > case QEMU_OPTION_debugcon: > opts = qemu_chr_parse_compat("debugcon", optarg); > if (NULL == opts) { > fprintf(stderr, "already have a debugcon chardev\"); > exit(1); > } > opts = qemu_opts_create(&qemu_device_opts, "debugcon", 1); > if (NULL == opts) { > fprintf(stderr, "already have a debugcon device\"); > exit(1); > } > qemu_opt_set(opts, "driver", isa-debugcon); > qemu_opt_set(opts, "chardev", "debugcon"); > break; > > should do the trick. Depends on the chardev fix mentioned in this > thread too. Allows to define a single device with the default port > via shortcut.
There's precedence for this method to implement convenience options; look for uses of qemu_opts_create() / qemu_opt_set(). Expanding the convenience option into longhand that way saves code and avoids subtle differences between the two. Just avoid NULL == opts kraxelism ;) [...]