[ovs-dev] [PATCH] coverage: Make thread-safe.

Alex Wang alexw at nicira.com
Tue Aug 20 21:48:57 UTC 2013


I found the answer from this thread:
http://openvswitch.org/pipermail/dev/2011-May/008608.html



On Tue, Aug 20, 2013 at 2:02 PM, Alex Wang <alexw at nicira.com> wrote:

> May I ask, what rule is this?
>
> Should we always declare global variable before defining it? or just when
> it is enclosed by macros?
>
> Also, when the "!USE_LINKER_SECTIONS", we should modify the coverage.c the
> same way. I'll send out a patch,
>
>
> On Tue, Aug 20, 2013 at 1:44 PM, Ben Pfaff <blp at nicira.com> wrote:
>
>> On Mon, Aug 19, 2013 at 12:32:06PM -0700, Alex Wang wrote:
>> > Just noticed, when compiling with sparse, it issues the warnings like:
>> >
>> > """
>> > lib/netdev-linux.c:76:1: warning: symbol 'counter_netdev_set_policing'
>> was
>> > not declared. Should it be static?
>> > lib/netdev-linux.c:77:1: warning: symbol 'counter_netdev_arp_lookup' was
>> > not declared. Should it be static?
>> > lib/netdev-linux.c:78:1: warning: symbol 'counter_netdev_get_ifindex'
>> was
>> > not declared. Should it be static?
>> > """
>>
>> Ouch, thanks, I folded in this incremental to fix that:
>>
>> diff --git a/lib/coverage.h b/lib/coverage.h
>> index 73b027a..3d1a115 100644
>> --- a/lib/coverage.h
>> +++ b/lib/coverage.h
>> @@ -54,6 +54,7 @@ struct coverage_counter {
>>          {                                                               \
>>              *counter_##COUNTER##_get() += n;                            \
>>          }                                                               \
>> +        extern struct coverage_counter counter_##COUNTER;               \
>>          struct coverage_counter counter_##COUNTER                       \
>>              = { #COUNTER, COUNTER##_count, 0 };                         \
>>          extern struct coverage_counter *counter_ptr_##COUNTER;          \
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20130820/2f1ebb10/attachment-0003.html>


More information about the dev mailing list