[openib-general] [PATCH] change libipathverbs to use the new initialization convention

Ralph Campbell ralphc at pathscale.com
Tue Jun 27 14:06:02 PDT 2006


The libibverbs.so.2 has a different device plug-in module
intialization convention from libibverbs.so.1.  This patch
updates the InfiniPath libipathverbs module to conform
to the new convention.

Signed-off-by Ralph Campbell <ralph.campbell at qlogic.com>

Index: src/userspace/libipathverbs/src/ipathverbs.map
===================================================================
--- src/userspace/libipathverbs/src/ipathverbs.map	(revision 8255)
+++ src/userspace/libipathverbs/src/ipathverbs.map	(working copy)
@@ -1,4 +1,4 @@
 {
-	global: openib_driver_init;
+	global: ibv_driver_init;
 	local: *;
 };
Index: src/userspace/libipathverbs/src/ipathverbs.c
===================================================================
--- src/userspace/libipathverbs/src/ipathverbs.c	(revision 8255)
+++ src/userspace/libipathverbs/src/ipathverbs.c	(working copy)
@@ -145,30 +145,24 @@
 	.free_context	= ipath_free_context
 };
 
-struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
+struct ibv_device *ibv_driver_init(const char *uverbs_sys_path,
+				   int abi_version)
 {
-	struct sysfs_device    *pcidev;
-	struct sysfs_attribute *attr;
+	char			value[8];
 	struct ipath_device    *dev;
-	unsigned		vendor, device;
-	int			i;
+	unsigned                vendor, device;
+	int                     i;
 
-	pcidev = sysfs_get_classdev_device(sysdev);
-	if (!pcidev)
+	if (ibv_read_sysfs_file(uverbs_sys_path, "device/vendor",
+				value, sizeof value) < 0)
 		return NULL;
+	sscanf(value, "%i", &vendor);
 
-	attr = sysfs_get_device_attr(pcidev, "vendor");
-	if (!attr)
+	if (ibv_read_sysfs_file(uverbs_sys_path, "device/device",
+				value, sizeof value) < 0)
 		return NULL;
-	sscanf(attr->value, "%i", &vendor);
-	sysfs_close_attribute(attr);
+	sscanf(value, "%i", &device);
 
-	attr = sysfs_get_device_attr(pcidev, "device");
-	if (!attr)
-		return NULL;
-	sscanf(attr->value, "%i", &device);
-	sysfs_close_attribute(attr);
-
 	for (i = 0; i < sizeof hca_table / sizeof hca_table[0]; ++i)
 		if (vendor == hca_table[i].vendor &&
 		    device == hca_table[i].device)
@@ -180,13 +174,12 @@
 	dev = malloc(sizeof *dev);
 	if (!dev) {
 		fprintf(stderr, PFX "Fatal: couldn't allocate device for %s\n",
-			sysdev->name);
-		abort();
+			uverbs_sys_path);
+		return NULL;
 	}
 
 	dev->ibv_dev.ops = ipath_dev_ops;
 	dev->hca_type    = hca_table[i].type;
-	dev->page_size   = sysconf(_SC_PAGESIZE);
 
 	return &dev->ibv_dev;
 }
Index: src/userspace/libipathverbs/src/ipathverbs.h
===================================================================
--- src/userspace/libipathverbs/src/ipathverbs.h	(revision 8255)
+++ src/userspace/libipathverbs/src/ipathverbs.h	(working copy)
@@ -57,7 +57,6 @@
 struct ipath_device {
 	struct ibv_device	ibv_dev;
 	enum ipath_hca_type	hca_type;
-	int			page_size;
 };
 
 struct ipath_context {






More information about the general mailing list