lib: Expose SOURCE_LOCATOR as OVS_SOURCE_LOACATOR
authorThomas Graf <tgraf@noironetworks.com>
Mon, 15 Dec 2014 13:10:38 +0000 (14:10 +0100)
committerThomas Graf <tgraf@noironetworks.com>
Mon, 15 Dec 2014 13:14:58 +0000 (14:14 +0100)
Required to expose headers which depend on SOURCE_LOCATOR

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Ben Pfaff <blp@nicira.com>
include/openvswitch/util.h
lib/backtrace.h
lib/hmap.h
lib/latch.h
lib/ovs-thread.h
lib/poll-loop.h
lib/seq.h
lib/timer.h
lib/util.h

index b2b20a5..b0b9935 100644 (file)
@@ -32,6 +32,14 @@ void ovs_set_program_name__(const char *name, const char *version,
 const char *ovs_get_program_name(void);
 const char *ovs_get_program_version(void);
 
+/* Expands to a string that looks like "<file>:<line>", e.g. "tmp.c:10".
+ *
+ * See http://c-faq.com/ansi/stringize.html for an explanation of OVS_STRINGIZE
+ * and OVS_STRINGIZE2. */
+#define OVS_SOURCE_LOCATOR __FILE__ ":" OVS_STRINGIZE(__LINE__)
+#define OVS_STRINGIZE(ARG) OVS_STRINGIZE2(ARG)
+#define OVS_STRINGIZE2(ARG) #ARG
+
 #ifdef __cplusplus
 }
 #endif
index 2527243..4810a7c 100644 (file)
@@ -58,8 +58,8 @@
  * ??:0
  */
 
-#define log_backtrace() log_backtrace_at(NULL, SOURCE_LOCATOR);
-#define log_backtrace_msg(msg) log_backtrace_at(msg, SOURCE_LOCATOR);
+#define log_backtrace() log_backtrace_at(NULL, OVS_SOURCE_LOCATOR);
+#define log_backtrace_msg(msg) log_backtrace_at(msg, OVS_SOURCE_LOCATOR);
 
 #define BACKTRACE_MAX_FRAMES 31
 
index 5fcb7a2..85241f0 100644 (file)
@@ -80,20 +80,20 @@ static inline bool hmap_is_empty(const struct hmap *);
 
 /* Adjusting capacity. */
 void hmap_expand_at(struct hmap *, const char *where);
-#define hmap_expand(HMAP) hmap_expand_at(HMAP, SOURCE_LOCATOR)
+#define hmap_expand(HMAP) hmap_expand_at(HMAP, OVS_SOURCE_LOCATOR)
 
 void hmap_shrink_at(struct hmap *, const char *where);
-#define hmap_shrink(HMAP) hmap_shrink_at(HMAP, SOURCE_LOCATOR)
+#define hmap_shrink(HMAP) hmap_shrink_at(HMAP, OVS_SOURCE_LOCATOR)
 
 void hmap_reserve_at(struct hmap *, size_t capacity, const char *where);
 #define hmap_reserve(HMAP, CAPACITY) \
-    hmap_reserve_at(HMAP, CAPACITY, SOURCE_LOCATOR)
+    hmap_reserve_at(HMAP, CAPACITY, OVS_SOURCE_LOCATOR)
 
 /* Insertion and deletion. */
 static inline void hmap_insert_at(struct hmap *, struct hmap_node *,
                                   size_t hash, const char *where);
 #define hmap_insert(HMAP, NODE, HASH) \
-    hmap_insert_at(HMAP, NODE, HASH, SOURCE_LOCATOR)
+    hmap_insert_at(HMAP, NODE, HASH, OVS_SOURCE_LOCATOR)
 
 static inline void hmap_insert_fast(struct hmap *,
                                     struct hmap_node *, size_t hash);
index 52829b1..3c0b842 100644 (file)
@@ -42,6 +42,6 @@ void latch_set(struct latch *);
 
 bool latch_is_set(const struct latch *);
 void latch_wait_at(const struct latch *, const char *where);
