[Pkg-ofed-commits] r570 - in /branches/ofed-1.5lenny/librdmacm/trunk: ./ debian/...

gmpc-guest at alioth.debian.org gmpc-guest at alioth.debian.org
Thu Feb 4 14:43:11 UTC 2010


Author: gmpc-guest
Date: Thu Feb  4 14:43:10 2010
New Revision: 570

URL: http://svn.debian.org/wsvn/pkg-ofed/?sc=1&rev=570
Log:
New upstream release

Removed:
    branches/ofed-1.5lenny/librdmacm/trunk/autogen.sh
Modified:
    branches/ofed-1.5lenny/librdmacm/trunk/configure
    branches/ofed-1.5lenny/librdmacm/trunk/configure.in
    branches/ofed-1.5lenny/librdmacm/trunk/debian/changelog
    branches/ofed-1.5lenny/librdmacm/trunk/examples/cmatose.c
    branches/ofed-1.5lenny/librdmacm/trunk/examples/mckey.c
    branches/ofed-1.5lenny/librdmacm/trunk/examples/rping.c
    branches/ofed-1.5lenny/librdmacm/trunk/examples/udaddy.c
    branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec
    branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec.in
    branches/ofed-1.5lenny/librdmacm/trunk/man/rdma_cm.7
    branches/ofed-1.5lenny/librdmacm/trunk/src/cma.c

