[ovs-dev] [PATCH 1/4] vconn: Remove unused "reconnectable" member from vconn.

Ben Pfaff blp at nicira.com
Mon Sep 21 21:53:54 UTC 2009


This member is initialized, but nothing ever reads it, so get rid of it.
---
 lib/vconn-provider.h |    3 +--
 lib/vconn-ssl.c      |    2 +-
 lib/vconn-stream.c   |    5 ++---
 lib/vconn-stream.h   |    2 +-
 lib/vconn-tcp.c      |    2 +-
 lib/vconn-unix.c     |    4 ++--
 lib/vconn.c          |   20 ++++++++++++++++++--
 7 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/lib/vconn-provider.h b/lib/vconn-provider.h
index ae025f7..f245e4c 100644
--- a/lib/vconn-provider.h
+++ b/lib/vconn-provider.h
@@ -39,11 +39,10 @@ struct vconn {
     uint32_t local_ip;
     uint16_t local_port;
     char *name;
-    bool reconnectable;
 };
 
 void vconn_init(struct vconn *, struct vconn_class *, int connect_status,
-                const char *name, bool reconnectable);
+                const char *name);
 void vconn_set_remote_ip(struct vconn *, uint32_t remote_ip);
 void vconn_set_remote_port(struct vconn *, uint16_t remote_port);
 void vconn_set_local_ip(struct vconn *, uint32_t local_ip);
diff --git a/lib/vconn-ssl.c b/lib/vconn-ssl.c
index 9bb2df8..2452bce 100644
--- a/lib/vconn-ssl.c
+++ b/lib/vconn-ssl.c
@@ -246,7 +246,7 @@ new_ssl_vconn(const char *name, int fd, enum session_type type,
 
     /* Create and return the ssl_vconn. */
     sslv = xmalloc(sizeof *sslv);
-    vconn_init(&sslv->vconn, &ssl_vconn_class, EAGAIN, name, true);
+    vconn_init(&sslv->vconn, &ssl_vconn_class, EAGAIN, name);
     vconn_set_remote_ip(&sslv->vconn, remote->sin_addr.s_addr);
     vconn_set_remote_port(&sslv->vconn, remote->sin_port);
     vconn_set_local_ip(&sslv->vconn, local.sin_addr.s_addr);
diff --git a/lib/vconn-stream.c b/lib/vconn-stream.c
index b38c568..e2991dd 100644
--- a/lib/vconn-stream.c
+++ b/lib/vconn-stream.c
@@ -54,13 +54,12 @@ static void stream_clear_txbuf(struct stream_vconn *);
 
 int
 new_stream_vconn(const char *name, int fd, int connect_status,
-                 bool reconnectable, struct vconn **vconnp)
+                 struct vconn **vconnp)
 {
     struct stream_vconn *s;
 
     s = xmalloc(sizeof *s);
-    vconn_init(&s->vconn, &stream_vconn_class, connect_status,
-               name, reconnectable);
+    vconn_init(&s->vconn, &stream_vconn_class, connect_status, name);
     s->fd = fd;
     s->txbuf = NULL;
     s->tx_waiter = NULL;
diff --git a/lib/vconn-stream.h b/lib/vconn-stream.h
index 0adac9a..fd3d8bd 100644
--- a/lib/vconn-stream.h
+++ b/lib/vconn-stream.h
@@ -26,7 +26,7 @@ struct pvconn;
 struct sockaddr;
 
 int new_stream_vconn(const char *name, int fd, int connect_status,
-                     bool reconnectable, struct vconn **vconnp);
+                     struct vconn **vconnp);
 int new_pstream_pvconn(const char *name, int fd,
                       int (*accept_cb)(int fd, const struct sockaddr *,
                                        size_t sa_len, struct vconn **),
diff --git a/lib/vconn-tcp.c b/lib/vconn-tcp.c
index 998a200..44f49f1 100644
--- a/lib/vconn-tcp.c
+++ b/lib/vconn-tcp.c
@@ -58,7 +58,7 @@ new_tcp_vconn(const char *name, int fd, int connect_status,
         return errno;
     }
 
-    retval = new_stream_vconn(name, fd, connect_status, true, vconnp);
+    retval = new_stream_vconn(name, fd, connect_status, vconnp);
     if (!retval) {
         struct vconn *vconn = *vconnp;
         vconn_set_remote_ip(vconn, remote->sin_addr.s_addr);
diff --git a/lib/vconn-unix.c b/lib/vconn-unix.c
index 93d14e8..e2b6f7a 100644
--- a/lib/vconn-unix.c
+++ b/lib/vconn-unix.c
@@ -60,7 +60,7 @@ unix_open(const char *name, char *suffix, struct vconn **vconnp)
     }
 
     return new_stream_vconn(name, fd, check_connection_completion(fd),
-                            true, vconnp);
+                            vconnp);
 }
 
 struct vconn_class unix_vconn_class = {
@@ -118,7 +118,7 @@ punix_accept(int fd, const struct sockaddr *sa, size_t sa_len,
     } else {
         strcpy(name, "unix");
     }
-    return new_stream_vconn(name, fd, 0, true, vconnp);
+    return new_stream_vconn(name, fd, 0, vconnp);
 }
 
 struct pvconn_class punix_pvconn_class = {
diff --git a/lib/vconn.c b/lib/vconn.c
index aed1880..66a56bc 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -1388,9 +1388,26 @@ normalize_match(struct ofp_match *m)
     m->wildcards = htonl(wc);
 }
 
+/* Initializes 'vconn' as a new vconn named 'name', implemented via 'class'.
+ * The initial connection status, supplied as 'connect_status', is interpreted
+ * as follows:
+ *
+ *      - 0: 'vconn' is connected.  Its 'send' and 'recv' functions may be
+ *        called in the normal fashion.
+ *
+ *      - EAGAIN: 'vconn' is trying to complete a connection.  Its 'connect'
+ *        function should be called to complete the connection.
+ *
+ *      - Other positive errno values indicate that the connection failed with
+ *        the specified error.
+ *
+ * After calling this function, vconn_close() must be used to destroy 'vconn',
+ * otherwise resources will be leaked.
+ *
+ * The caller retains ownership of 'name'. */
 void
 vconn_init(struct vconn *vconn, struct vconn_class *class, int connect_status,
-           const char *name, bool reconnectable)
+           const char *name)
 {
     vconn->class = class;
     vconn->state = (connect_status == EAGAIN ? VCS_CONNECTING
@@ -1404,7 +1421,6 @@ vconn_init(struct vconn *vconn, struct vconn_class *class, int connect_status,
     vconn->local_ip = 0;
     vconn->local_port = 0;
     vconn->name = xstrdup(name);
-    vconn->reconnectable = reconnectable;
 }
 
 void
-- 
1.6.3.3





More information about the dev mailing list