-#define latch_wait(latch) latch_wait_at(latch, SOURCE_LOCATOR)
+#define latch_wait(latch) latch_wait_at(latch, OVS_SOURCE_LOCATOR)
 
 #endif /* latch.h */
index 42808b9..dfbd891 100644 (file)
@@ -66,12 +66,12 @@ void ovs_mutex_unlock(const struct ovs_mutex *mutex) OVS_RELEASES(mutex);
 void ovs_mutex_lock_at(const struct ovs_mutex *mutex, const char *where)
     OVS_ACQUIRES(mutex);
 #define ovs_mutex_lock(mutex) \
-        ovs_mutex_lock_at(mutex, SOURCE_LOCATOR)
+        ovs_mutex_lock_at(mutex, OVS_SOURCE_LOCATOR)
 
 int ovs_mutex_trylock_at(const struct ovs_mutex *mutex, const char *where)
     OVS_TRY_LOCK(0, mutex);
 #define ovs_mutex_trylock(mutex) \
-        ovs_mutex_trylock_at(mutex, SOURCE_LOCATOR)
+        ovs_mutex_trylock_at(mutex, OVS_SOURCE_LOCATOR)
 
 void ovs_mutex_cond_wait(pthread_cond_t *, const struct ovs_mutex *);
 
@@ -130,22 +130,22 @@ void xpthread_rwlockattr_setkind_np(pthread_rwlockattr_t *, int kind);
 void ovs_rwlock_wrlock_at(const struct ovs_rwlock *rwlock, const char *where)
     OVS_ACQ_WRLOCK(rwlock);
 #define ovs_rwlock_wrlock(rwlock) \
-        ovs_rwlock_wrlock_at(rwlock, SOURCE_LOCATOR)
+        ovs_rwlock_wrlock_at(rwlock, OVS_SOURCE_LOCATOR)
 
 int ovs_rwlock_trywrlock_at(const struct ovs_rwlock *rwlock, const char *where)
     OVS_TRY_WRLOCK(0, rwlock);
 #define ovs_rwlock_trywrlock(rwlock) \
-    ovs_rwlock_trywrlock_at(rwlock, SOURCE_LOCATOR)
+    ovs_rwlock_trywrlock_at(rwlock, OVS_SOURCE_LOCATOR)
 
 void ovs_rwlock_rdlock_at(const struct ovs_rwlock *rwlock, const char *where)
     OVS_ACQ_RDLOCK(rwlock);
 #define ovs_rwlock_rdlock(rwlock) \
-        ovs_rwlock_rdlock_at(rwlock, SOURCE_LOCATOR)
+        ovs_rwlock_rdlock_at(rwlock, OVS_SOURCE_LOCATOR)
 
 int ovs_rwlock_tryrdlock_at(const struct ovs_rwlock *rwlock, const char *where)
     OVS_TRY_RDLOCK(0, rwlock);
 #define ovs_rwlock_tryrdlock(rwlock) \
-        ovs_rwlock_tryrdlock_at(rwlock, SOURCE_LOCATOR)
+        ovs_rwlock_tryrdlock_at(rwlock, OVS_SOURCE_LOCATOR)
 
 /* ovs_barrier functions analogous to pthread_barrier_*() functions. */
 void ovs_barrier_init(struct ovs_barrier *, uint32_t count);
@@ -620,11 +620,11 @@ size_t ovs_thread_stats_next_bucket(const struct ovsthread_stats *, size_t);
 bool single_threaded(void);
 
 void assert_single_threaded_at(const char *where);
-#define assert_single_threaded() assert_single_threaded_at(SOURCE_LOCATOR)
+#define assert_single_threaded() assert_single_threaded_at(OVS_SOURCE_LOCATOR)
 
 #ifndef _WIN32
 pid_t xfork_at(const char *where);
-#define xfork() xfork_at(SOURCE_LOCATOR)
+#define xfork() xfork_at(OVS_SOURCE_LOCATOR)
 #endif
 
 void forbid_forking(const char *reason);
