[libvirt] [PATCH 5/7] virnetdevbandwidth.c: Separate tc filter creation to a function

Laine Stump laine at laine.org
Mon Apr 20 21:31:32 UTC 2015


On 04/17/2015 04:51 AM, Michal Privoznik wrote:
> On 16.04.2015 19:25, Laine Stump wrote:
>> On 04/14/2015 12:59 PM, Michal Privoznik wrote:
>>> Not only this simplifies the code a bit, it prepares the
>>> environment for upcoming patches. The new
>>> virNetDevBandwidthManipulateFilter() function is capable of both
>>> removing a filter and adding a new one. At the same time! Yeah,
>>> this is not currently used anywhere but look at the next commit
>>> + *
>>> + * Returns: 0 on success,
>>> + *         -1 otherwise (with error reported).
>>> + */
>>> +static int ATTRIBUTE_NONNULL(1)
>>> +virNetDevBandwidthManipulateFilter(const char *ifname,
>>> +                                   const virMacAddr *ifmac_ptr,
>>> +                                   unsigned int id,
>>> +                                   const char *class_id,
>>> +                                   bool remove_old,
>>> +                                   bool create_new)
>> How about making these two flags so that it will be easier to tell
>> what's intended when looking at a call to the function?
> I was thinking about this too, but then I went with booleans. My idea
> was that it's shorter this way than inventing new enum items like
> VIR_NET_DEV_BANDWIDTH_FILTER_CREATE or
> VIR_NET_DEV_BANDWIDTH_FILTER_REMOVE. But if somebody prefers the other
> way, I can switch to that.

I'm fine if you want to keep it as booleans, too.




More information about the libvir-list mailing list