[openib-general] [PATCH] kill some ioctls

Roland Dreier roland at topspin.com
Mon Sep 6 16:06:31 PDT 2004


Get rid of some ioctls now that that the info is in sysfs...

 - R.

Index: infiniband/include/ts_ib_useraccess.h
===================================================================
--- infiniband/include/ts_ib_useraccess.h	(revision 715)
+++ infiniband/include/ts_ib_useraccess.h	(working copy)
@@ -37,8 +37,6 @@
  */
 typedef struct ib_user_mad_filter tTS_IB_USER_MAD_FILTER_STRUCT,
 	*tTS_IB_USER_MAD_FILTER;
-typedef struct ib_get_port_info_ioctl tTS_IB_GET_PORT_INFO_IOCTL_STRUCT,
-	*tTS_IB_GET_PORT_INFO_IOCTL;
 typedef struct ib_set_port_info_ioctl tTS_IB_SET_PORT_INFO_IOCTL_STRUCT,
 	*tTS_IB_SET_PORT_INFO_IOCTL;
 typedef struct ib_mad_process_ioctl tTS_IB_MAD_PROCESS_IOCTL_STRUCT,
@@ -47,8 +45,6 @@
 	*tTS_IB_QP_REGISTER_IOCTL;
 typedef struct ib_path_record_ioctl tTS_IB_PATH_RECORD_IOCTL_STRUCT,
 	*tTS_IB_PATH_RECORD_IOCTL;
-typedef struct ib_gid_entry_ioctl tTS_IB_GID_ENTRY_IOCTL_STRUCT,
-	*tTS_IB_GID_ENTRY_IOCTL;
 
 struct ib_user_mad_filter {
         tTS_IB_PORT                   port;
@@ -61,11 +57,6 @@
         tTS_IB_USER_MAD_FILTER_HANDLE handle;
 };
 
-struct ib_get_port_info_ioctl {
-        tTS_IB_PORT               port;
-        struct ib_port_attr       port_info;
-};
-
 struct ib_set_port_info_ioctl {
         tTS_IB_PORT            port;
 	int                    port_modify_mask;
@@ -82,16 +73,6 @@
         struct ib_path_record *path_record;
 };
 
-struct ib_gid_entry_ioctl {
-        u8                   port;
-        int                  index;
-	union ib_gid         gid_entry;
-};
-
-struct ib_get_dev_info_ioctl {
-        struct ib_device_attr dev_info;
-};
-
 /* Old useraccess module used magic 0xbb; we change it here so
    old binaries don't fail silently in strange ways. */
 #define TS_IB_IOCTL_MAGIC 0xbc
@@ -104,10 +85,6 @@
 #define TS_IB_IOCSMADFILTDEL     _IOW(TS_IB_IOCTL_MAGIC, 2, \
 				      tTS_IB_USER_MAD_FILTER_HANDLE *)
 
-/* Get port info */
-#define TS_IB_IOCGPORTINFO       _IOR(TS_IB_IOCTL_MAGIC, 3, \
-				      struct ib_get_port_info_ioctl *)
-
 /* Set port info */
 #define TS_IB_IOCSPORTINFO       _IOW(TS_IB_IOCTL_MAGIC, 4, \
 				      struct ib_set_port_info_ioctl *)
@@ -130,12 +107,4 @@
 #define TS_IB_IOCGPATHRECORD     _IOWR(TS_IB_IOCTL_MAGIC, 9, \
 				       struct ib_path_record_ioctl *)
 
-/* Fetch a GID */
-#define TS_IB_IOCGGIDENTRY       _IOWR(TS_IB_IOCTL_MAGIC, 10, \
-				       struct ib_gid_entry_ioctl *)
-
-/* Get device info */
-#define TS_IB_IOCGDEVINFO        _IOR(TS_IB_IOCTL_MAGIC, 11, \
-				     struct ib_get_dev_info_ioctl *)
-
 #endif /* _TS_IB_USERACCESS_H */
Index: infiniband/core/useraccess_ioctl.c
===================================================================
--- infiniband/core/useraccess_ioctl.c	(revision 715)
+++ infiniband/core/useraccess_ioctl.c	(working copy)
@@ -75,31 +75,6 @@
 	return tsIbUserFilterDel(priv, handle);
 }
 
