Blob Blame History Raw
From 8625a69de7a319a0a1f3e4c86a0f14eda7e1612c Mon Sep 17 00:00:00 2001
From: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
Date: Wed, 17 Apr 2019 10:06:07 +0200
Subject: [PATCH 1/3] umad2sim: Do not use umad.h deprecated functions

ntohll and htonll are deprecated in libibumad.
Use the glibc functions instead

Also, remove no longer needed includes

Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
 umad2sim/umad2sim.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/umad2sim/umad2sim.c b/umad2sim/umad2sim.c
index 46510b0..023ae79 100644
--- a/umad2sim/umad2sim.c
+++ b/umad2sim/umad2sim.c
@@ -35,7 +35,6 @@
 
 #define _GNU_SOURCE
 
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/poll.h>
 #include <sys/ioctl.h>
@@ -49,7 +48,6 @@
 #include <string.h>
 #include <dirent.h>
 #include <dlfcn.h>
-#include <netinet/in.h>
 
 #include <infiniband/umad.h>
 #include <infiniband/mad.h>
@@ -442,7 +440,7 @@ static ssize_t umad2sim_read(struct umad2sim_dev *dev, void *buf, size_t count)
 	umad->status = ntohl(req.status);
 	umad->timeout_ms = 0;
 	umad->retries = 0;
-	umad->length = umad_size() + ntohll(req.length);
+	umad->length = umad_size() + be64toh(req.length);
 
 	umad->addr.qpn = req.sqp;
 	umad->addr.qkey = 0;	// agent->qkey;
@@ -506,7 +504,7 @@ static ssize_t umad2sim_write(struct umad2sim_dev *dev,
 		cnt = sizeof(req.mad);
 	memcpy(req.mad, umad_get_mad(umad), cnt);
 
-	req.length = htonll(cnt);
+	req.length = htobe64(cnt);
 
 	if (!mad_get_field(req.mad, 0, IB_MAD_RESPONSE_F)) {
 		uint64_t trid = mad_get_field64(req.mad, 0, IB_MAD_TRID_F);
-- 
2.20.1