Am 16.08.2013 15:18, schrieb arm...@redhat.com: > From: Markus Armbruster <arm...@redhat.com> > > I'd like to access QEMUMachine from a QEMUMachine init() method, which > is currently not possible. Instead of passing it as an argument, I > simply set current_machine earlier.
We had such a patch for CPU hot-add and decided against doing this. Currently current_machine != signals that it has been initialized. And generally we have been trying to get away from accessing globals from random parts of code. Can't you pass either QEMUMachine or the specific fields needed from PC code to those SMBIOS functions? You did add a bool argument. Andreas > > Signed-off-by: Markus Armbruster <arm...@redhat.com> > Reviewed-by: Eric Blake <ebl...@redhat.com> > --- > vl.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/vl.c b/vl.c > index ba3084c..258e164 100644 > --- a/vl.c > +++ b/vl.c > @@ -3897,6 +3897,7 @@ int main(int argc, char **argv, char **envp) > fprintf(stderr, "No machine found.\n"); > exit(1); > } > + current_machine = machine; > > if (machine->hw_version) { > qemu_set_version(machine->hw_version); > @@ -4325,8 +4326,6 @@ int main(int argc, char **argv, char **envp) > > set_numa_modes(); > > - current_machine = machine; > - > /* init USB devices */ > if (usb_enabled(false)) { > if (foreach_device_config(DEV_USB, usb_parse) < 0) > -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg