[Pvfs2-cvs] commit by kunkel in pvfs2/src/io/bmi/bmi_tcp: socket-collection.c bmi-tcp.c sockio.c

CVS commit program cvs at parl.clemson.edu
Wed May 23 16:48:29 EDT 2007


Update of /projects/cvsroot/pvfs2/src/io/bmi/bmi_tcp
In directory parlweb1:/tmp/cvs-serv20193/src/io/bmi/bmi_tcp

Modified Files:
      Tag: pvfs2-kunkel-tas-branch
	socket-collection.c bmi-tcp.c sockio.c 
Log Message:
Merge HEAD changes to TAS-branch.


Index: socket-collection.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/bmi/bmi_tcp/socket-collection.c,v
diff -p -u -r1.15 -r1.15.22.1
--- socket-collection.c	24 May 2006 13:24:50 -0000	1.15
+++ socket-collection.c	23 May 2007 20:48:28 -0000	1.15.22.1
@@ -292,7 +292,7 @@ do_again:
     if(ret < 0)
     {
 	gen_mutex_unlock(&scp->mutex);
-	return(-old_errno);
+	return(bmi_tcp_errno_to_pvfs(-old_errno));
     }
 
     /* nothing ready, just return */

Index: bmi-tcp.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/bmi/bmi_tcp/bmi-tcp.c,v
diff -p -u -r1.113 -r1.113.2.1
--- bmi-tcp.c	23 Oct 2006 22:49:43 -0000	1.113
+++ bmi-tcp.c	23 May 2007 20:48:28 -0000	1.113.2.1
@@ -793,7 +793,7 @@ int BMI_tcp_set_info(int option,
         struct tcp_allowed_connection_s *tcp_allowed_connection = NULL;
         if (inout_parameter == NULL)
         {
-            ret = -EINVAL;
+            ret = bmi_tcp_errno_to_pvfs(-EINVAL);
             break;
         }
         else 
@@ -807,7 +807,7 @@ int BMI_tcp_set_info(int option,
             tcp_allowed_connection = alloc_trusted_connection_info(svc_config->allowed_networks_count);
             if (tcp_allowed_connection == NULL)
             {
-                ret = -ENOMEM;
+                ret = bmi_tcp_errno_to_pvfs(-ENOMEM);
                 break;
             }
 #ifdef      __PVFS2_SERVER__
@@ -1980,6 +1980,12 @@ static int tcp_server_init(void)
         ret = BMI_sockio_bind_sock_specific(tcp_addr_data->socket,
             tcp_addr_data->hostname,
             tcp_addr_data->port);
+        /* NOTE: this particular function converts errno in advance */
+        if(ret < 0)
+        {
+            PVFS_perror_gossip("BMI_sockio_bind_sock_specific", ret);
+            return(ret);
+        }
     }
     else
     {
@@ -2068,9 +2074,6 @@ static int tcp_sock_init(method_addr_p m
 
     if(tcp_addr_data->addr_error)
     {
-	/* TODO: make this a debug rather than error message once we have
-	 * tested this out enough
-	 */
         gossip_debug(GOSSIP_BMI_DEBUG_TCP, "%s: attempting reconnect.\n",
           __func__);
 	tcp_addr_data->addr_error = 0;
@@ -2160,14 +2163,14 @@ static int tcp_sock_init(method_addr_p m
 
     if (ret < 0)
     {
-	if (errno == EINPROGRESS)
+	if (ret == -EINPROGRESS)
 	{
 	    tcp_addr_data->not_connected = 1;
 	    /* this will have to be connected later with a poll */
 	}
 	else
 	{
-            /* BMI_sockio_connect_sock returns a PVFS error */
+            /* NOTE: BMI_sockio_connect_sock returns a PVFS error */
             char buff[300];
 
             snprintf(buff, 300, "Error: BMI_sockio_connect_sock: (%s):", 
@@ -2514,6 +2517,7 @@ static int tcp_post_recv_generic(bmi_op_
 	    if (ret < 0)
 	    {
                 PVFS_perror_gossip("Error: payload_progress", ret);
+                /* payload_progress() returns BMI error codes */
 		tcp_forget_addr(query_op->addr, 0, ret);
 		return (ret);
 	    }
@@ -2681,6 +2685,7 @@ static int tcp_do_work(int max_idle_time
     gen_mutex_lock(&interface_mutex);
     if (ret < 0)
     {
+        /* BMI_socket_collection_testglobal() returns BMI error code */
 	return (ret);
     }
 
@@ -2694,6 +2699,7 @@ static int tcp_do_work(int max_idle_time
 	/* skip working on addresses in failure mode */
 	if(tcp_addr_data->addr_error)
 	{
+            /* addr_error field is in BMI error code format */
 	    tcp_forget_addr(addr_array[i], 0, tcp_addr_data->addr_error);
 	    continue;
 	}
@@ -2964,7 +2970,7 @@ static int tcp_do_work_recv(method_addr_
                          "...dropping connection.\n");
             tcp_forget_addr(map, 0, bmi_tcp_errno_to_pvfs(-EPIPE));
         }
-	return(ret);
+	return(0);
     }
     else
     {
@@ -3169,6 +3175,7 @@ static int work_on_send_op(method_op_p m
 	if (ret < 0)
 	{
             PVFS_perror_gossip("Error: socket failed to init", ret);
+            /* tcp_sock_init() returns BMI error code */
 	    tcp_forget_addr(my_method_op->addr, 0, ret);
 	    return (0);
 	}
@@ -3193,6 +3200,7 @@ static int work_on_send_op(method_op_p m
     if (ret < 0)
     {
         PVFS_perror_gossip("Error: payload_progress", ret);
+        /* payload_progress() returns BMI error codes */
 	tcp_forget_addr(my_method_op->addr, 0, ret);
 	return (0);
     }
@@ -3260,6 +3268,7 @@ static int work_on_recv_op(method_op_p m
 	if (ret < 0)
 	{
             PVFS_perror_gossip("Error: payload_progress", ret);
+            /* payload_progress() returns BMI error codes */
 	    tcp_forget_addr(my_method_op->addr, 0, ret);
 	    return (0);
 	}
@@ -3563,7 +3572,7 @@ static int tcp_accept_init(int *socket, 
     if(!(*peer))
     {
         close(*socket);
-        return(-BMI_ENOMEM);
+        return(bmi_tcp_errno_to_pvfs(-BMI_ENOMEM));
     }
     strcpy(*peer, tmp_peer);
 
@@ -3692,6 +3701,7 @@ static int BMI_tcp_post_send_generic(bmi
     if (ret < 0)
     {
 	gossip_debug(GOSSIP_BMI_DEBUG_TCP, "tcp_sock_init() failure.\n");
+        /* tcp_sock_init() returns BMI error code */
 	tcp_forget_addr(dest, 0, ret);
 	return (ret);
     }
@@ -3734,6 +3744,7 @@ static int BMI_tcp_post_send_generic(bmi
     if (ret < 0)
     {
         PVFS_perror_gossip("Error: payload_progress", ret);
+        /* payload_progress() returns BMI error codes */
 	tcp_forget_addr(dest, 0, ret);
 	return (ret);
     }

Index: sockio.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/bmi/bmi_tcp/sockio.c,v
diff -p -u -r1.22 -r1.22.8.1
--- sockio.c	11 Sep 2006 15:42:39 -0000	1.22
+++ sockio.c	23 May 2007 20:48:29 -0000	1.22.8.1
@@ -60,6 +60,7 @@ int BMI_sockio_bind_sock(int sockd,
     return (sockd);
 }
 
+/* NOTE: this function returns BMI error codes */
 int BMI_sockio_bind_sock_specific(int sockd,
               const char *name,
 	      int service)
@@ -75,12 +76,13 @@ int BMI_sockio_bind_sock_specific(int so
     {
 	if (errno == EINTR)
 	    goto bind_sock_restart;
-	return (-1);
+        return(bmi_errno_to_pvfs(-errno));
     }
     return (sockd);
 }
 
 
+/* NOTE: this function returns BMI error codes */
 int BMI_sockio_connect_sock(int sockd,
 		 const char *name,
 		 int service)
@@ -89,13 +91,13 @@ int BMI_sockio_connect_sock(int sockd,
     int ret;
 
     if ((ret = BMI_sockio_init_sock(&saddr, name, service)) != 0)
-	return (ret); /* converted to PVFS error code below */
+	return (ret);
   connect_sock_restart:
     if (connect(sockd, (struct sockaddr *) &saddr, sizeof(saddr)) < 0)
     {
 	if (errno == EINTR)
 	    goto connect_sock_restart;
-        return (-PVFS_ERROR_CODE(errno));
+        return(bmi_errno_to_pvfs(-errno));
     }
     return (sockd);
 }



More information about the Pvfs2-cvs mailing list