Skip to content

Commit

Permalink
ovs-atomic-types: Move into ovs-atomic.h.
Browse files Browse the repository at this point in the history
Every implementation used this same code, so it makes sense to centralize
it.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Andy Zhou <[email protected]>
  • Loading branch information
blp committed Mar 13, 2014
1 parent 4dff089 commit 6a36690
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 54 deletions.
1 change: 0 additions & 1 deletion lib/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,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 \
Expand Down
1 change: 0 additions & 1 deletion lib/ovs-atomic-c11.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion lib/ovs-atomic-clang.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion lib/ovs-atomic-gcc4+.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/ovs-atomic-gcc4.7+.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#endif

#define ATOMIC(TYPE) TYPE
#include "ovs-atomic-types.h"

typedef enum {
memory_order_relaxed = __ATOMIC_RELAXED,
Expand Down
1 change: 0 additions & 1 deletion lib/ovs-atomic-pthreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 0 additions & 47 deletions lib/ovs-atomic-types.h

This file was deleted.

42 changes: 41 additions & 1 deletion lib/ovs-atomic.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6a36690

Please sign in to comment.