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