qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 04/23] block: Connect BlockBackend and DriveI


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 04/23] block: Connect BlockBackend and DriveInfo
Date: Tue, 16 Sep 2014 15:51:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Benoît Canet <address@hidden> writes:

>> +DriveInfo *blk_legacy_dinfo(BlockBackend *blk)
>> +{
>> +    return blk->legacy_dinfo;
>> +}
>> +
>> +/*
>> + * Set @blk's DriveInfo to @dinfo, and return it.
>> + * @blk must not have a DriveInfo set already.
>
>> + * No other BlockBackend may have the same DriveInfo set.
> Must we try to assert this ?
> This would require an extra linked list traversal but I don't think it's a
> performance path anyway.

Must, no.  We could.

However, the obvious

    assert(!blk_by_legacy_dinfo(dinfo);

doesn't work, because blk_by_legacy_dinfo() asserts it returns a
non-null value.  Either we sacrifice that assertion, or we duplicate the
search loop here (yuck), or we factor it out into a helper function.  I
don't particularly like either of the three.  But if you guys really
want the precondition checked, I'll check it.

> Reviewed-by: Benoît Canet <address@hidden>

Thanks!



reply via email to

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