All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: James Bottomley <jejb@linux.ibm.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel@nongnu.org, "Stefan Berger" <stefanb@linux.ibm.com>
Subject: Re: [PATCH] tpm: add backend for mssim
Date: Wed, 14 Dec 2022 15:17:17 +0100	[thread overview]
Message-ID: <87a63qgjde.fsf@pond.sub.org> (raw)
In-Reply-To: <5a91ffbd8fa01d8f60df4cc14bcc53eeb3cc93e4.camel@linux.ibm.com> (James Bottomley's message of "Wed, 14 Dec 2022 07:47:28 -0500")

James Bottomley <jejb@linux.ibm.com> writes:

> On Wed, 2022-12-14 at 11:31 +0000, Daniel P. Berrangé wrote:

[...]

>> These days, we have a policy of not tyring to map nested data onto
>> the flat QemuOpts. This has been done in several areas and we've
>> ended up with a mess of ever so slightly different impls each with
>> their own flaws. This is why our preferred approach these days is to
>> add support for JSON syntax to enable non-flat config.
>
> Well, OK, but I've got to say on behalf of shell script writers
> everywhere that using json for command line arguments is a textbook
> definition of cruel and unusual punishment.

For new code, use qobject_input_visitor_new_str().  Parses both JSON and
dotted keys.  Example: case QEMU_OPTION_blockdev in qemu_init().  Dotted
keys can fall apart for corner cases.  See util/keyval.c if you're
curious.

Sometimes we bend over backwards for backward compatibility, and do
something like

    if (optarg[0] == '{') {
        QObject *obj = qobject_from_json(optarg, &error_fatal);

        v = qobject_input_visitor_new(obj);
        qobject_unref(obj);
    } else {
        ... old parser ...
    }

This parses both JSON and whatever old crap.  Example:
object_option_parse().

Questions?



      reply	other threads:[~2022-12-14 15:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-10 17:10 [PATCH] tpm: add backend for mssim James Bottomley
2022-12-12 13:43 ` Stefan Berger
2022-12-12 13:59   ` James Bottomley
2022-12-12 14:27     ` Stefan Berger
2022-12-12 14:32       ` James Bottomley
2022-12-12 14:44         ` Stefan Berger
2022-12-12 14:47           ` James Bottomley
2022-12-12 15:20             ` Stefan Berger
2022-12-12 15:28               ` James Bottomley
2022-12-12 15:46                 ` Stefan Berger
2022-12-12 15:47 ` Daniel P. Berrangé
2022-12-12 16:38   ` James Bottomley
2022-12-12 16:59     ` Stefan Berger
2022-12-12 18:48       ` James Bottomley
2022-12-12 18:58         ` Stefan Berger
2022-12-12 19:12           ` James Bottomley
2022-12-12 19:32             ` Stefan Berger
2022-12-12 20:24               ` Stefan Berger
2022-12-12 21:36               ` James Bottomley
2022-12-12 22:02                 ` Stefan Berger
2022-12-12 22:27                   ` James Bottomley
2022-12-12 22:43                     ` Stefan Berger
2022-12-14 11:52                   ` Daniel P. Berrangé
2022-12-14 12:43                     ` James Bottomley
2022-12-15  2:42                       ` Stefan Berger
2022-12-14 11:55           ` Daniel P. Berrangé
2022-12-12 22:06   ` James Bottomley
2022-12-14 11:31     ` Daniel P. Berrangé
2022-12-14 12:47       ` James Bottomley
2022-12-14 14:17         ` Markus Armbruster [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=87a63qgjde.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=jejb@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.