[libvirt] [PATCH] Use camelCase for XML attribute numQueues

Laine Stump laine at laine.org
Mon Apr 22 14:13:30 UTC 2013


On 04/22/2013 06:58 AM, Daniel Veillard wrote:
> On Thu, Apr 18, 2013 at 08:27:56AM -0600, Eric Blake wrote:
>> On 04/18/2013 03:02 AM, Martin Kletzander wrote:
>>> In commit d4bf0a9, we used num_queues for an attribute in the XML, but
>>> the consensus is that we use camelCase for that.  Since there was no
>>> release yet (the above commit describes as v1.0.4-65-gd4bf0a9), we
>>> still have time to change it.
>> You may want to wait for DV's opinion on naming, but I wasn't aware that
>> we had a consensus on camelCase.  In fact, '_' is currently winning,
>> although it's hard to say whether that is limited to older interfaces.
>   Hum, I don't think I ever suggested such rules at the XML level.
> We have that convention for code, as eric pointed out it is not as clear
> for XML (and unfortunately we can't hamonize at this point without
> quite a bit of churn - we would have to support the old syntax forever
> anyway).

Yeah, I don't think there's anything to gain (and lots to lose!) from
changing attributes that have already been in a release. And I think I
first heard about dislike of underscore in XML from danpb (and
incorrectly extrapolated that to you:
https://www.redhat.com/archives/libvir-list/2013-April/msg01359.html).

Of course in this case, we *could* avoid the camelCase vs underscore
entirely by just naming the attribute "queues" instead of numQueues or
num_queues (the fact that the attribute is a number makes it pretty
obvious that it is the "number of queues").

Since I first noticed the name, I'm actually more concerned that the
attribute is in the toplevel of <controller> rather than in a <driver>
subelement. It's true that this would be the first <driver> item under
<controller>, but more backend-specific tuning attributes may follow,
and it would be good to have them all collected together in the same
place. Since I've already brought this up in another thread (same
message as referenced above), I'll drop this if there's no response, but
does anyone else have an opinion about that?


>   I don't have a strong opinion on _ vs. camelcase for markup,
> I guess the exact same arguments can be raised pros/cons on visibility
> and existing use :-\
>
>   Seems Eric is rather adverse to _ which was looking like the winner,
> I dislike '-' myself as it is used for comments, and very uncommon
> in identifiers in XML (well it's barred from being in an identifier
> in most language).
>
>   If Eric really can't stand '_' then maybe the simplest is really
> to start standardizing on camelCase,

I don't have a preference either, but think that we should (as much as
possible) try to stick with one or the other, at least for new
attributes. A decision followed by a written rule in HACKING would be a
good way to make that happen.





More information about the libvir-list mailing list