[openib-general] [PATCH] resend: update libipathverbs library to the new initialization method
Ralph Campbell
ralphc at pathscale.com
Fri Jun 16 16:15:41 PDT 2006
The patch I just sent left out a minor change so please
ignore the previous patch and apply this one instead.
(I forgot to include the change to the map file)
Signed-off-by: Ralph Campbell <ralph.campbell at qlogic.com>
Index: src/userspace/libipathverbs/src/ipathverbs.c
===================================================================
--- src/userspace/libipathverbs/src/ipathverbs.c (revision 8089)
+++ 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/usrspace/libipathverbs/src/ipathverbs.h
===================================================================
--- src/usrspace/libipathverbs/src/ipathverbs.h (revision 8089)
+++ src/usrspace/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 {
Index: src/userspace/libipathverbs/src/ipathverbs.map
===================================================================
--- src/userspace/libipathverbs/src/ipathverbs.map (revision 8089)
+++ src/userspace/libipathverbs/src/ipathverbs.map (working copy)
@@ -1,4 +1,4 @@
{
- global: openib_driver_init;
+ global: ibv_driver_init;
local: *;
};
--
Ralph Campbell <ralphc at pathscale.com>
More information about the general
mailing list