Modified: branches/ofed-1.5lenny/librdmacm/trunk/configure
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/configure?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/configure (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/configure Thu Feb  4 14:43:10 2010
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for librdmacm 1.0.8.
+# Generated by GNU Autoconf 2.59 for librdmacm 1.0.10.
 #
 # Report bugs to <general at lists.openfabrics.org>.
 #
@@ -423,8 +423,8 @@
 # Identity of this package.
 PACKAGE_NAME='librdmacm'
 PACKAGE_TARNAME='librdmacm'
-PACKAGE_VERSION='1.0.8'
-PACKAGE_STRING='librdmacm 1.0.8'
+PACKAGE_VERSION='1.0.10'
+PACKAGE_STRING='librdmacm 1.0.10'
 PACKAGE_BUGREPORT='general at lists.openfabrics.org'
 
 ac_unique_file="src/cma.c"
@@ -954,7 +954,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures librdmacm 1.0.8 to adapt to many kinds of systems.
+\`configure' configures librdmacm 1.0.10 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1020,7 +1020,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of librdmacm 1.0.8:";;
+     short | recursive ) echo "Configuration of librdmacm 1.0.10:";;
    esac
   cat <<\_ACEOF
 
@@ -1161,7 +1161,7 @@
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-librdmacm configure 1.0.8
+librdmacm configure 1.0.10
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1175,7 +1175,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by librdmacm $as_me 1.0.8, which was
+It was created by librdmacm $as_me 1.0.10, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1821,7 +1821,7 @@
 
 # Define the identity of the package.
  PACKAGE=librdmacm
- VERSION=1.0.8
+ VERSION=1.0.10
 
 
 cat >>confdefs.h <<_ACEOF
@@ -20908,7 +20908,7 @@
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by librdmacm $as_me 1.0.8, which was
+This file was extended by librdmacm $as_me 1.0.10, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20971,7 +20971,7 @@
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-librdmacm config.status 1.0.8
+librdmacm config.status 1.0.10
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 

Modified: branches/ofed-1.5lenny/librdmacm/trunk/configure.in
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/configure.in?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/configure.in (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/configure.in Thu Feb  4 14:43:10 2010
@@ -1,11 +1,11 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.57)
-AC_INIT(librdmacm, 1.0.8, general at lists.openfabrics.org)
+AC_INIT(librdmacm, 1.0.10, general at lists.openfabrics.org)
 AC_CONFIG_SRCDIR([src/cma.c])
 AC_CONFIG_AUX_DIR(config)
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(librdmacm, 1.0.8)
+AM_INIT_AUTOMAKE(librdmacm, 1.0.10)
 
 AM_PROG_LIBTOOL
 

Modified: branches/ofed-1.5lenny/librdmacm/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/debian/changelog?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/debian/changelog (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/debian/changelog Thu Feb  4 14:43:10 2010
@@ -1,3 +1,9 @@
+librdmacm (1.0.10-1) unstable; urgency=low
+
+  * New upstream release (OFED 1.5)
+
+ -- Guy Coates <gmpc at sanger.ac.uk>  Thu, 04 Feb 2010 14:41:30 +0000
+
 librdmacm (1.0.8-1+OFED) unstable; urgency=low
 
   * Non-maintainer upload.

Modified: branches/ofed-1.5lenny/librdmacm/trunk/examples/cmatose.c
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/examples/cmatose.c?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/examples/cmatose.c (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/examples/cmatose.c Thu Feb  4 14:43:10 2010
@@ -150,7 +150,7 @@
 	init_qp_attr.recv_cq = node->cq[RECV_CQ_INDEX];
 	ret = rdma_create_qp(node->cma_id, node->pd, &init_qp_attr);
 	if (ret) {
-		printf("cmatose: unable to create QP: %d\n", ret);
+		perror("cmatose: unable to create QP");
 		goto out;
 	}
 
@@ -233,12 +233,12 @@
 		ret = rdma_set_option(node->cma_id, RDMA_OPTION_ID,
 				      RDMA_OPTION_ID_TOS, &tos, sizeof tos);
 		if (ret)
-			printf("cmatose: set TOS option failed: %d\n", ret);
+			perror("cmatose: set TOS option failed");
 	}
 
 	ret = rdma_resolve_route(node->cma_id, 2000);
 	if (ret) {
-		printf("cmatose: resolve route failed: %d\n", ret);
+		perror("cmatose: resolve route failed");
 		connect_error();
 	}
 	return ret;
@@ -263,7 +263,7 @@
 	conn_param.retry_count = 5;
 	ret = rdma_connect(node->cma_id, &conn_param);
 	if (ret) {
-		printf("cmatose: failure connecting: %d\n", ret);
+		perror("cmatose: failure connecting");
 		goto err;
 	}
 	return 0;
@@ -300,7 +300,7 @@
 	conn_param.initiator_depth = 1;
 	ret = rdma_accept(node->cma_id, &conn_param);
 	if (ret) {
-		printf("cmatose: failure accepting: %d\n", ret);
+		perror("cmatose: failure accepting");
 		goto err2;
 	}
 	return 0;
@@ -449,8 +449,8 @@
 			cma_handler(event->id, event);
 			rdma_ack_cm_event(event);
 		} else {
-			printf("cmatose: failure in rdma_get_cm_event in connect events\n");
-			ret = err;
+			perror("cmatose: failure in rdma_get_cm_event in connect events");
+			ret = errno;
 		}
 	}
 
@@ -468,8 +468,8 @@
 			cma_handler(event->id, event);
 			rdma_ack_cm_event(event);
 		} else {
-			printf("cmatose: failure in rdma_get_cm_event in disconnect events\n");
-			ret = err;
+			perror("cmatose: failure in rdma_get_cm_event in disconnect events");
+			ret = errno;
 		}
 	}
 
@@ -485,7 +485,7 @@
 
 	channel = rdma_create_event_channel();
 	if (!channel) {
-		printf("cmatose: failed to create event channel\n");
+		perror("cmatose: failed to create event channel");
 		return -1;
 	}
 
@@ -500,7 +500,7 @@
 		rdma_destroy_event_channel(test.channel);
 		test.channel = channel;
 	} else
-		printf("cmatose: failure migrating to channel: %d\n", ret);
+		perror("cmatose: failure migrating to channel");
 
 	return ret;
 }
@@ -535,7 +535,7 @@
 	printf("cmatose: starting server\n");
 	ret = rdma_create_id(test.channel, &listen_id, &test, RDMA_PS_TCP);
 	if (ret) {
-		printf("cmatose: listen request failed\n");
+		perror("cmatose: listen request failed");
 		return ret;
 	}
 
@@ -549,13 +549,13 @@
 	test.src_in.sin_port = port;
 	ret = rdma_bind_addr(listen_id, test.src_addr);
 	if (ret) {
-		printf("cmatose: bind address failed: %d\n", ret);
+		perror("cmatose: bind address failed");
 		goto out;
 	}
 
 	ret = rdma_listen(listen_id, 0);
 	if (ret) {
-		printf("cmatose: failure trying to listen: %d\n", ret);
+		perror("cmatose: failure trying to listen");
 		goto out;
 	}
 
@@ -631,7 +631,7 @@
 					src_addr ? test.src_addr : NULL,
 					test.dst_addr, 2000);
 		if (ret) {
-			printf("cmatose: failure getting addr: %d\n", ret);
+			perror("cmatose: failure getting addr");
 			connect_error();
 			return ret;
 		}

Modified: branches/ofed-1.5lenny/librdmacm/trunk/examples/mckey.c
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/examples/mckey.c?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/examples/mckey.c (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/examples/mckey.c Thu Feb  4 14:43:10 2010
@@ -159,7 +159,7 @@
 	init_qp_attr.recv_cq = node->cq;
 	ret = rdma_create_qp(node->cma_id, node->pd, &init_qp_attr);
 	if (ret) {
-		printf("mckey: unable to create QP: %d\n", ret);
+		perror("mckey: unable to create QP");
 		goto out;
 	}
 
@@ -258,7 +258,7 @@
 
 	ret = rdma_join_multicast(node->cma_id, test.dst_addr, node);
 	if (ret) {
-		printf("mckey: failure joining: %d\n", ret);
+		perror("mckey: failure joining");
 		goto err;
 	}
 	return 0;
@@ -452,7 +452,7 @@
 			ret = rdma_bind_addr(test.nodes[i].cma_id,
 					     test.src_addr);
 			if (ret) {
-				printf("mckey: addr bind failure: %d\n", ret);
+				perror("mckey: addr bind failure");
 				connect_error();
 				return ret;
 			}
@@ -465,7 +465,7 @@
 						test.src_addr, test.dst_addr,
 						2000);
 		if (ret) {
-			printf("mckey: resolve addr failure: %d\n", ret);
+			perror("mckey: resolve addr failure");
 			connect_error();
 			return ret;
 		}
@@ -502,7 +502,7 @@
 		ret = rdma_leave_multicast(test.nodes[i].cma_id,
 					   test.dst_addr);
 		if (ret)
-			printf("mckey: failure leaving: %d\n", ret);
+			perror("mckey: failure leaving");
 	}
 	return ret;
 }
@@ -561,7 +561,7 @@
 
 	test.channel = rdma_create_event_channel();
 	if (!test.channel) {
-		printf("failed to create event channel\n");
+		perror("failed to create event channel");
 		exit(1);
 	}
 

Modified: branches/ofed-1.5lenny/librdmacm/trunk/examples/rping.c
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/examples/rping.c?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/examples/rping.c (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/examples/rping.c Thu Feb  4 14:43:10 2010
@@ -174,7 +174,7 @@
 		ret = rdma_resolve_route(cma_id, 2000);
 		if (ret) {
 			cb->state = ERROR;
-			fprintf(stderr, "rdma_resolve_route error %d\n", ret);
+			perror("rdma_resolve_route");
 			sem_post(&cb->sem);
 		}
 		break;
@@ -352,7 +352,7 @@
 
 	ret = rdma_accept(cb->child_cm_id, &conn_param);
 	if (ret) {
-		fprintf(stderr, "rdma_accept error: %d\n", ret);
+		perror("rdma_accept");
 		return ret;
 	}
 
@@ -546,7 +546,7 @@
 
 	ret = rping_create_qp(cb);
 	if (ret) {
-		fprintf(stderr, "rping_create_qp failed: %d\n", ret);
+		perror("rdma_create_qp");
 		goto err3;
 	}
 	DEBUG_LOG("created qp %p\n", cb->qp);
@@ -570,7 +570,7 @@
 	while (1) {
 		ret = rdma_get_cm_event(cb->cm_channel, &event);
 		if (ret) {
-			fprintf(stderr, "rdma_get_cm_event err %d\n", ret);
+			perror("rdma_get_cm_event");
 			exit(ret);
 		}
 		ret = rping_cma_event_handler(event->id, event);
@@ -736,7 +736,7 @@
 
 	ret = rdma_bind_addr(cb->cm_id, (struct sockaddr *) &cb->sin);
 	if (ret) {
-		fprintf(stderr, "rdma_bind_addr error %d\n", ret);
+		perror("rdma_bind_addr");
 		return ret;
 	}
 	DEBUG_LOG("rdma_bind_addr successful\n");
@@ -744,7 +744,7 @@
 	DEBUG_LOG("rdma_listen\n");
 	ret = rdma_listen(cb->cm_id, 3);
 	if (ret) {
-		fprintf(stderr, "rdma_listen failed: %d\n", ret);
+		perror("rdma_listen");
 		return ret;
 	}
 
@@ -978,7 +978,7 @@
 
 	ret = rdma_connect(cb->cm_id, &conn_param);
 	if (ret) {
-		fprintf(stderr, "rdma_connect error %d\n", ret);
+		perror("rdma_connect");
 		return ret;
 	}
 
@@ -1003,7 +1003,7 @@
 
 	ret = rdma_resolve_addr(cb->cm_id, NULL, (struct sockaddr *) &cb->sin, 2000);
 	if (ret) {
-		fprintf(stderr, "rdma_resolve_addr error %d\n", ret);
+		perror("rdma_resolve_addr");
 		return ret;
 	}
 
@@ -1191,15 +1191,13 @@
 
 	cb->cm_channel = rdma_create_event_channel();
 	if (!cb->cm_channel) {
-		ret = errno;
-		fprintf(stderr, "rdma_create_event_channel error %d\n", ret);
+		perror("rdma_create_event_channel");
 		goto out;
 	}
 
 	ret = rdma_create_id(cb->cm_channel, &cb->cm_id, cb, RDMA_PS_TCP);
 	if (ret) {
-		ret = errno;
-		fprintf(stderr, "rdma_create_id error %d\n", ret);
+		perror("rdma_create_id");
 		goto out2;
 	}
 	DEBUG_LOG("created cm_id %p\n", cb->cm_id);

Modified: branches/ofed-1.5lenny/librdmacm/trunk/examples/udaddy.c
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/examples/udaddy.c?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/examples/udaddy.c (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/examples/udaddy.c Thu Feb  4 14:43:10 2010
@@ -158,7 +158,7 @@
 	init_qp_attr.recv_cq = node->cq;
 	ret = rdma_create_qp(node->cma_id, node->pd, &init_qp_attr);
 	if (ret) {
-		printf("udaddy: unable to create QP: %d\n", ret);
+		perror("udaddy: unable to create QP");
 		goto out;
 	}
 
@@ -245,12 +245,12 @@
 		ret = rdma_set_option(node->cma_id, RDMA_OPTION_ID,
 				      RDMA_OPTION_ID_TOS, &tos, sizeof tos);
 		if (ret)
-			printf("udaddy: set TOS option failed: %d\n", ret);
+			perror("udaddy: set TOS option failed");
 	}
 
 	ret = rdma_resolve_route(node->cma_id, 2000);
 	if (ret) {
-		printf("udaddy: resolve route failed: %d\n", ret);
+		perror("udaddy: resolve route failed");
 		connect_error();
 	}
 	return ret;
@@ -276,7 +276,7 @@
 	memset(&conn_param, 0, sizeof conn_param);
 	ret = rdma_connect(node->cma_id, &conn_param);
 	if (ret) {
-		printf("udaddy: failure connecting: %d\n", ret);
+		perror("udaddy: failure connecting");
 		goto err;
 	}
 	return 0;
@@ -316,7 +316,7 @@
 	conn_param.qp_num = node->cma_id->qp->qp_num;
 	ret = rdma_accept(node->cma_id, &conn_param);
 	if (ret) {
-		printf("udaddy: failure accepting: %d\n", ret);
+		perror("udaddy: failure accepting");
 		goto err2;
 	}
 	node->connected = 1;
@@ -532,7 +532,7 @@
 	printf("udaddy: starting server\n");
 	ret = rdma_create_id(test.channel, &listen_id, &test, port_space);
 	if (ret) {
-		printf("udaddy: listen request failed\n");
+		perror("udaddy: listen request failed");
 		return ret;
 	}
 
@@ -546,13 +546,13 @@
 	test.src_in.sin_port = port;
 	ret = rdma_bind_addr(listen_id, test.src_addr);
 	if (ret) {
-		printf("udaddy: bind address failed: %d\n", ret);
+		perror("udaddy: bind address failed");
 		return ret;
 	}
 
 	ret = rdma_listen(listen_id, 0);
 	if (ret) {
-		printf("udaddy: failure trying to listen: %d\n", ret);
+		perror("udaddy: failure trying to listen");
 		goto out;
 	}
 
@@ -604,7 +604,7 @@
 					src_addr ? test.src_addr : NULL,
 					test.dst_addr, 2000);
 		if (ret) {
-			printf("udaddy: failure getting addr: %d\n", ret);
+			perror("udaddy: failure getting addr");
 			connect_error();
 			return ret;
 		}
@@ -680,7 +680,7 @@
 
 	test.channel = rdma_create_event_channel();
 	if (!test.channel) {
-		printf("failed to create event channel\n");
+		perror("failed to create event channel");
 		exit(1);
 	}
 

Modified: branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec Thu Feb  4 14:43:10 2010
@@ -1,14 +1,14 @@
-%define ver 1.0.8
+%define ver 1.0.10
 
 Name: librdmacm
-Version: 1.0.8
-Release: 1.ofed1.4.1
+Version: 1.0.10
+Release: 1%{?dist}
 Summary: Userspace RDMA Connection Manager
 
 Group: System Environment/Libraries
 License: GPLv2 or BSD
 Url: http://www.openfabrics.org/
-Source: http://www.openfabrics.org/downloads/librdmacm-1.0.8.tar.gz
+Source: http://www.openfabrics.org/downloads/rdmacm/%{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: libibverbs-devel >= 1.1-1

Modified: branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec.in
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec.in?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec.in (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/librdmacm.spec.in Thu Feb  4 14:43:10 2010
@@ -1,7 +1,7 @@
 %define ver @VERSION@
 
 Name: librdmacm
-Version: 1.0.8
+Version: 1.0.10
 Release: 1%{?dist}
 Summary: Userspace RDMA Connection Manager
 

Modified: branches/ofed-1.5lenny/librdmacm/trunk/man/rdma_cm.7
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/man/rdma_cm.7?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/man/rdma_cm.7 (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/man/rdma_cm.7 Thu Feb  4 14:43:10 2010
@@ -108,18 +108,18 @@
 success
 .IP "= -1"
 error - see errno for more details
-.IP "< -1"
-error - see include/asm-generic/errno*.h for more details
 .P
-Librdmacm functions return 0 to indicate success, and a negative return value
+Librdmacm functions return 0 to indicate success, and a -1 return value
 to indicate failure.  If a function operates asynchronously, a return value of 0
 means that the operation was successfully started.  The operation could still
 complete in error; users should check the status of the related event.  If the
-return value is -1, then errno can be examined for additional information
-regarding the reason for the failure.  If the return value is < -1, then
-additional error reasons can be obtained by comparing the returned value with
-the values listed in include/asm-generic/errno-base.h and
-include/asm-generic/errno.h.
+return value is -1, then errno will contain additional information
+regarding the reason for the failure.
+.P
+Prior versions of the library would return -errno and not set errno for some cases
+related to ENOMEM, ENODEV, ENODATA, EINVAL, and EADDRNOTAVAIL codes. Applications
+that want to check these codes and have compatability with prior library versions
+must manually set errno to the negative of the return code if it is < -1.
 .SH "SEE ALSO"
 rdma_create_event_channel(3), rdma_get_cm_event(3), rdma_create_id(3),
 rdma_resolve_addr(3), rdma_bind_addr(3), rdma_create_qp(3),

Modified: branches/ofed-1.5lenny/librdmacm/trunk/src/cma.c
URL: http://svn.debian.org/wsvn/pkg-ofed/branches/ofed-1.5lenny/librdmacm/trunk/src/cma.c?rev=570&op=diff
==============================================================================
--- branches/ofed-1.5lenny/librdmacm/trunk/src/cma.c (original)
+++ branches/ofed-1.5lenny/librdmacm/trunk/src/cma.c Thu Feb  4 14:43:10 2010
@@ -76,6 +76,12 @@
 static inline uint64_t ntohll(uint64_t x) { return x; }
 #endif
 
+static inline int ERR(int err)
+{
+	errno = err;
+	return -1;
+}
+
 #define CMA_CREATE_MSG_CMD_RESP(msg, cmd, resp, type, size) \
 do {                                        \
 	struct ucma_abi_cmd_hdr *hdr;         \
@@ -83,7 +89,7 @@
 	size = sizeof(*hdr) + sizeof(*cmd); \
 	msg = alloca(size);                 \
 	if (!msg)                           \
-		return -ENOMEM;             \
+		return ERR(ENOMEM);         \
 	hdr = msg;                          \
 	cmd = msg + sizeof(*hdr);           \
 	hdr->cmd = type;                    \
@@ -92,18 +98,18 @@
 	memset(cmd, 0, sizeof(*cmd));       \
 	resp = alloca(sizeof(*resp));       \
 	if (!resp)                          \
-		return -ENOMEM;             \
+		return ERR(ENOMEM);         \
 	cmd->response = (uintptr_t)resp;\
 } while (0)
 
 #define CMA_CREATE_MSG_CMD(msg, cmd, type, size) \
 do {                                        \
-	struct ucma_abi_cmd_hdr *hdr;         \
+	struct ucma_abi_cmd_hdr *hdr;       \
                                             \
 	size = sizeof(*hdr) + sizeof(*cmd); \
 	msg = alloca(size);                 \
 	if (!msg)                           \
-		return -ENOMEM;             \
+		return ERR(ENOMEM);         \
 	hdr = msg;                          \
 	cmd = msg + sizeof(*hdr);           \
 	hdr->cmd = type;                    \
@@ -205,59 +211,67 @@
 	struct ibv_device **dev_list = NULL;
 	struct cma_device *cma_dev;
 	struct ibv_device_attr attr;
-	int i, ret;
+	int i, ret, dev_cnt;
 
 	pthread_mutex_lock(&mut);
-	if (cma_dev_cnt)
-		goto out;
+	if (cma_dev_cnt) {
+		pthread_mutex_unlock(&mut);
+		return 0;
+	}
 
 	ret = check_abi_version();
 	if (ret)
-		goto err;
-
-	dev_list = ibv_get_device_list(&cma_dev_cnt);
+		goto err1;
+
+	dev_list = ibv_get_device_list(&dev_cnt);
 	if (!dev_list) {
 		printf("CMA: unable to get RDMA device list\n");
-		ret = -ENODEV;
-		goto err;
-	}
-
-	cma_dev_array = malloc(sizeof *cma_dev * cma_dev_cnt);
+		ret = ERR(ENODEV);
+		goto err1;
+	}
+
+	cma_dev_array = malloc(sizeof *cma_dev * dev_cnt);
 	if (!cma_dev_array) {
-		ret = -ENOMEM;
-		goto err;
-	}
-
-	for (i = 0; dev_list[i]; ++i) {
+		ret = ERR(ENOMEM);
+		goto err2;
+	}
+
+	for (i = 0; dev_list[i];) {
 		cma_dev = &cma_dev_array[i];
 
 		cma_dev->guid = ibv_get_device_guid(dev_list[i]);
 		cma_dev->verbs = ibv_open_device(dev_list[i]);
 		if (!cma_dev->verbs) {
 			printf("CMA: unable to open RDMA device\n");
-			ret = -ENODEV;
-			goto err;
+			ret = ERR(ENODEV);
+			goto err3;
 		}
 
+		i++;
 		ret = ibv_query_device(cma_dev->verbs, &attr);
 		if (ret) {
 			printf("CMA: unable to query RDMA device\n");
-			goto err;
+			goto err3;
 		}
 
 		cma_dev->port_cnt = attr.phys_port_cnt;
 		cma_dev->max_initiator_depth = (uint8_t) attr.max_qp_init_rd_atom;
 		cma_dev->max_responder_resources = (uint8_t) attr.max_qp_rd_atom;
 	}
-out:
+
+	cma_dev_cnt = dev_cnt;
 	pthread_mutex_unlock(&mut);
 	ibv_free_device_list(dev_list);
 	return 0;
-err:
-	ucma_cleanup();
+
+err3:
+	while (i--)
+		ibv_close_device(cma_dev_array[i].verbs);
+	free(cma_dev_array);
+err2:
+	ibv_free_device_list(dev_list);
+err1:
 	pthread_mutex_unlock(&mut);
-	if (dev_list)
-		ibv_free_device_list(dev_list);
 	return ret;
 }
 
@@ -334,7 +348,7 @@
 		}
 	}
 
-	return -ENODEV;
+	return ERR(ENODEV);
 }
 
 static void ucma_free_id(struct cma_id_private *id_priv)
@@ -386,7 +400,7 @@
 
 	id_priv = ucma_alloc_id(channel, context, ps);
 	if (!id_priv)
-		return -ENOMEM;
+		return ERR(ENOMEM);
 
 	CMA_CREATE_MSG_CMD_RESP(msg, cmd, resp, UCMA_CMD_CREATE_ID, size);
 	cmd->uid = (uintptr_t) id_priv;
@@ -418,7 +432,7 @@
 
 	ret = write(fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
 
@@ -473,7 +487,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
 
@@ -481,7 +495,7 @@
 		id->route.path_rec = malloc(sizeof *id->route.path_rec *
 					    resp->num_paths);
 		if (!id->route.path_rec)
-			return -ENOMEM;
+			return ERR(ENOMEM);
 
 		id->route.num_paths = resp->num_paths;
 		for (i = 0; i < resp->num_paths; i++)
@@ -518,7 +532,7 @@
 	
 	addrlen = ucma_addrlen(addr);
 	if (!addrlen)
-		return -EINVAL;
+		return ERR(EINVAL);
 
 	CMA_CREATE_MSG_CMD(msg, cmd, UCMA_CMD_BIND_ADDR, size);
 	id_priv = container_of(id, struct cma_id_private, id);
@@ -527,7 +541,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	return ucma_query_route(id);
 }
@@ -542,7 +556,7 @@
 	
 	daddrlen = ucma_addrlen(dst_addr);
 	if (!daddrlen)
-		return -EINVAL;
+		return ERR(EINVAL);
 
 	CMA_CREATE_MSG_CMD(msg, cmd, UCMA_CMD_RESOLVE_ADDR, size);
 	id_priv = container_of(id, struct cma_id_private, id);
@@ -554,7 +568,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	memcpy(&id->route.addr.dst_addr, dst_addr, daddrlen);
 	return 0;
@@ -574,7 +588,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	return 0;
 }
@@ -600,7 +614,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
 
@@ -616,7 +630,7 @@
 	int qp_attr_mask, ret;
 
 	if (!id->qp)
-		return -EINVAL;
+		return ERR(EINVAL);
 
 	/* Need to update QP attributes from default values. */
 	qp_attr.qp_state = IBV_QPS_INIT;
@@ -686,7 +700,7 @@
 			return 0;
 		}
 	}
-	return -EINVAL;
+	return ERR(EINVAL);
 }
 
 static int ucma_init_conn_qp3(struct cma_id_private *id_priv, struct ibv_qp *qp)
@@ -790,11 +804,11 @@
 
 	id_priv = container_of(id, struct cma_id_private, id);
 	if (id->verbs != pd->context)
-		return -EINVAL;
+		return ERR(EINVAL);
 
 	qp = ibv_create_qp(pd, qp_init_attr);
 	if (!qp)
-		return -ENOMEM;
+		return ERR(ENOMEM);
 
 	if (ucma_is_ud_ps(id->ps))
 		ret = ucma_init_ud_qp(id_priv, qp);
@@ -825,7 +839,7 @@
 	     id_priv->cma_dev->max_responder_resources) ||
 	    (conn_param->initiator_depth >
 	     id_priv->cma_dev->max_initiator_depth))
-		return -EINVAL;
+		return ERR(EINVAL);
 
 	return 0;
 }
@@ -875,7 +889,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	return 0;
 }
@@ -894,7 +908,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	return ucma_query_route(id);
 }
@@ -932,7 +946,7 @@
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size) {
 		ucma_modify_qp_err(id);
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 	}
 
 	return 0;
@@ -958,7 +972,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	return 0;
 }
@@ -977,7 +991,7 @@
 	cmd->event = event;
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	return 0;
 }
@@ -997,7 +1011,7 @@
 		ret = ucma_modify_qp_sqd(id);
 		break;
 	default:
-		ret = -EINVAL;
+		ret = ERR(EINVAL);
 	}
 	if (ret)
 		return ret;
@@ -1008,7 +1022,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	return 0;
 }
@@ -1026,17 +1040,17 @@
 	id_priv = container_of(id, struct cma_id_private, id);
 	addrlen = ucma_addrlen(addr);
 	if (!addrlen)
-		return -EINVAL;
+		return ERR(EINVAL);
 
 	mc = malloc(sizeof *mc);
 	if (!mc)
-		return -ENOMEM;
+		return ERR(ENOMEM);
 
 	memset(mc, 0, sizeof *mc);
 	mc->context = context;
 	mc->id_priv = id_priv;
 	memcpy(&mc->addr, addr, addrlen);
-	if (pthread_cond_init(&id_priv->cond, NULL)) {
+	if (pthread_cond_init(&mc->cond, NULL)) {
 		ret = -1;
 		goto err1;
 	}
@@ -1053,7 +1067,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size) {
-		ret = (ret > 0) ? -ENODATA : ret;
+		ret = (ret >= 0) ? ERR(ENODATA) : -1;
 		goto err2;
 	}
 
@@ -1083,7 +1097,7 @@
 	
 	addrlen = ucma_addrlen(addr);
 	if (!addrlen)
-		return -EINVAL;
+		return ERR(EINVAL);
 
 	id_priv = container_of(id, struct cma_id_private, id);
 	pthread_mutex_lock(&id_priv->mut);
@@ -1096,7 +1110,7 @@
 		*pos = mc->next;
 	pthread_mutex_unlock(&id_priv->mut);
 	if (!mc)
-		return -EADDRNOTAVAIL;
+		return ERR(EADDRNOTAVAIL);
 
 	if (id->qp)
 		ibv_detach_mcast(id->qp, &mc->mgid, mc->mlid);
@@ -1106,7 +1120,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size) {
-		ret = (ret > 0) ? -ENODATA : ret;
+		ret = (ret >= 0) ? ERR(ENODATA) : -1;
 		goto free;
 	}
 
@@ -1146,7 +1160,7 @@
 	struct cma_event *evt;
 
 	if (!event)
-		return -EINVAL;
+		return ERR(EINVAL);
 
 	evt = container_of(event, struct cma_event, event);
 
@@ -1168,7 +1182,7 @@
 				evt->id_priv->id.context, evt->id_priv->id.ps);
 	if (!id_priv) {
 		ucma_destroy_kern_id(evt->id_priv->id.channel->fd, handle);
-		ret = -ENOMEM;
+		ret = ERR(ENOMEM);
 		goto err;
 	}
 
@@ -1207,7 +1221,7 @@
 
 	ret = write(id_priv->id.channel->fd, msg, size);
 	if (ret != size) {
-		ret = (ret > 0) ? -ENODATA : ret;
+		ret = (ret >= 0) ? ERR(ENODATA) : -1;
 		goto err;
 	}
 
@@ -1292,11 +1306,11 @@
 		return ret;
 
 	if (!event)
-		return -EINVAL;
+		return ERR(EINVAL);
 
 	evt = malloc(sizeof *evt);
 	if (!evt)
-		return -ENOMEM;
+		return ERR(ENOMEM);
 
 retry:
 	memset(evt, 0, sizeof *evt);
@@ -1304,7 +1318,7 @@
 	ret = write(channel->fd, msg, size);
 	if (ret != size) {
 		free(evt);
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 	}
 	
 	VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
@@ -1463,7 +1477,7 @@
 
 	ret = write(id->channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	return 0;
 }
@@ -1483,7 +1497,7 @@
 
 	ret = write(channel->fd, msg, size);
 	if (ret != size)
-		return (ret > 0) ? -ENODATA : ret;
+		return (ret >= 0) ? ERR(ENODATA) : -1;
 
 	VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
 




More information about the Pkg-ofed-commits mailing list