[ofa-general] ***SPAM*** [PATCH] ibsim/umad2sim.c: Eliminate unneeded umad2sim_dev num

Hal Rosenstock hnrose at comcast.net
Thu Feb 19 09:44:13 PST 2009


Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---
diff --git a/umad2sim/umad2sim.c b/umad2sim/umad2sim.c
index e13e30a..aaa6260 100644
--- a/umad2sim/umad2sim.c
+++ b/umad2sim/umad2sim.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This file is part of ibsim.
  *
@@ -77,7 +78,6 @@ struct ib_user_mad_reg_req {
 
 struct umad2sim_dev {
 	int fd;
-	unsigned num;
 	char name[32];
 	uint8_t port;
 	struct sim_client sim_client;
@@ -351,15 +351,13 @@ static int dev_sysfs_create(struct umad2sim_dev *dev)
 	*str = '\0';
 
 	/* /sys/class/infiniband_mad/umad0/ */
-	snprintf(path, sizeof(path), "%s/umad%u", sysfs_infiniband_mad_dir,
-		 dev->num);
+	snprintf(path, sizeof(path), "%s/umad%u", sysfs_infiniband_mad_dir, 0);
 	make_path(path);
 	file_printf(path, SYS_IB_MAD_DEV, "%s\n", dev->name);
 	file_printf(path, SYS_IB_MAD_PORT, "%d\n", dev->port);
 
 	/* /sys/class/infiniband_mad/issm0/ */
-	snprintf(path, sizeof(path), "%s/issm%u", sysfs_infiniband_mad_dir,
-		 dev->num);
+	snprintf(path, sizeof(path), "%s/issm%u", sysfs_infiniband_mad_dir, 0);
 	make_path(path);
 	file_printf(path, SYS_IB_MAD_DEV, "%s\n", dev->name);
 	file_printf(path, SYS_IB_MAD_PORT, "%d\n", dev->port);
@@ -546,7 +544,7 @@ static int umad2sim_ioctl(struct umad2sim_dev *dev, unsigned long request,
 	return -1;
 }
 
-static struct umad2sim_dev *umad2sim_dev_create(unsigned num, const char *name)
+static struct umad2sim_dev *umad2sim_dev_create(const char *name)
 {
 	struct umad2sim_dev *dev;
 	unsigned i;
@@ -558,7 +556,6 @@ static struct umad2sim_dev *umad2sim_dev_create(unsigned num, const char *name)
 		return NULL;
 	memset(dev, 0, sizeof(*dev));
 
-	dev->num = num;
 	strncpy(dev->name, name, sizeof(dev->name) - 1);
 
 	if (sim_client_init(&dev->sim_client) < 0)
@@ -574,9 +571,9 @@ static struct umad2sim_dev *umad2sim_dev_create(unsigned num, const char *name)
 	dev_sysfs_create(dev);
 
 	snprintf(dev->umad_path, sizeof(dev->umad_path), "%s/%s%u",
-		 umad_dev_dir, "umad", num);
+		 umad_dev_dir, "umad", 0);
 	snprintf(dev->issm_path, sizeof(dev->issm_path), "%s/%s%u",
-		 umad_dev_dir, "issm", num);
+		 umad_dev_dir, "issm", 0);
 
 	return dev;
 
@@ -646,7 +643,7 @@ static void umad2sim_init(void)
 	DEBUG("umad2sim_init...\n");
 	snprintf(umad2sim_sysfs_prefix, sizeof(umad2sim_sysfs_prefix),
 		 "./sys-%d", getpid());
-	devices[0] = umad2sim_dev_create(0, "ibsim0");
+	devices[0] = umad2sim_dev_create("ibsim0");
 	if (!devices[0]) {
 		ERROR("cannot init umad2sim. Exit.\n");
 		exit(-1);



More information about the general mailing list