vl.c: remove duplicate call to qemu_get_machine_opts
PATCH 1/1 vl.c: remove duplicate call to qemu_get_machine_opts
Also we can use current machine properties instead of querying machine's opts.
--- vl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
vl.c +4 -5
@@ -4353,11 +4353,10 @@ int main(int argc, char **argv, char **envp)qtest_init (qtest_chrdev, qtest_log, &error_fatal); } - machine_opts =qemu_get_machine_opts (); - kernel_filename =qemu_opt_get (machine_opts,"kernel" ); - initrd_filename =qemu_opt_get (machine_opts,"initrd" ); - kernel_cmdline =qemu_opt_get (machine_opts,"append" ); - bios_name =qemu_opt_get (machine_opts,"firmware" ); + kernel_filename = current_machine->kernel_filename; + initrd_filename = current_machine->initrd_filename; + kernel_cmdline = current_machine->kernel_cmdline; + bios_name = current_machine->firmware; opts =qemu_opts_find (qemu_find_opts ("boot-opts" ),NULL );if (opts) {
Signature · 1 line
2.4.3
Quoted 1 line · Marcel Apfelbaum
Also we can use current machine properties instead of querying machine's opts.
Why? :) For me at least, you'll have to spell it out.
Thanks
Laszlo
Quoted 17 lines
Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)vl.c +0
-2@@ -4353,11 +4353,10 @@ int main(int argc, char **argv, char **envp)qtest_init (qtest_chrdev, qtest_log, &error_fatal); } - machine_opts =qemu_get_machine_opts (); - kernel_filename =qemu_opt_get (machine_opts,"kernel" );
vl.c int main(int argc, char **argv, char **envp) · line 4362
Quoted 10 lines
vl.c +4
-3- initrd_filename =qemu_opt_get (machine_opts,"initrd" ); - kernel_cmdline =qemu_opt_get (machine_opts,"append" ); - bios_name =qemu_opt_get (machine_opts,"firmware" ); + kernel_filename = current_machine->kernel_filename; + initrd_filename = current_machine->initrd_filename; + kernel_cmdline = current_machine->kernel_cmdline; + bios_name = current_machine->firmware; opts =qemu_opts_find (qemu_find_opts ("boot-opts" ),NULL );if (opts) {
Thanks
Laszlo
Quoted 4 lines · Laszlo Ersek
Quoted 1 line · Marcel Apfelbaum
Also we can use current machine properties instead of querying machine's opts.
Why? :) For me at least, you'll have to spell it out.
The theory would be that is cleaner to call an object property than use a string (when possible); compiler helps and so on...
object->prop vs find_me_prop("prop")
Since all machine properties have already been set with the command line options we really have no need to use them anymore and we can favor the machine.
Thanks,
Marcel
Quoted 35 lines
Thanks
LaszloQuoted 17 lines
Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)vl.c +0
-2@@ -4353,11 +4353,10 @@ int main(int argc, char **argv, char **envp)qtest_init (qtest_chrdev, qtest_log, &error_fatal); } - machine_opts =qemu_get_machine_opts (); - kernel_filename =qemu_opt_get (machine_opts,"kernel" );vl.c int main(int argc, char **argv, char **envp) · line 4362
Quoted 10 lines
vl.c +4
-3- initrd_filename =qemu_opt_get (machine_opts,"initrd" ); - kernel_cmdline =qemu_opt_get (machine_opts,"append" ); - bios_name =qemu_opt_get (machine_opts,"firmware" ); + kernel_filename = current_machine->kernel_filename; + initrd_filename = current_machine->initrd_filename; + kernel_cmdline = current_machine->kernel_cmdline; + bios_name = current_machine->firmware; opts =qemu_opts_find (qemu_find_opts ("boot-opts" ),NULL );if (opts) {Thanks
Laszlo
Quoted 11 lines · Marcel Apfelbaum
Quoted 5 lines · Laszlo Ersek
Quoted 2 lines · Marcel Apfelbaum
Also we can use current machine properties instead of querying machine's opts.
Why? :) For me at least, you'll have to spell it out.
The theory would be that is cleaner to call an object property than use a string
(when possible); compiler helps and so on...
Quoted 5 lines
object->propvsfind_me_prop("prop")Since all machine properties have already been set with the command line options
we really have no need to use them anymore and we can favor the machine.
Yes; what I meant is, where exactly have these properties been set?
Thanks
Laszlo
Quoted 31 lines
Quoted 30 lines
Quoted 16 lines
Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)vl.c +0
-2@@ -4353,11 +4353,10 @@ int main(int argc, char **argv, char **envp)qtest_init (qtest_chrdev, qtest_log, &error_fatal); } - machine_opts =qemu_get_machine_opts (); - kernel_filename =qemu_opt_get (machine_opts,"kernel" );vl.c int main(int argc, char **argv, char **envp) · line 4362
Quoted 10 lines
vl.c +4
-3- initrd_filename =qemu_opt_get (machine_opts,"initrd" ); - kernel_cmdline =qemu_opt_get (machine_opts,"append" ); - bios_name =qemu_opt_get (machine_opts,"firmware" ); + kernel_filename = current_machine->kernel_filename; + initrd_filename = current_machine->initrd_filename; + kernel_cmdline = current_machine->kernel_cmdline; + bios_name = current_machine->firmware; opts =qemu_opts_find (qemu_find_opts ("boot-opts" ),NULL );if (opts) {Thanks
Laszlo
Quoted 12 lines · Laszlo Ersek
Quoted 11 lines · Marcel Apfelbaum
Quoted 5 lines · Laszlo Ersek
Quoted 2 lines · Marcel Apfelbaum
Also we can use current machine properties instead of querying machine's opts.
Why? :) For me at least, you'll have to spell it out.
The theory would be that is cleaner to call an object property than use a string
(when possible); compiler helps and so on...
Quoted 8 lines
Quoted 5 lines
object->prop vs find_me_prop("prop")Since all machine properties have already been set with the command line options
we really have no need to use them anymore and we can favor the machine.Yes; what I meant is, where exactly have these properties been set?
I didn't get it so I followed a theoretical line, sorry :)
A few lines before:
if (qemu_opt_foreach(qemu_get_machine_opts(), machine_set_property,
current_machine, NULL)) {
object_unref(OBJECT(current_machine));
exit(1);
}Thanks,
Marcel
Quoted 35 lines
Thanks
LaszloQuoted 31 lines
Quoted 30 lines
Quoted 16 lines
Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)vl.c +0
-2@@ -4353,11 +4353,10 @@ int main(int argc, char **argv, char **envp)qtest_init (qtest_chrdev, qtest_log, &error_fatal); } - machine_opts =qemu_get_machine_opts (); - kernel_filename =qemu_opt_get (machine_opts,"kernel" );vl.c int main(int argc, char **argv, char **envp) · line 4362
Quoted 10 lines
vl.c +4
-3- initrd_filename =qemu_opt_get (machine_opts,"initrd" ); - kernel_cmdline =qemu_opt_get (machine_opts,"append" ); - bios_name =qemu_opt_get (machine_opts,"firmware" ); + kernel_filename = current_machine->kernel_filename; + initrd_filename = current_machine->initrd_filename; + kernel_cmdline = current_machine->kernel_cmdline; + bios_name = current_machine->firmware; opts =qemu_opts_find (qemu_find_opts ("boot-opts" ),NULL );if (opts) {Thanks
Laszlo
Laszlo Ersek
Reviewed-byQuoted 24 lines · Marcel Apfelbaum
Quoted 12 lines · Laszlo Ersek
Quoted 11 lines · Marcel Apfelbaum
Quoted 5 lines · Laszlo Ersek
Quoted 2 lines · Marcel Apfelbaum
Also we can use current machine properties instead of querying machine's opts.
Why? :) For me at least, you'll have to spell it out.
The theory would be that is cleaner to call an object property than use a string
(when possible); compiler helps and so on...Quoted 8 lines
Quoted 5 lines
object->prop vs find_me_prop("prop")Since all machine properties have already been set with the command line options
we really have no need to use them anymore and we can favor the machine.Yes; what I meant is, where exactly have these properties been set?
I didn't get it so I followed a theoretical line, sorry :)
Quoted 7 lines
A few lines before:
if (qemu_opt_foreach(qemu_get_machine_opts(), machine_set_property, current_machine, NULL)) { object_unref(OBJECT(current_machine)); exit(1); }
Ah, right, the things I missed in that were:
- the object_property_parse() call
- machine_initfn() in "hw/core/machine.c", and the setters it sets up.
FWIW,
Thanks
Laszlo
Quoted 33 lines
Quoted 32 lines
Quoted 31 lines
Quoted 30 lines
Quoted 16 lines
Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)vl.c +0
-2@@ -4353,11 +4353,10 @@ int main(int argc, char **argv, char **envp)qtest_init (qtest_chrdev, qtest_log, &error_fatal); } - machine_opts =qemu_get_machine_opts (); - kernel_filename =qemu_opt_get (machine_opts,"kernel" );vl.c int main(int argc, char **argv, char **envp) · line 4362
Quoted 10 lines
vl.c +4
-3- initrd_filename =qemu_opt_get (machine_opts,"initrd" ); - kernel_cmdline =qemu_opt_get (machine_opts,"append" ); - bios_name =qemu_opt_get (machine_opts,"firmware" ); + kernel_filename = current_machine->kernel_filename; + initrd_filename = current_machine->initrd_filename; + kernel_cmdline = current_machine->kernel_cmdline; + bios_name = current_machine->firmware; opts =qemu_opts_find (qemu_find_opts ("boot-opts" ),NULL );if (opts) {Thanks
Laszlo
Quoted 33 lines · Laszlo Ersek
Quoted 24 lines · Marcel Apfelbaum
Quoted 12 lines · Laszlo Ersek
Quoted 11 lines · Marcel Apfelbaum
Quoted 5 lines · Laszlo Ersek
Quoted 2 lines · Marcel Apfelbaum
Also we can use current machine properties instead of querying machine's opts.
Why? :) For me at least, you'll have to spell it out.
The theory would be that is cleaner to call an object property than use a string
(when possible); compiler helps and so on...Quoted 8 lines
Quoted 5 lines
object->prop vs find_me_prop("prop")Since all machine properties have already been set with the command line options
we really have no need to use them anymore and we can favor the machine.Yes; what I meant is, where exactly have these properties been set?
I didn't get it so I followed a theoretical line, sorry :)
Quoted 7 lines
A few lines before:
if (qemu_opt_foreach(qemu_get_machine_opts(), machine_set_property, current_machine, NULL)) { object_unref(OBJECT(current_machine)); exit(1); }
Quoted 7 lines
Ah, right, the things I missed in that were:
- theobject_property_parse()call
-machine_initfn()in "hw/core/machine.c", and the setters it sets up.FWIW,
Reviewed-by Laszlo Ersek <[email protected]>
Appreciated!
Note for the maintainer, there is a V2 of this patch on the mailing list:
https://www.mail-archive.com/[email protected]/msg351565.html
Thanks,
Marcel
Quoted 39 lines
Thanks
LaszloQuoted 33 lines
Quoted 32 lines
Quoted 31 lines
Quoted 30 lines
Quoted 16 lines
Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)vl.c +0
-2@@ -4353,11 +4353,10 @@ int main(int argc, char **argv, char **envp)qtest_init (qtest_chrdev, qtest_log, &error_fatal); } - machine_opts =qemu_get_machine_opts (); - kernel_filename =qemu_opt_get (machine_opts,"kernel" );vl.c int main(int argc, char **argv, char **envp) · line 4362
Quoted 10 lines
vl.c +4
-3- initrd_filename =qemu_opt_get (machine_opts,"initrd" ); - kernel_cmdline =qemu_opt_get (machine_opts,"append" ); - bios_name =qemu_opt_get (machine_opts,"firmware" ); + kernel_filename = current_machine->kernel_filename; + initrd_filename = current_machine->initrd_filename; + kernel_cmdline = current_machine->kernel_cmdline; + bios_name = current_machine->firmware; opts =qemu_opts_find (qemu_find_opts ("boot-opts" ),NULL );if (opts) {Thanks
Laszlo