From: Anthony Liguori <aliguori@us.ibm.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] smbios: convert to use QemuOpts
Date: Fri, 07 Sep 2012 08:02:13 -0500 [thread overview]
Message-ID: <87ligmhtpm.fsf@codemonkey.ws> (raw)
In-Reply-To: <87zk52nxhy.fsf@blackfin.pond.sub.org>
Markus Armbruster <armbru@redhat.com> writes:
> 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
>
> Anthony Liguori <aliguori@us.ibm.com> writes:
>
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>> ---
>> 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(-)
>>
>> diff --git a/arch_init.c b/arch_init.c
>> index 5a1173e..e43ace9 100644
>> --- a/arch_init.c
>> +++ b/arch_init.c
>> @@ -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
>> }
>>
>> diff --git a/arch_init.h b/arch_init.h
>> index d9c572a..2dce578 100644
>> --- a/arch_init.h
>> +++ b/arch_init.h
>> @@ -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);
>> diff --git a/hw/smbios.c b/hw/smbios.c
>> index c57237d..095bccc 100644
>> --- a/hw/smbios.c
>> +++ b/hw/smbios.c
>> @@ -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 *’
>
>> 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"))) {
>
> warning: passing argument 4 of ‘smbios_add_field’ discards ‘const’ qualifier from pointer target type [enabled by default]
>
>> 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) {
>
> error: ‘filename’ undeclared (first use in this function)
>
>> 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");
>
> error: too few arguments to function ‘qemu_opt_get_number’
>
>> 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 "
> [...]
prev parent reply other threads:[~2012-09-07 13:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 19:52 [Qemu-devel] [PATCH] smbios: convert to use QemuOpts Anthony Liguori
2012-09-06 13:18 ` Paolo Bonzini
2012-09-07 6:43 ` Markus Armbruster
2012-09-07 13:02 ` Anthony Liguori [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ligmhtpm.fsf@codemonkey.ws \
--to=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).