qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v10 5/6] fsdev: QMP interface for throttling


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v10 5/6] fsdev: QMP interface for throttling
Date: Fri, 08 Sep 2017 14:51:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Alberto Garcia <address@hidden> writes:

> On Fri 08 Sep 2017 12:02:14 PM CEST, Markus Armbruster wrote:
>
>>> +    fse = get_fsdev_fsentry(arg->has_id ? arg->id : NULL);
>>
>> !arg->has_id implies !arg->id.
>
> Hey Markus,
>
> I have the impression that I've also written code that never uses
> arg->foo when arg->has_foo is false.
>
> Can we then assume that to be NULL/0 in all cases? Also for other data
> types (int, bool, ...)?

QAPI code always passes zero FOOs along with false has_FOOs.  Anything
that doesn't is a bug.  This is particular important when FOO is a
pointer; we don't want to pass around pointers pointing to random junk
in the hope that everybody will obediently check their has_FOO before
dereferencing.

Other code might not always be as well-behaved.  In random context,
checking has_FOO is probably safer.

I still want to eliminate has_FOO for pointer-valued FOO.  So much to
do, so little time!



reply via email to

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