Acked-by: Andy Zhou <az...@nicira.com>
On Tue, Mar 11, 2014 at 1:56 PM, Ben Pfaff <b...@nicira.com> wrote: > Every implementation used this same code, so it makes sense to centralize > it. > > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > lib/automake.mk | 1 - > lib/ovs-atomic-c11.h | 1 - > lib/ovs-atomic-clang.h | 1 - > lib/ovs-atomic-gcc4+.h | 1 - > lib/ovs-atomic-gcc4.7+.h | 1 - > lib/ovs-atomic-pthreads.h | 1 - > lib/ovs-atomic-types.h | 47 > --------------------------------------------- > lib/ovs-atomic.h | 42 +++++++++++++++++++++++++++++++++++++++- > 8 files changed, 41 insertions(+), 54 deletions(-) > delete mode 100644 lib/ovs-atomic-types.h > > diff --git a/lib/automake.mk b/lib/automake.mk > index 6ed40f6..cc04633 100644 > --- a/lib/automake.mk > +++ b/lib/automake.mk > @@ -139,7 +139,6 @@ lib_libopenvswitch_la_SOURCES = \ > lib/ovs-atomic-locked.c \ > lib/ovs-atomic-locked.h \ > lib/ovs-atomic-pthreads.h \ > - lib/ovs-atomic-types.h \ > lib/ovs-atomic.h \ > lib/ovs-thread.c \ > lib/ovs-thread.h \ > diff --git a/lib/ovs-atomic-c11.h b/lib/ovs-atomic-c11.h > index 96aec7c..946d412 100644 > --- a/lib/ovs-atomic-c11.h > +++ b/lib/ovs-atomic-c11.h > @@ -24,7 +24,6 @@ > > #define OMIT_STANDARD_ATOMIC_TYPES 1 > #define ATOMIC(TYPE) _Atomic(TYPE) > -#include "ovs-atomic-types.h" > > #define atomic_read(SRC, DST) \ > atomic_read_explicit(SRC, DST, memory_order_seq_cst) > diff --git a/lib/ovs-atomic-clang.h b/lib/ovs-atomic-clang.h > index c169f37..6792985 100644 > --- a/lib/ovs-atomic-clang.h > +++ b/lib/ovs-atomic-clang.h > @@ -22,7 +22,6 @@ > #define OVS_ATOMIC_CLANG_IMPL 1 > > #define ATOMIC(TYPE) _Atomic(TYPE) > -#include "ovs-atomic-types.h" > > #define ATOMIC_VAR_INIT(VALUE) (VALUE) > > diff --git a/lib/ovs-atomic-gcc4+.h b/lib/ovs-atomic-gcc4+.h > index 923e624..e237c20 100644 > --- a/lib/ovs-atomic-gcc4+.h > +++ b/lib/ovs-atomic-gcc4+.h > @@ -23,7 +23,6 @@ > #define OVS_ATOMIC_GCC4P_IMPL 1 > > #define ATOMIC(TYPE) TYPE > -#include "ovs-atomic-types.h" > > #define ATOMIC_BOOL_LOCK_FREE 2 > #define ATOMIC_CHAR_LOCK_FREE 2 > diff --git a/lib/ovs-atomic-gcc4.7+.h b/lib/ovs-atomic-gcc4.7+.h > index da88558..99c6b1f 100644 > --- a/lib/ovs-atomic-gcc4.7+.h > +++ b/lib/ovs-atomic-gcc4.7+.h > @@ -20,7 +20,6 @@ > #endif > > #define ATOMIC(TYPE) TYPE > -#include "ovs-atomic-types.h" > > typedef enum { > memory_order_relaxed = __ATOMIC_RELAXED, > diff --git a/lib/ovs-atomic-pthreads.h b/lib/ovs-atomic-pthreads.h > index 4b27bc2..b49d699 100644 > --- a/lib/ovs-atomic-pthreads.h > +++ b/lib/ovs-atomic-pthreads.h > @@ -24,7 +24,6 @@ > #define OVS_ATOMIC_PTHREADS_IMPL 1 > > #define ATOMIC(TYPE) TYPE > -#include "ovs-atomic-types.h" > > #define ATOMIC_BOOL_LOCK_FREE 0 > #define ATOMIC_CHAR_LOCK_FREE 0 > diff --git a/lib/ovs-atomic-types.h b/lib/ovs-atomic-types.h > deleted file mode 100644 > index bbce476..0000000 > --- a/lib/ovs-atomic-types.h > +++ /dev/null > @@ -1,47 +0,0 @@ > -/* This header defines atomic_* types using an ATOMIC macro provided by > the > -* caller. */ > -#ifndef IN_OVS_ATOMIC_H > -#error "This header should only be included indirectly via ovs-atomic.h." > -#endif > - > -#ifndef OMIT_STANDARD_ATOMIC_TYPES > -typedef ATOMIC(bool) atomic_bool; > - > -typedef ATOMIC(char) atomic_char; > -typedef ATOMIC(signed char) atomic_schar; > -typedef ATOMIC(unsigned char) atomic_uchar; > - > -typedef ATOMIC(short) atomic_short; > -typedef ATOMIC(unsigned short) atomic_ushort; > - > -typedef ATOMIC(int) atomic_int; > -typedef ATOMIC(unsigned int) atomic_uint; > - > -typedef ATOMIC(long) atomic_long; > -typedef ATOMIC(unsigned long) atomic_ulong; > - > -typedef ATOMIC(long long) atomic_llong; > -typedef ATOMIC(unsigned long long) atomic_ullong; > - > -typedef ATOMIC(size_t) atomic_size_t; > -typedef ATOMIC(ptrdiff_t) atomic_ptrdiff_t; > - > -typedef ATOMIC(intmax_t) atomic_intmax_t; > -typedef ATOMIC(uintmax_t) atomic_uintmax_t; > - > -typedef ATOMIC(intptr_t) atomic_intptr_t; > -typedef ATOMIC(uintptr_t) atomic_uintptr_t; > -#endif /* !OMIT_STANDARD_ATOMIC_TYPES */ > - > -/* Nonstandard atomic types. */ > -typedef ATOMIC(uint8_t) atomic_uint8_t; > -typedef ATOMIC(uint16_t) atomic_uint16_t; > -typedef ATOMIC(uint32_t) atomic_uint32_t; > -typedef ATOMIC(uint64_t) atomic_uint64_t; > - > -typedef ATOMIC(int8_t) atomic_int8_t; > -typedef ATOMIC(int16_t) atomic_int16_t; > -typedef ATOMIC(int32_t) atomic_int32_t; > -typedef ATOMIC(int64_t) atomic_int64_t; > - > -#undef OMIT_STANDARD_ATOMIC_TYPES > diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h > index a9d257a..62cd258 100644 > --- a/lib/ovs-atomic.h > +++ b/lib/ovs-atomic.h > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2013 Nicira, Inc. > + * Copyright (c) 2013, 2014 Nicira, Inc. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > @@ -284,6 +284,46 @@ > #endif > #undef IN_OVS_ATOMIC_H > > +#ifndef OMIT_STANDARD_ATOMIC_TYPES > +typedef ATOMIC(bool) atomic_bool; > + > +typedef ATOMIC(char) atomic_char; > +typedef ATOMIC(signed char) atomic_schar; > +typedef ATOMIC(unsigned char) atomic_uchar; > + > +typedef ATOMIC(short) atomic_short; > +typedef ATOMIC(unsigned short) atomic_ushort; > + > +typedef ATOMIC(int) atomic_int; > +typedef ATOMIC(unsigned int) atomic_uint; > + > +typedef ATOMIC(long) atomic_long; > +typedef ATOMIC(unsigned long) atomic_ulong; > + > +typedef ATOMIC(long long) atomic_llong; > +typedef ATOMIC(unsigned long long) atomic_ullong; > + > +typedef ATOMIC(size_t) atomic_size_t; > +typedef ATOMIC(ptrdiff_t) atomic_ptrdiff_t; > + > +typedef ATOMIC(intmax_t) atomic_intmax_t; > +typedef ATOMIC(uintmax_t) atomic_uintmax_t; > + > +typedef ATOMIC(intptr_t) atomic_intptr_t; > +typedef ATOMIC(uintptr_t) atomic_uintptr_t; > +#endif /* !OMIT_STANDARD_ATOMIC_TYPES */ > + > +/* Nonstandard atomic types. */ > +typedef ATOMIC(uint8_t) atomic_uint8_t; > +typedef ATOMIC(uint16_t) atomic_uint16_t; > +typedef ATOMIC(uint32_t) atomic_uint32_t; > +typedef ATOMIC(uint64_t) atomic_uint64_t; > + > +typedef ATOMIC(int8_t) atomic_int8_t; > +typedef ATOMIC(int16_t) atomic_int16_t; > +typedef ATOMIC(int32_t) atomic_int32_t; > +typedef ATOMIC(int64_t) atomic_int64_t; > + > /* Reference count. */ > struct ovs_refcount { > atomic_uint count; > -- > 1.7.10.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev >
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev