From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Alistair Francis" <alistair.francis@xilinx.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Eric Blake" <eblake@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
qemu-devel@nongnu.org,
"Edgar E . Iglesias" <edgar.iglesias@xilinx.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH v2 2/4] libqos: add a sdbus API
Date: Fri, 5 Jan 2018 15:18:34 +0000 [thread overview]
Message-ID: <20180105151834.GD28322@stefanha-x1.localdomain> (raw)
In-Reply-To: <20180103214925.16677-3-f4bug@amsat.org>
[-- Attachment #1: Type: text/plain, Size: 1767 bytes --]
On Wed, Jan 03, 2018 at 06:49:23PM -0300, Philippe Mathieu-Daudé wrote:
> +typedef struct SDBusAdapter SDBusAdapter;
> +struct SDBusAdapter {
> +
> + ssize_t (*do_command)(SDBusAdapter *adapter, enum NCmd cmd, uint32_t arg,
> + uint8_t **response);
> + void (*write_byte)(SDBusAdapter *adapter, uint8_t value);
> + uint8_t (*read_byte)(SDBusAdapter *adapter);
> +};
Is it necessary to expose the struct definition? qmp_sdbus_create()
allocates this struct so the caller cannot embed it anyway and does not
need to know sizeof.
> +
> +ssize_t sdbus_do_cmd(SDBusAdapter *adapter, enum NCmd cmd, uint32_t arg,
> + uint8_t **response);
> +ssize_t sdbus_do_acmd(SDBusAdapter *adapter, enum ACmd acmd, uint32_t arg,
> + uint16_t address, uint8_t **response);
> +void sdbus_write_byte(SDBusAdapter *adapter, uint8_t value);
> +uint8_t sdbus_read_byte(SDBusAdapter *adapter);
> +
> +SDBusAdapter *qmp_sdbus_create(const char *bus_name);
Does this function belong in another patch?
> +static bool verbose;
> +#define DPRINTF(fmt, ...) \
> + do { \
> + if (verbose) { \
I suggest using if (getenv("V")) directly and removing the verbose
global. The verbose global is error-prone because it requires that the
caller first initializes it.
> +ssize_t sdbus_do_acmd(SDBusAdapter *adapter, enum ACmd acmd, uint32_t arg,
> + uint16_t address, uint8_t **response)
> +{
> + do_cmd(adapter, 55, address << 16, NULL, false);
> + // TODO check rv?
Even if there is no actual error handling, g_assert_...() could be used
here.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
next prev parent reply other threads:[~2018-01-05 15:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-03 21:49 [Qemu-devel] [RFC PATCH v2 0/4] sdbus: testing sdcards Philippe Mathieu-Daudé
2018-01-03 21:49 ` [Qemu-devel] [PATCH v2 1/4] sdbus: add a QMP command to access a SDBus Philippe Mathieu-Daudé
2018-01-05 15:11 ` Stefan Hajnoczi
2018-01-05 15:29 ` Eric Blake
2018-01-05 16:06 ` Philippe Mathieu-Daudé
2018-01-05 16:10 ` Eric Blake
2018-01-05 21:28 ` Philippe Mathieu-Daudé
2019-03-08 16:11 ` Philippe Mathieu-Daudé
2019-03-11 11:49 ` Thomas Huth
2019-03-11 13:43 ` Eduardo Habkost
2019-03-11 13:48 ` Peter Maydell
2019-03-11 15:52 ` Markus Armbruster
2018-01-03 21:49 ` [Qemu-devel] [RFC PATCH v2 2/4] libqos: add a sdbus API Philippe Mathieu-Daudé
2018-01-05 15:18 ` Stefan Hajnoczi [this message]
2018-01-03 21:49 ` [Qemu-devel] [RFC PATCH v2 3/4] libqos: implement sdbus QMP driver Philippe Mathieu-Daudé
2018-01-05 15:25 ` Stefan Hajnoczi
2018-01-03 21:49 ` [Qemu-devel] [RFC PATCH v2 4/4] tests: add some sdcard qtest Philippe Mathieu-Daudé
2018-01-05 15:31 ` Stefan Hajnoczi
2018-01-05 15:55 ` Philippe Mathieu-Daudé
2018-01-08 14:32 ` Stefan Hajnoczi
2018-01-03 22:17 ` [Qemu-devel] [RFC PATCH v2 0/4] sdbus: testing sdcards no-reply
2018-01-05 15:32 ` Stefan Hajnoczi
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=20180105151834.GD28322@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=alistair.francis@xilinx.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=edgar.iglesias@xilinx.com \
--cc=f4bug@amsat.org \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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 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).