qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v7 8/8] tpm: Added support for TPM emulator


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v7 8/8] tpm: Added support for TPM emulator
Date: Tue, 26 Sep 2017 08:59:33 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]