index 5fdf874..01e1aa8 100644 (file)
@@ -51,21 +51,21 @@ extern "C" {
  * caller would be more useful in log output.  See timer_wait_at() for an
  * example. */
 void poll_fd_wait_at(int fd, short int events, const char *where);
-#define poll_fd_wait(fd, events) poll_fd_wait_at(fd, events, SOURCE_LOCATOR)
+#define poll_fd_wait(fd, events) poll_fd_wait_at(fd, events, OVS_SOURCE_LOCATOR)
 
 #ifdef _WIN32
-#define poll_wevent_wait(wevent) poll_wevent_wait_at(wevent, SOURCE_LOCATOR)
+#define poll_wevent_wait(wevent) poll_wevent_wait_at(wevent, OVS_SOURCE_LOCATOR)
 #endif /* _WIN32 */
 
 void poll_timer_wait_at(long long int msec, const char *where);
-#define poll_timer_wait(msec) poll_timer_wait_at(msec, SOURCE_LOCATOR)
+#define poll_timer_wait(msec) poll_timer_wait_at(msec, OVS_SOURCE_LOCATOR)
 
 void poll_timer_wait_until_at(long long int msec, const char *where);
 #define poll_timer_wait_until(msec)             \
-    poll_timer_wait_until_at(msec, SOURCE_LOCATOR)
+    poll_timer_wait_until_at(msec, OVS_SOURCE_LOCATOR)
 
 void poll_immediate_wake_at(const char *where);
-#define poll_immediate_wake() poll_immediate_wake_at(SOURCE_LOCATOR)
+#define poll_immediate_wake() poll_immediate_wake_at(OVS_SOURCE_LOCATOR)
 
 /* Wait until an event occurs. */
 void poll_block(void);
index f15bc1b..84ae1ab 100644 (file)
--- a/lib/seq.h
+++ b/lib/seq.h
@@ -126,7 +126,7 @@ void seq_change(struct seq *);
 uint64_t seq_read(const struct seq *);
 
 void seq_wait_at(const struct seq *, uint64_t value, const char *where);
-#define seq_wait(seq, value) seq_wait_at(seq, value, SOURCE_LOCATOR)
+#define seq_wait(seq, value) seq_wait_at(seq, value, OVS_SOURCE_LOCATOR)
 
 /* For poll_block() internal use. */
 void seq_woke(void);
index 9afe3b7..6b35d17 100644 (file)
@@ -28,7 +28,7 @@ struct timer {
 
 long long int timer_msecs_until_expired(const struct timer *);
 void timer_wait_at(const struct timer *, const char *where);
-#define timer_wait(timer) timer_wait_at(timer, SOURCE_LOCATOR)
+#define timer_wait(timer) timer_wait_at(timer, OVS_SOURCE_LOCATOR)
 
 /* Causes 'timer' to expire when 'duration' milliseconds have passed.
  *
index d744e23..cbaa3ac 100644 (file)
@@ -72,7 +72,7 @@
 #ifndef NDEBUG
 #define ovs_assert(CONDITION)                                           \
     if (!OVS_LIKELY(CONDITION)) {                                       \
-        ovs_assert_failure(SOURCE_LOCATOR, __func__, #CONDITION);       \
+        ovs_assert_failure(OVS_SOURCE_LOCATOR, __func__, #CONDITION);       \
     }
 #else
 #define ovs_assert(CONDITION) ((void) (CONDITION))
@@ -175,14 +175,6 @@ ovs_prefetch_range(const void *start, size_t size)
 
 #define OVS_NOT_REACHED() abort()
 
-/* Expands to a string that looks like "<file>:<line>", e.g. "tmp.c:10".
- *
- * See http://c-faq.com/ansi/stringize.html for an explanation of STRINGIZE and
- * STRINGIZE2. */
-#define SOURCE_LOCATOR __FILE__ ":" STRINGIZE(__LINE__)
-#define STRINGIZE(ARG) STRINGIZE2(ARG)
-#define STRINGIZE2(ARG) #ARG
-
 /* Given a pointer-typed lvalue OBJECT, expands to a pointer type that may be
  * assigned to OBJECT. */
 #ifdef __GNUC__