smbios: convert to use QemuOpts
PATCH 1/1 smbios: convert to use QemuOpts
--- arch_init.c | 10 +++++----- arch_init.h | 2 +- hw/smbios.c | 53 +++++++++++++++++++++++++++++++---------------------- hw/smbios.h | 2 +- qemu-config.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ vl.c | 4 +++- 6 files changed, 91 insertions(+), 30 deletions(-)
arch_init.c +5 -5
@@ -1033,13 +1033,13 @@ void do_acpitable_option(const char *optarg)#endif } -void do_smbios_option (const char *optarg) +int do_smbios_option (QemuOpts *opts,void *opaque) {#ifdef TARGET_I386 -if (smbios_entry_add (optarg) <0 ) { -fprintf (stderr,"Wrong smbios provided\n" ); -exit (1 ); - } +return smbios_entry_add (opts); +#else +fprintf (stderr,"-smbios option not supported on this platform\n" ); +return -ENOSYS ;#endif }
arch_init.h +1 -1
@@ -26,7 +26,7 @@ extern const uint32_t arch_type;void select_soundhw (const char *optarg);void do_acpitable_option (const char *optarg); -void do_smbios_option (const char *optarg); +int do_smbios_option (QemuOpts *opts,void *opaque);void cpudef_init (void );int audio_available (void );void audio_init (ISABus *isa_bus,PCIBus *pci_bus);
hw/smbios.c +31 -22
114 lines not on this page · raw message
hw/smbios.h +1 -1
@@ -13,7 +13,7 @@* */ -int smbios_entry_add (const char *t); +int smbios_entry_add (QemuOpts *opts);void smbios_add_field (int type,int offset,int len,void *data);uint8_t *smbios_get_table (size_t *length);
qemu-config.c +50 -0
62 lines not on this page · raw message
vl.c +3 -1
@@ -3050,7 +3050,7 @@ int main(int argc, char **argv, char **envp)do_acpitable_option (optarg);break ;case QEMU_OPTION_smbios: -do_smbios_option (optarg); + opts =qemu_opts_parse (qemu_find_opts ("smbios" ), optarg,1 );break ;case QEMU_OPTION_enable_kvm: olist =qemu_find_opts ("machine" );
@@ -3368,6 +3368,8 @@ int main(int argc, char **argv, char **envp)exit (1 ); } +qemu_opts_foreach (qemu_find_opts ("smbios" ), do_smbios_option,NULL ,0 ); +/* * Get the default machine options from the machine if it is not already * specified either by the configuration file or by the command line.
Signature · 1 line
1.7.5.4
Il 05/09/2012 21:52, Anthony Liguori ha scritto:
Quoted 264 lines
Signed-off-by Anthony Liguori <[email protected]>--- arch_init.c | 10 +++++----- arch_init.h | 2 +- hw/smbios.c | 53 +++++++++++++++++++++++++++++++---------------------- hw/smbios.h | 2 +- qemu-config.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ vl.c | 4 +++- 6 files changed, 91 insertions(+), 30 deletions(-)arch_init.c +5
-5@@ -1033,13 +1033,13 @@ void do_acpitable_option(const char *optarg)#endif } -void do_smbios_option (const char *optarg) +int do_smbios_option (QemuOpts *opts,void *opaque) {#ifdef TARGET_I386 -if (smbios_entry_add (optarg) <0 ) { -fprintf (stderr,"Wrong smbios provided\n" ); -exit (1 ); - } +return smbios_entry_add (opts); +#else +fprintf (stderr,"-smbios option not supported on this platform\n" ); +return -ENOSYS ;#endif }arch_init.h +1
-1@@ -26,7 +26,7 @@ extern const uint32_t arch_type;void select_soundhw (const char *optarg);void do_acpitable_option (const char *optarg); -void do_smbios_option (const char *optarg); +int do_smbios_option (QemuOpts *opts,void *opaque);void cpudef_init (void );int audio_available (void );void audio_init (ISABus *isa_bus,PCIBus *pci_bus);hw/smbios.c +31
-22@@ -124,21 +124,24 @@ void smbios_add_field(int type, int offset, int len, void *data)cpu_to_le16 (le16_to_cpu (*(uint16_t *)smbios_entries) +1 ); } -static void smbios_build_type_0_fields (const char *t) +static void smbios_build_type_0_fields (QemuOpts *opts) {char buf[1024 ]; -if (get_param_value (buf,sizeof (buf),"vendor" , t)) +if ((buf =qemu_opt_get (opts,"vendor" ))) {smbios_add_field (0 , offsetof(struct smbios_type_0 , vendor_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"version" , t)) + } +if ((buf =qemu_opt_get (opts,"version" ))) {smbios_add_field (0 , offsetof(struct smbios_type_0 , bios_version_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"date" , t)) + } +if ((buf =qemu_opt_get (opts,"date" ))) {smbios_add_field (0 , offsetof(struct smbios_type_0 , bios_release_date_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"release" , t)) { + } +if ((buf =qemu_opt_get (opts,"release" ))) {int major, minor;sscanf (buf,"%d.%d" , &major, &minor); smbios_add_field(0, offsetof(struct smbios_type_0,@@ -148,41 +151,47 @@ static void smbios_build_type_0_fields(const char *t) } } -static void smbios_build_type_1_fields (const char *t) +static void smbios_build_type_1_fields (QemuOpts *opts) { -char buf[1024 ]; +const char *buf; -if (get_param_value (buf,sizeof (buf),"manufacturer" , t)) +if ((buf =qemu_opt_get (opts,"manufacturer" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , manufacturer_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"product" , t)) + } +if ((buf =qemu_opt_get (opts,"product" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , product_name_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"version" , t)) + } +if ((buf =qemu_opt_get (opts,"version" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , version_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"serial" , t)) + } +if ((buf =qemu_opt_get (opts,"serial" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , serial_number_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"uuid" , t)) { + } +if ((buf =qemu_opt_get (opts,"uuid" ))) {if (qemu_uuid_parse (buf, qemu_uuid) !=0 ) {fprintf (stderr,"Invalid SMBIOS UUID string\n" );exit (1 ); } } -if (get_param_value (buf,sizeof (buf),"sku" , t)) +if ((buf =qemu_opt_get (opts,"sku" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , sku_number_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"family" , t)) + } +if ((buf =qemu_opt_get (opts,"family" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , family_str),strlen (buf) +1 , buf); + } } -int smbios_entry_add (const char *t) +int smbios_entry_add (QemuOpts *opts) { -char buf[1024 ]; +const char *buf; -if (get_param_value (buf,sizeof (buf),"file" , t)) { +if ((buf =qemu_opt_get (opts,"file" ))) {struct smbios_structure_header *header;struct smbios_table *table;int size =get_image_size (buf);@@ -203,7 +212,7 @@ int smbios_entry_add(const char *t) table->header.type =SMBIOS_TABLE_ENTRY ; table->header.length =cpu_to_le16 (sizeof (*table) + size); -if (load_image (buf, table->data) != size) { +if (load_image (filename, table->data) != size) {fprintf (stderr,"Failed to load smbios file %s" , buf);exit (1 ); }@@ -220,14 +229,14 @@ int smbios_entry_add(const char *t)return 0 ; } -if (get_param_value (buf,sizeof (buf),"type" , t)) { -unsigned long type =strtoul (buf,NULL ,0 ); +if (qemu_opt_get (opts,"type" )) { +unsigned long type =qemu_opt_get_number (opts,"type" );switch (type) {case 0 : -smbios_build_type_0_fields (t); +smbios_build_type_0_fields (opts);return 0 ;case 1 : -smbios_build_type_1_fields (t); +smbios_build_type_1_fields (opts);return 0 ;default : fprintf(stderr, "Don't know how to build fields for SMBIOS type "hw/smbios.h +1
-1@@ -13,7 +13,7 @@* */ -int smbios_entry_add (const char *t); +int smbios_entry_add (QemuOpts *opts);void smbios_add_field (int type,int offset,int len,void *data);uint8_t *smbios_get_table (size_t *length);qemu-config.c +50
-0@@ -643,6 +643,55 @@ QemuOptsList qemu_boot_opts = { }, }; +QemuOptsList qemu_smbios_opts = { + .name ="smbios" , + .head =QTAILQ_HEAD_INITIALIZER (qemu_smbios_opts.head), + .desc = { + { + .name ="file" , + .type =QEMU_OPT_STRING , + }, { + .name ="type" , + .type =QEMU_OPT_NUMBER , + }, { + .name ="manufacturer" , + .type =QEMU_OPT_STRING , + }, { + .name ="product" , + .type =QEMU_OPT_STRING , + }, { + .name ="version" , + .type =QEMU_OPT_STRING , + }, { + .name ="serial" , + .type =QEMU_OPT_STRING , + }, { + .name ="uuid" , + .type =QEMU_OPT_STRING , + }, { + .name ="sku" , + .type =QEMU_OPT_STRING , + }, { + .name ="family" , + .type =QEMU_OPT_STRING , + }, { + .name ="vendor" , + .type =QEMU_OPT_STRING , + }, { + .name ="version" , + .type =QEMU_OPT_STRING , + }, { + .name ="date" , + .type =QEMU_OPT_STRING , + }, { + .name ="release" , + .type =QEMU_OPT_STRING , + }, { +/* End of list */ + } + }, +}; +static QemuOptsList *vm_config_groups[32 ] = { &qemu_drive_opts, &qemu_chardev_opts,@@ -659,6 +708,7 @@ static QemuOptsList *vm_config_groups[32] = { &qemu_boot_opts, &qemu_iscsi_opts, &qemu_sandbox_opts, + &qemu_smbios_opts, NULL, };vl.c +1
-1@@ -3050,7 +3050,7 @@ int main(int argc, char **argv, char **envp)do_acpitable_option (optarg);break ;case QEMU_OPTION_smbios: -do_smbios_option (optarg); + opts =qemu_opts_parse (qemu_find_opts ("smbios" ), optarg,1 );break ;case QEMU_OPTION_enable_kvm: olist =qemu_find_opts ("machine" );
vl.c int main(int argc, char **argv, char **envp) · line 3375
Quoted 8 lines
vl.c +2
-0@@ -3368,6 +3368,8 @@ int main(int argc, char **argv, char **envp)exit (1 ); } +qemu_opts_foreach (qemu_find_opts ("smbios" ), do_smbios_option,NULL ,0 ); +/* * Get the default machine options from the machine if it is not already * specified either by the configuration file or by the command line.
Looks good.
Paolo
Hello, this is your friendly remote compile service.
Quoted 51 lines · Anthony Liguori
Signed-off-by Anthony Liguori <[email protected]>--- arch_init.c | 10 +++++----- arch_init.h | 2 +- hw/smbios.c | 53 +++++++++++++++++++++++++++++++---------------------- hw/smbios.h | 2 +- qemu-config.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ vl.c | 4 +++- 6 files changed, 91 insertions(+), 30 deletions(-)arch_init.c +5
-5@@ -1033,13 +1033,13 @@ void do_acpitable_option(const char *optarg)#endif } -void do_smbios_option (const char *optarg) +int do_smbios_option (QemuOpts *opts,void *opaque) {#ifdef TARGET_I386 -if (smbios_entry_add (optarg) <0 ) { -fprintf (stderr,"Wrong smbios provided\n" ); -exit (1 ); - } +return smbios_entry_add (opts); +#else +fprintf (stderr,"-smbios option not supported on this platform\n" ); +return -ENOSYS ;#endif }arch_init.h +1
-1@@ -26,7 +26,7 @@ extern const uint32_t arch_type;void select_soundhw (const char *optarg);void do_acpitable_option (const char *optarg); -void do_smbios_option (const char *optarg); +int do_smbios_option (QemuOpts *opts,void *opaque);void cpudef_init (void );int audio_available (void );void audio_init (ISABus *isa_bus,PCIBus *pci_bus);hw/smbios.c +0
-0
hw/smbios.c void smbios_add_field(int type, int offset, int len, void *data) · line 131
Quoted 10 lines
hw/smbios.c +2
-2@@ -124,21 +124,24 @@ void smbios_add_field(int type, int offset, int len, void *data)cpu_to_le16 (le16_to_cpu (*(uint16_t *)smbios_entries) +1 ); } -static void smbios_build_type_0_fields (const char *t) +static void smbios_build_type_0_fields (QemuOpts *opts) {char buf[1024 ]; -if (get_param_value (buf,sizeof (buf),"vendor" , t)) +if ((buf =qemu_opt_get (opts,"vendor" ))) {
error: incompatible types when assigning to type ‘char[1024]’ from type ‘const char *’
Quoted 21 lines
hw/smbios.c +6
-3smbios_add_field (0 , offsetof(struct smbios_type_0 , vendor_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"version" , t)) + } +if ((buf =qemu_opt_get (opts,"version" ))) {smbios_add_field (0 , offsetof(struct smbios_type_0 , bios_version_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"date" , t)) + } +if ((buf =qemu_opt_get (opts,"date" ))) {smbios_add_field (0 , offsetof(struct smbios_type_0 , bios_release_date_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"release" , t)) { + } +if ((buf =qemu_opt_get (opts,"release" ))) {int major, minor;sscanf (buf,"%d.%d" , &major, &minor); smbios_add_field(0, offsetof(struct smbios_type_0,@@ -148,41 +151,47 @@ static void smbios_build_type_0_fields(const char *t) }
hw/smbios.c static void smbios_build_type_0_fields(const char *t) · line 158
Quoted 10 lines
hw/smbios.c +3
-3} -static void smbios_build_type_1_fields (const char *t) +static void smbios_build_type_1_fields (QemuOpts *opts) { -char buf[1024 ]; +const char *buf; -if (get_param_value (buf,sizeof (buf),"manufacturer" , t)) +if ((buf =qemu_opt_get (opts,"manufacturer" ))) {
warning: passing argument 4 of ‘smbios_add_field’ discards ‘const’ qualifier from pointer target type [enabled by default]
Quoted 49 lines
hw/smbios.c +15
-9smbios_add_field (1 , offsetof(struct smbios_type_1 , manufacturer_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"product" , t)) + } +if ((buf =qemu_opt_get (opts,"product" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , product_name_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"version" , t)) + } +if ((buf =qemu_opt_get (opts,"version" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , version_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"serial" , t)) + } +if ((buf =qemu_opt_get (opts,"serial" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , serial_number_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"uuid" , t)) { + } +if ((buf =qemu_opt_get (opts,"uuid" ))) {if (qemu_uuid_parse (buf, qemu_uuid) !=0 ) {fprintf (stderr,"Invalid SMBIOS UUID string\n" );exit (1 ); } } -if (get_param_value (buf,sizeof (buf),"sku" , t)) +if ((buf =qemu_opt_get (opts,"sku" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , sku_number_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"family" , t)) + } +if ((buf =qemu_opt_get (opts,"family" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , family_str),strlen (buf) +1 , buf); + } } -int smbios_entry_add (const char *t) +int smbios_entry_add (QemuOpts *opts) { -char buf[1024 ]; +const char *buf; -if (get_param_value (buf,sizeof (buf),"file" , t)) { +if ((buf =qemu_opt_get (opts,"file" ))) {struct smbios_structure_header *header;struct smbios_table *table;int size =get_image_size (buf);
hw/smbios.c int smbios_entry_add(const char *t) · line 215
Quoted 5 lines
hw/smbios.c +1
-1@@ -203,7 +212,7 @@ int smbios_entry_add(const char *t) table->header.type =SMBIOS_TABLE_ENTRY ; table->header.length =cpu_to_le16 (sizeof (*table) + size); -if (load_image (buf, table->data) != size) { +if (load_image (filename, table->data) != size) {
error: ‘filename’ undeclared (first use in this function)
hw/smbios.c int smbios_entry_add(const char *t) · line 233
Quoted 11 lines
hw/smbios.c +2
-2fprintf (stderr,"Failed to load smbios file %s" , buf);exit (1 ); }@@ -220,14 +229,14 @@ int smbios_entry_add(const char *t)return 0 ; } -if (get_param_value (buf,sizeof (buf),"type" , t)) { -unsigned long type =strtoul (buf,NULL ,0 ); +if (qemu_opt_get (opts,"type" )) { +unsigned long type =qemu_opt_get_number (opts,"type" );
error: too few arguments to function ‘qemu_opt_get_number’
Quoted 11 lines
hw/smbios.c +2
-2switch (type) {case 0 : -smbios_build_type_0_fields (t); +smbios_build_type_0_fields (opts);return 0 ;case 1 : -smbios_build_type_1_fields (t); +smbios_build_type_1_fields (opts);return 0 ;default : fprintf(stderr, "Don't know how to build fields for SMBIOS type "
[...]
Quoted 1 line · Markus Armbruster
Hello, this is your friendly remote compile service.
dirty tree + git-send-email == FAIL
Sorry for the noise. At any rate, I've abandoned this patch and picked up Paolo's tree. I'll post the full series this afternoon. I'm still playing around with some additional cleanup.
https://github.com/aliguori/qemu/tree/qemuopts.2
Regards,
Anthony Liguori
Quoted 185 lines
Quoted 51 lines · Anthony Liguori
Signed-off-by Anthony Liguori <[email protected]>--- arch_init.c | 10 +++++----- arch_init.h | 2 +- hw/smbios.c | 53 +++++++++++++++++++++++++++++++---------------------- hw/smbios.h | 2 +- qemu-config.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ vl.c | 4 +++- 6 files changed, 91 insertions(+), 30 deletions(-)arch_init.c +5
-5@@ -1033,13 +1033,13 @@ void do_acpitable_option(const char *optarg)#endif } -void do_smbios_option (const char *optarg) +int do_smbios_option (QemuOpts *opts,void *opaque) {#ifdef TARGET_I386 -if (smbios_entry_add (optarg) <0 ) { -fprintf (stderr,"Wrong smbios provided\n" ); -exit (1 ); - } +return smbios_entry_add (opts); +#else +fprintf (stderr,"-smbios option not supported on this platform\n" ); +return -ENOSYS ;#endif }arch_init.h +1
-1@@ -26,7 +26,7 @@ extern const uint32_t arch_type;void select_soundhw (const char *optarg);void do_acpitable_option (const char *optarg); -void do_smbios_option (const char *optarg); +int do_smbios_option (QemuOpts *opts,void *opaque);void cpudef_init (void );int audio_available (void );void audio_init (ISABus *isa_bus,PCIBus *pci_bus);hw/smbios.c +0
-0hw/smbios.c void smbios_add_field(int type, int offset, int len, void *data) · line 131
Quoted 10 lines
hw/smbios.c +2
-2@@ -124,21 +124,24 @@ void smbios_add_field(int type, int offset, int len, void *data)cpu_to_le16 (le16_to_cpu (*(uint16_t *)smbios_entries) +1 ); } -static void smbios_build_type_0_fields (const char *t) +static void smbios_build_type_0_fields (QemuOpts *opts) {char buf[1024 ]; -if (get_param_value (buf,sizeof (buf),"vendor" , t)) +if ((buf =qemu_opt_get (opts,"vendor" ))) {error: incompatible types when assigning to type ‘char[1024]’ from type ‘const char *’
Quoted 21 lines
hw/smbios.c +6
-3smbios_add_field (0 , offsetof(struct smbios_type_0 , vendor_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"version" , t)) + } +if ((buf =qemu_opt_get (opts,"version" ))) {smbios_add_field (0 , offsetof(struct smbios_type_0 , bios_version_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"date" , t)) + } +if ((buf =qemu_opt_get (opts,"date" ))) {smbios_add_field (0 , offsetof(struct smbios_type_0 , bios_release_date_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"release" , t)) { + } +if ((buf =qemu_opt_get (opts,"release" ))) {int major, minor;sscanf (buf,"%d.%d" , &major, &minor); smbios_add_field(0, offsetof(struct smbios_type_0,@@ -148,41 +151,47 @@ static void smbios_build_type_0_fields(const char *t) }hw/smbios.c static void smbios_build_type_0_fields(const char *t) · line 158
Quoted 10 lines
hw/smbios.c +3
-3} -static void smbios_build_type_1_fields (const char *t) +static void smbios_build_type_1_fields (QemuOpts *opts) { -char buf[1024 ]; +const char *buf; -if (get_param_value (buf,sizeof (buf),"manufacturer" , t)) +if ((buf =qemu_opt_get (opts,"manufacturer" ))) {warning: passing argument 4 of ‘smbios_add_field’ discards ‘const’ qualifier from pointer target type [enabled by default]
Quoted 49 lines
hw/smbios.c +15
-9smbios_add_field (1 , offsetof(struct smbios_type_1 , manufacturer_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"product" , t)) + } +if ((buf =qemu_opt_get (opts,"product" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , product_name_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"version" , t)) + } +if ((buf =qemu_opt_get (opts,"version" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , version_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"serial" , t)) + } +if ((buf =qemu_opt_get (opts,"serial" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , serial_number_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"uuid" , t)) { + } +if ((buf =qemu_opt_get (opts,"uuid" ))) {if (qemu_uuid_parse (buf, qemu_uuid) !=0 ) {fprintf (stderr,"Invalid SMBIOS UUID string\n" );exit (1 ); } } -if (get_param_value (buf,sizeof (buf),"sku" , t)) +if ((buf =qemu_opt_get (opts,"sku" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , sku_number_str),strlen (buf) +1 , buf); -if (get_param_value (buf,sizeof (buf),"family" , t)) + } +if ((buf =qemu_opt_get (opts,"family" ))) {smbios_add_field (1 , offsetof(struct smbios_type_1 , family_str),strlen (buf) +1 , buf); + } } -int smbios_entry_add (const char *t) +int smbios_entry_add (QemuOpts *opts) { -char buf[1024 ]; +const char *buf; -if (get_param_value (buf,sizeof (buf),"file" , t)) { +if ((buf =qemu_opt_get (opts,"file" ))) {struct smbios_structure_header *header;struct smbios_table *table;int size =get_image_size (buf);hw/smbios.c int smbios_entry_add(const char *t) · line 215
Quoted 5 lines
hw/smbios.c +1
-1@@ -203,7 +212,7 @@ int smbios_entry_add(const char *t) table->header.type =SMBIOS_TABLE_ENTRY ; table->header.length =cpu_to_le16 (sizeof (*table) + size); -if (load_image (buf, table->data) != size) { +if (load_image (filename, table->data) != size) {error: ‘filename’ undeclared (first use in this function)
hw/smbios.c int smbios_entry_add(const char *t) · line 233
Quoted 11 lines
hw/smbios.c +2
-2fprintf (stderr,"Failed to load smbios file %s" , buf);exit (1 ); }@@ -220,14 +229,14 @@ int smbios_entry_add(const char *t)return 0 ; } -if (get_param_value (buf,sizeof (buf),"type" , t)) { -unsigned long type =strtoul (buf,NULL ,0 ); +if (qemu_opt_get (opts,"type" )) { +unsigned long type =qemu_opt_get_number (opts,"type" );error: too few arguments to function ‘qemu_opt_get_number’
Quoted 11 lines
hw/smbios.c +2
-2switch (type) {case 0 : -smbios_build_type_0_fields (t); +smbios_build_type_0_fields (opts);return 0 ;case 1 : -smbios_build_type_1_fields (t); +smbios_build_type_1_fields (opts);return 0 ;default : fprintf(stderr, "Don't know how to build fields for SMBIOS type "[...]