qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 06/13] block: Add block-specific QDict header


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH 06/13] block: Add block-specific QDict header
Date: Fri, 11 May 2018 20:11:24 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 2018-05-10 16:54, Eric Blake wrote:
> On 05/09/2018 11:55 AM, Max Reitz wrote:
>> There are numerous QDict functions that have been introduced for and are
>> used only by the block layer.  Move their declarations into an own
> 
> s/an own/their own/
> 
>> header file to reflect that.
>>
>> While qdict_extract_subqdict() is in fact used outside of the block
>> layer (in util/qemu-config.c), it is still a function related very
>> closely to how the block layer works with nested QDicts, namely by
>> sometimes flattening them.  Therefore, its declaration is put into this
>> header as well and util/qemu-config.c includes it with a comment stating
>> exactly which function it needs.
>>
>> Suggested-by: Markus Armbruster <address@hidden>
>> Signed-off-by: Max Reitz <address@hidden>
>> ---
> 
>> +++ b/include/block/qdict.h
>> @@ -0,0 +1,35 @@
>> +/*
>> + * Special QDict functions used by the block layer
>> + *
>> + * Copyright (c) 2018 Red Hat, Inc.
> 
> You are extracting this from qdict.h which has:
>  * Copyright (C) 2009 Red Hat Inc.
> 
> Is it worth listing 2009-2018, instead of just this year?

I don't know, is it?  I don't know whether it makes a real difference.

>> +
>> +void qdict_copy_default(QDict *dst, QDict *src, const char *key);
>> +void qdict_set_default_str(QDict *dst, const char *key, const char
>> *val);
> 
> These two might be useful outside of the block layer; we can move them
> back in a later patch if so.  But for now, I agree with your choice of
> moving them.
> 
>> +
>> +void qdict_join(QDict *dest, QDict *src, bool overwrite);
> 
> This is borderline whether it would be useful outside of the block layer.

I decided I wanted to move the *_default* functions, and if I did that,
I would have to move this one as well.  I decided I can't be biased just
because I wrote this one. :-)

But in general I'd say if anyone wants to use any of these functions
outside of the block layer, they are welcome to move them back to the
main header, provided they have a good reason to do so.  I suppose a
good reason for using qdict_join() may indeed turn up sooner or later.

Max

>> +
>> +void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start);
>> +void qdict_array_split(QDict *src, QList **dst);
>> +int qdict_array_entries(QDict *src, const char *subqdict);
>> +QObject *qdict_crumple(const QDict *src, Error **errp);
>> +void qdict_flatten(QDict *qdict);
> 
> And these are definitely hacks that the block layer relies on, where
> hopefully someday long term we can rewrite the block layer to use QAPI
> types directly instead of constant reconversion between QemuOpts and
> QDict and QAPI types.
> 
> Reviewed-by: Eric Blake <address@hidden>
> 


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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