vconn-stream: Make definitions of tcp_vconn_class, etc., easier to find.
authorBen Pfaff <blp@nicira.com>
Fri, 4 Feb 2011 23:10:27 +0000 (15:10 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 15 Feb 2011 23:04:04 +0000 (15:04 -0800)
When object definitions are entirely hidden inside macros with token
pasting tricks, tools like "tags" and even "grep" cannot find them.  This
change makes the definitions of tcp_vconn_class and other stream-based
vconns easier to find, by exposing their definitions to these tools.

Reported-by: Yongqiang Liu <liuyq7809@gmail.com>
AUTHORS
lib/vconn-stream.c

diff --git a/AUTHORS b/AUTHORS
index 4116ada9bac34c5a2affe3875eee25a81e61dfb4..006085ada4e1e1e6d43fce4c7357348d100998e2 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -76,6 +76,7 @@ Stephen Hemminger       shemminger@vyatta.com
 Takayuki HAMA           t-hama@cb.jp.nec.com
 Teemu Koponen           koponen@nicira.com
 Vishal Swarankar        vishal.swarnkar@gmail.com
+Yongqiang Liu           liuyq7809@gmail.com
 kk yap                  yapkke@stanford.edu
 
 Thanks to all Open vSwitch contributors.  If you are not listed above
index 82854e91125822112d450efd404246f48320a2c6..39f1c94df3169a601d1f5eeacbe5ed12993d209e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -365,9 +365,9 @@ pvconn_pstream_wait(struct pvconn *pvconn)
 \f
 /* Stream-based vconns and pvconns. */
 
-#define DEFINE_VCONN_STREAM_CLASS(NAME)             \
-        struct vconn_class NAME##_vconn_class = {   \
-            #NAME,                                  \
+#define STREAM_INIT(NAME)                           \
+    {                                               \
+            NAME,                                   \
             vconn_stream_open,                      \
             vconn_stream_close,                     \
             vconn_stream_connect,                   \
@@ -376,27 +376,27 @@ pvconn_pstream_wait(struct pvconn *pvconn)
             vconn_stream_run,                       \
             vconn_stream_run_wait,                  \
             vconn_stream_wait,                      \
-        };
+    }
 
-#define DEFINE_PVCONN_STREAM_CLASS(NAME)            \
-        struct pvconn_class NAME##_pvconn_class = { \
-            #NAME,                                  \
+#define PSTREAM_INIT(NAME)                          \
+    {                                               \
+            NAME,                                   \
             pvconn_pstream_listen,                  \
             pvconn_pstream_close,                   \
             pvconn_pstream_accept,                  \
             pvconn_pstream_wait                     \
-        };
+    }
 
-static DEFINE_VCONN_STREAM_CLASS(stream);
-static DEFINE_PVCONN_STREAM_CLASS(pstream);
+static struct vconn_class stream_vconn_class = STREAM_INIT("stream");
+static struct pvconn_class pstream_pvconn_class = PSTREAM_INIT("pstream");
 
-DEFINE_VCONN_STREAM_CLASS(tcp);
-DEFINE_PVCONN_STREAM_CLASS(ptcp);
+struct vconn_class tcp_vconn_class = STREAM_INIT("tcp");
+struct pvconn_class ptcp_pvconn_class = PSTREAM_INIT("ptcp");
 
-DEFINE_VCONN_STREAM_CLASS(unix);
-DEFINE_PVCONN_STREAM_CLASS(punix);
+struct vconn_class unix_vconn_class = STREAM_INIT("unix");
+struct pvconn_class punix_pvconn_class = PSTREAM_INIT("punix");
 
 #ifdef HAVE_OPENSSL
-DEFINE_VCONN_STREAM_CLASS(ssl);
-DEFINE_PVCONN_STREAM_CLASS(pssl);
+struct vconn_class ssl_vconn_class = STREAM_INIT("ssl");
+struct pvconn_class pssl_pvconn_class = PSTREAM_INIT("pssl");
 #endif