-static int _tsIbUserIoctlGetPortInfo(struct ib_useraccess_private *priv,
-				     unsigned long arg)
-{
-	struct ib_get_port_info_ioctl get_port_info_ioctl;
-	int ret;
-
-	if (copy_from_user(&get_port_info_ioctl,
-			   (struct ib_get_port_info_ioctl *) arg,
-			   sizeof get_port_info_ioctl)) {
-		return -EFAULT;
-	}
-
-	ret = ib_query_port(priv->device->ib_device,
-			    get_port_info_ioctl.port,
-			    &get_port_info_ioctl.port_info);
-
-	if (ret) {
-		return -EFAULT;
-	}
-
-	return copy_to_user((struct ib_get_port_info_ioctl *) arg,
-			    &get_port_info_ioctl,
-			    sizeof get_port_info_ioctl) ? -EFAULT : 0;
-}
-
 static int _tsIbUserIoctlSetPortInfo(struct ib_useraccess_private *priv,
 				     unsigned long arg)
 {
@@ -221,30 +196,6 @@
 	return 0;
 }
 
-static int _tsIbUserIoctlGetGidEntry(struct ib_useraccess_private *priv,
-				     unsigned long arg)
-{
-	struct ib_gid_entry_ioctl gid_ioctl;
-	int ret;
-
-	if (copy_from_user(&gid_ioctl, (void *)arg, sizeof(gid_ioctl))) {
-		return -EFAULT;
-	}
-
-	ret = ib_query_gid(priv->device->ib_device, gid_ioctl.port,
-			   gid_ioctl.index, &gid_ioctl.gid_entry);
-
-	if (ret) {
-		return ret;
-	}
-
-	if (copy_to_user((void *)arg, &gid_ioctl, sizeof(gid_ioctl))) {
-		return -EFAULT;
-	}
-
-	return 0;
-}
-
 static int _tsIbUserIoctlMadProcess(struct ib_useraccess_private *priv,
 				    unsigned long arg)
 {
@@ -297,32 +248,6 @@
 	return ret;
 }
 
-static int ib_user_ioctl_get_dev_info(struct ib_useraccess_private *priv,
-				      unsigned long arg)
-{
-	struct ib_get_dev_info_ioctl *get_dev_info_ioctl;
-	int ret;
-
-	get_dev_info_ioctl = kmalloc(sizeof *get_dev_info_ioctl,
-				     GFP_KERNEL);
-	if (!get_dev_info_ioctl)
-		return -ENOMEM;
-
-	ret = ib_query_device(priv->device->ib_device,
-			      &get_dev_info_ioctl->dev_info);
-
-	if (ret)
-		goto out;
-
-	ret = copy_to_user((struct ib_get_dev_info_ioctl *) arg,
-			   get_dev_info_ioctl,
-			   sizeof *get_dev_info_ioctl) ? -EFAULT : 0;
-
-out:
-	kfree(get_dev_info_ioctl);
-	return ret;
-}
-
 static const struct {
 	int cmd;
 	int (*function) (struct ib_useraccess_private *, unsigned long);
@@ -334,9 +259,6 @@
 	{ .cmd 	    = TS_IB_IOCSMADFILTDEL,
 	  .function = _tsIbUserIoctlMadFiltDel,
 	  .name     = "delete MAD filter" },
-	{ .cmd 	    = TS_IB_IOCGPORTINFO,
-	  .function = _tsIbUserIoctlGetPortInfo,
-	  .name     = "get port info" },
 	{ .cmd 	    = TS_IB_IOCSPORTINFO,
 	  .function = _tsIbUserIoctlSetPortInfo,
 	  .name     = "set port info" },
@@ -346,15 +268,9 @@
 	{ .cmd 	    = TS_IB_IOCSRCVQUEUELENGTH,
 	  .function = _tsIbUserIoctlSetReceiveQueueLength,
 	  .name     = "set receive queue length" },
-	{ .cmd 	    = TS_IB_IOCGGIDENTRY,
-	  .function = _tsIbUserIoctlGetGidEntry,
-	  .name     = "get GID entry" },
 	{ .cmd 	    = TS_IB_IOCMADPROCESS,
 	  .function = _tsIbUserIoctlMadProcess,
 	  .name     = "process MAD" },
-	{ .cmd 	    = TS_IB_IOCGDEVINFO,
-	  .function = ib_user_ioctl_get_dev_info,
-	  .name     = "get device info" }
 };
 
 static const int num_ioctl = sizeof ioctl_table / sizeof ioctl_table[0];



More information about the general mailing list