]> git.openfabrics.org - ~shefty/libmlx4.git/commitdiff
Remove private implementation of ibv_read_sysfs_file()
authorRoland Dreier <rolandd@cisco.com>
Tue, 19 Jun 2007 02:17:54 +0000 (19:17 -0700)
committerRoland Dreier <rolandd@cisco.com>
Tue, 19 Jun 2007 02:18:43 +0000 (19:18 -0700)
The release of libibverbs 1.0.3 (which introduced
ibv_read_sysfs_file()) was more than a year ago, so it seems safe for
libmlx4 to depend on it.  In fact libmlx4 relies on the recent fix to
libibverbs to set the state of newly created QPs, so libmlx4 wouldn't
have a chance at working with libibverbs 1.0.2 or older anyway.  So
remove libmlx4's private implementation of ibv_read_sysfs_file() and
just fail the build if libibverbs doesn't supply the function.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
configure.in
src/mlx4.c

index b7d274b5e66666d534d569e6cbf3d36d69b8d72f..fbc8762e9f03eb23b45f2d370cec1c51521ef3c7 100644 (file)
@@ -43,8 +43,9 @@ AC_C_CONST
 AC_CHECK_SIZEOF(long)
 
 dnl Checks for library functions
-AC_CHECK_FUNCS(ibv_read_sysfs_file ibv_dontfork_range ibv_dofork_range \
-    ibv_register_driver)
+AC_CHECK_FUNC(ibv_read_sysfs_file, [],
+    AC_MSG_ERROR([ibv_read_sysfs_file() not found.  libmlx4 requires libibverbs >= 1.0.3.]))
+AC_CHECK_FUNCS(ibv_dontfork_range ibv_dofork_range ibv_register_driver)
 
 dnl Now check if for libibverbs 1.0 vs 1.1
 dummy=if$$
index ac522a7315b4c93c27163ce24186c36f940bd393..3684b50336e46f7503720446b7c1050b9516151d 100644 (file)
 #include <sysfs/libsysfs.h>
 #endif
 
-#ifndef HAVE_IBV_READ_SYSFS_FILE
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#endif
-
 #include "mlx4.h"
 #include "mlx4-abi.h"
 
@@ -194,36 +188,6 @@ static struct ibv_device_ops mlx4_dev_ops = {
        .free_context  = mlx4_free_context
 };
 
-/*
- * Keep a private implementation of HAVE_IBV_READ_SYSFS_FILE to handle
- * old versions of libibverbs that didn't implement it.  This can be
- * removed when libibverbs 1.0.3 or newer is available "everywhere."
- */
-#ifndef HAVE_IBV_READ_SYSFS_FILE
-static int ibv_read_sysfs_file(const char *dir, const char *file,
-                              char *buf, size_t size)
-{
-       char path[256];
-       int fd;
-       int len;
-
-       snprintf(path, sizeof path, "%s/%s", dir, file);
-
-       fd = open(path, O_RDONLY);
-       if (fd < 0)
-               return -1;
-
-       len = read(fd, buf, size);
-
-       close(fd);
-
-       if (len > 0 && buf[len - 1] == '\n')
-               buf[--len] = '\0';
-
-       return len;
-}
-#endif /* HAVE_IBV_READ_SYSFS_FILE */
-
 static struct ibv_device *mlx4_driver_init(const char *uverbs_sys_path,
                                            int abi_version)
 {