qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Valluri, Amarnath" <amarnath.valluri@intel.com>,
	"marcandre.lureau@gmail.com" <marcandre.lureau@gmail.com>
Cc: "stefanb@linux.vnet.ibm.com" <stefanb@linux.vnet.ibm.com>,
	"dgilbert@redhat.com" <dgilbert@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"armbru@redhat.com" <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v7 8/8] tpm: Added support for TPM emulator
Date: Tue, 26 Sep 2017 08:59:33 -0500	[thread overview]
Message-ID: <d0ae0926-cf82-2ce7-39e2-d17d6db70d68@redhat.com> (raw)
In-Reply-To: <1506427596.5843.104.camel@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]

On 09/26/2017 07:05 AM, Valluri, Amarnath wrote:

>>> +
>>> +#define DPRINT(fmt, ...) do { \
>>> +    if (DEBUG_TPM) { \
>>> +        fprintf(stderr, fmt, ## __VA_ARGS__); \
>>> +    } \
>>> +} while (0);

Do not include the trailing ';' directly in the macro definition. The
whole point of wrapping things in a do{}while(0) is so that you can do:

if (foo)
    DPRINT(...);
else
    ...

(of course, that violates our coding style, as we require {} everywhere,
but it makes your macro appropriate for copying and pasting to other
projects that have different styles).


>>> +    ret = qio_channel_read(tpm_pt->data_ioc, (char *)out, out_len,
>>> &err);
>>> +    if (ret < 0 || err) {
>> read_all() ?
> The issue with read_all() is it does not return the no of bytes it
> read, so i would like to stict to _read()

But you KNOW the number of bytes read if read_all() succeeded - it read
as many bytes as you requested!

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

  parent reply	other threads:[~2017-09-26 13:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 12:33 [Qemu-devel] [PATCH v7 0/8] Provide support for the software TPM emulator Amarnath Valluri
2017-09-22 12:33 ` [Qemu-devel] [PATCH v7 1/8] tpm-backend: Remove unneeded member variable from backend class Amarnath Valluri
2017-09-22 12:33 ` [Qemu-devel] [PATCH v7 2/8] tpm-backend: Move thread handling inside TPMBackend Amarnath Valluri
2017-09-22 12:33 ` [Qemu-devel] [PATCH v7 3/8] tpm-backend: Initialize and free data members in it's own methods Amarnath Valluri
2017-09-22 12:33 ` [Qemu-devel] [PATCH v7 4/8] tpm-backend: Made few interface methods optional Amarnath Valluri
2017-09-27 12:23   ` [Qemu-devel] [PATCH v8 " Amarnath Valluri
2017-09-22 12:33 ` [Qemu-devel] [PATCH v7 5/8] tmp backend: Add new api to read backend TpmInfo Amarnath Valluri
2017-09-22 15:35   ` Marc-André Lureau
2017-09-25 12:01     ` Valluri, Amarnath
2017-09-27 12:16     ` [Qemu-devel] [PATCH v8 " Amarnath Valluri
2017-09-22 12:33 ` [Qemu-devel] [PATCH v7 6/8] tpm-backend: Move realloc_buffer() implementation to tpm-tis model Amarnath Valluri
2017-09-22 12:33 ` [Qemu-devel] [PATCH v7 7/8] tpm-passthrough: move reusable code to utils Amarnath Valluri
2017-09-22 12:33 ` [Qemu-devel] [PATCH v7 8/8] tpm: Added support for TPM emulator Amarnath Valluri
2017-09-22 16:23   ` Stefan Berger
2017-09-24 18:52   ` Marc-André Lureau
2017-09-25  0:35     ` Stefan Berger
2017-09-26 12:05     ` Valluri, Amarnath
2017-09-26 12:24       ` Marc-André Lureau
2017-09-26 13:28         ` Valluri, Amarnath
2017-09-26 13:55           ` Marc-André Lureau
2017-09-26 13:59       ` Eric Blake [this message]
2017-09-27 12:18     ` [Qemu-devel] [PATCH v8 " Amarnath Valluri
2017-09-27 14:18       ` Marc-André Lureau

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=d0ae0926-cf82-2ce7-39e2-d17d6db70d68@redhat.com \
    --to=eblake@redhat.com \
    --cc=amarnath.valluri@intel.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.vnet.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 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).