diff options
author | Roland Dreier <rolandd@cisco.com> | 2007-06-18 19:17:54 -0700 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-06-18 19:18:43 -0700 |
commit | e5d3bd23d3e686f6627798f611cba47bce6b6651 (patch) | |
tree | b48a1e924faaca147a474c1ce1f9b82a37873e0b | |
parent | 596636e0773ceda258fd18a49924e1b73c011f24 (diff) | |
download | libmlx4-e5d3bd23d3e686f6627798f611cba47bce6b6651.tar.gz |
Remove private implementation of ibv_read_sysfs_file()
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>
-rw-r--r-- | configure.in | 5 | ||||
-rw-r--r-- | src/mlx4.c | 36 |
2 files changed, 3 insertions, 38 deletions
diff --git a/configure.in b/configure.in index b7d274b..fbc8762 100644 --- a/configure.in +++ b/configure.in @@ -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$$ @@ -46,12 +46,6 @@ #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) { |