All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] staging: unisys: added virtpci info entry
@ 2014-07-10 14:34 Erik Arfvidson
  2014-07-10 14:51 ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Erik Arfvidson @ 2014-07-10 14:34 UTC (permalink / raw)
  To: gregkh, sparmaintainer, driverdev-devel, benjamin.romer; +Cc: Erik Arfvidson

This patch adds the virtpci debugfs directory and the info entry
inside of it.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/virtpci/virtpci.c | 123 ++++++++++++++++++++++++++++++-
 1 file changed, 119 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c
index 7d840b0..722bc1b 100644
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ b/drivers/staging/unisys/virtpci/virtpci.c
@@ -36,6 +36,7 @@
 #include <linux/mod_devicetable.h>
 #include <linux/if_ether.h>
 #include <linux/version.h>
+#include <linux/debugfs.h>
 #include "version.h"
 #include "guestlinuxdebug.h"
 #include "timskmodutils.h"
@@ -100,6 +101,12 @@ static int virtpci_device_resume(struct device *dev);
 static int virtpci_device_probe(struct device *dev);
 static int virtpci_device_remove(struct device *dev);
 
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+			      size_t len, loff_t *offset);
+
+static const struct file_operations debugfs_info_fops = {
+	.read = info_debugfs_read,
+};
 
 /*****************************************************/
 /* Globals                                           */
@@ -139,7 +146,19 @@ static DEFINE_RWLOCK(VpcidevListLock);
 
 /* filled in with info about this driver, wrt it servicing client busses */
 static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo;
-
+/*****************************************************/
+/* DebugFS entries                                   */
+/*****************************************************/
+/* dentry is used to create the debugfs entry directory
+ * for virtpci
+ */
+static struct dentry *virtpci_debugfs_dir;
+static struct dentry *info_debugfs_entry;
+/* info_debugfs_entry is used to tell virtpci to display current info
+ * kept in the driver
+ */
+#define DIR_DEBUGFS_ENTRY "virtpci"
+#define INFO_DEBUGFS_ENTRY_FN "info"
 
 struct virtpci_busdev {
 	struct device virtpci_bus_device;
@@ -588,7 +607,8 @@ static void delete_all(void)
 /* deletes all vnics or vhbas
  * returns 0 failure, 1 success,
  */
-static int delete_all_virt(VIRTPCI_DEV_TYPE devtype, struct del_vbus_guestpart *delparams)
+static int delete_all_virt(VIRTPCI_DEV_TYPE devtype,
+			struct del_vbus_guestpart *delparams)
 {
 	int i;
 	unsigned char busid[BUS_ID_SIZE];
@@ -1375,6 +1395,97 @@ void virtpci_unregister_driver(struct virtpci_driver *drv)
 	DBGINF("Leaving\n");
 }
 EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
+/*****************************************************/
+/* debugfs filesystem functions						*/
+/*****************************************************/
+struct print_vbus_info {
+	int *length;
+	char *buf;
+};
+
+static int print_vbus(struct device *vbus, void *data)
+{
+	struct print_vbus_info *p = (struct print_vbus_info *)data;
+
+	*p->length += sprintf(p->buf + *p->length, "bus_id:%s\n",
+			      dev_name(vbus));
+	return 0;		/* no error */
+}
+
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+			      size_t len, loff_t *offset)
+{
+	int str_pos = 0;
+	struct virtpci_dev *tmpvpcidev;
+	unsigned long flags;
+	struct print_vbus_info printparam;
+	char *vbuf;
+	loff_t pos = *offset;
+
+	if (pos < 0)
+		return -EINVAL;
+
+	if (pos > 0 || !len)
+		return 0;
+
+	vbuf = kzalloc(len, GFP_KERNEL);
+	if (!vbuf)
+		return -ENOMEM;
+
+
+	str_pos += snprintf(vbuf + str_pos, len - str_pos,
+			"\n Virtual PCI Bus devices\n");
+	printparam.length = &str_pos;
+	printparam.buf = vbuf;
+	if (bus_for_each_dev(&virtpci_bus_type, NULL,
+			     (void *) &printparam, print_vbus))
+		LOGERR("Failed to find bus\n");
+
+	str_pos += snprintf(vbuf + str_pos, len - str_pos,
+			"\n Virtual PCI devices\n");
+	read_lock_irqsave(&VpcidevListLock, flags);
+	tmpvpcidev = VpcidevListHead;
+	while (tmpvpcidev) {
+		if (tmpvpcidev->devtype == VIRTHBA_TYPE) {
+			str_pos += snprintf(vbuf + str_pos, len - str_pos,
+					"[%d:%d] VHba:%08x:%08x max-config:%d-%d-%d-%d",
+				    tmpvpcidev->busNo, tmpvpcidev->deviceNo,
+				    tmpvpcidev->scsi.wwnn.wwnn1,
+				    tmpvpcidev->scsi.wwnn.wwnn2,
+				    tmpvpcidev->scsi.max.max_channel,
+				    tmpvpcidev->scsi.max.max_id,
+				    tmpvpcidev->scsi.max.max_lun,
+				    tmpvpcidev->scsi.max.cmd_per_lun);
+		} else {
+			str_pos += snprintf(vbuf + str_pos, len - str_pos,
+					"[%d:%d] VNic:%02x:%02x:%02x:%02x:%02x:%02x num_rcv_bufs:%d mtu:%d",
+				    tmpvpcidev->busNo, tmpvpcidev->deviceNo,
+				    tmpvpcidev->net.mac_addr[0],
+				    tmpvpcidev->net.mac_addr[1],
+				    tmpvpcidev->net.mac_addr[2],
+				    tmpvpcidev->net.mac_addr[3],
+				    tmpvpcidev->net.mac_addr[4],
+				    tmpvpcidev->net.mac_addr[5],
+				    tmpvpcidev->net.num_rcv_bufs,
+				    tmpvpcidev->net.mtu);
+		}
+		str_pos +=
+		    snprintf(vbuf + str_pos, len - str_pos, " chanptr:%p\n",
+			    tmpvpcidev->queueinfo.chan);
+		tmpvpcidev = tmpvpcidev->next;
+	}
+	read_unlock_irqrestore(&VpcidevListLock, flags);
+
+	str_pos += snprintf(vbuf + str_pos, len - str_pos, "\n");
+	if (copy_to_user(buf, vbuf, str_pos)) {
+		kfree(vbuf);
+		return -EFAULT;
+	}
+
+	kfree(vbuf);
+	*offset += str_pos;
+	return str_pos;
+}
 
 /*****************************************************/
 /* Module Init & Exit functions                      */
@@ -1426,7 +1537,10 @@ static int __init virtpci_mod_init(void)
 
 	LOGINF("successfully registered virtpci_ctrlchan_func (0x%p) as callback.\n",
 	     (void *) &virtpci_ctrlchan_func);
-
+	/* create debugfs directory. */
+	virtpci_debugfs_dir = debugfs_create_dir(DIR_DEBUGFS_ENTRY, NULL);
+	info_debugfs_entry = debugfs_create_file(INFO_DEBUGFS_ENTRY_FN, S_IRUSR,
+				virtpci_debugfs_dir, NULL, &debugfs_info_fops);
 	LOGINF("Leaving\n");
 	POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO);
 	return 0;
@@ -1442,7 +1556,8 @@ static void __exit virtpci_mod_exit(void)
 
 	device_unregister(&virtpci_rootbus_device);
 	bus_unregister(&virtpci_bus_type);
-
+	/* debug_fs file and directory removal. */
+	debugfs_remove(virtpci_debugfs_dir);
 	LOGINF("Leaving\n");
 
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH 2/2] staging: unisys: added virtpci info entry
@ 2014-07-09 20:22 Erik Arfvidson
  2014-07-09 20:40 ` Greg KH
  2014-07-09 20:41 ` Greg KH
  0 siblings, 2 replies; 11+ messages in thread
From: Erik Arfvidson @ 2014-07-09 20:22 UTC (permalink / raw)
  To: gregkh, sparmaintainer, driverdev-devel, benjamin.romer; +Cc: Erik Arfvidson

This patch adds the virtpci debugfs directory and the info entry
inside of it.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
---
 drivers/staging/unisys/virtpci/virtpci.c | 123 ++++++++++++++++++++++++++++++-
 1 file changed, 119 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c
index 7d840b0..68fbe85 100644
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ b/drivers/staging/unisys/virtpci/virtpci.c
@@ -37,6 +37,7 @@
 #include <linux/if_ether.h>
 #include <linux/version.h>
 #include "version.h"
+ #include <linux/debugfs.h>
 #include "guestlinuxdebug.h"
 #include "timskmodutils.h"
 
@@ -100,6 +101,12 @@ static int virtpci_device_resume(struct device *dev);
 static int virtpci_device_probe(struct device *dev);
 static int virtpci_device_remove(struct device *dev);
 
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+			      size_t len, loff_t *offset);
+
+static const struct file_operations debugfs_info_fops = {
+	.read = info_debugfs_read,
+};
 
 /*****************************************************/
 /* Globals                                           */
@@ -139,7 +146,19 @@ static DEFINE_RWLOCK(VpcidevListLock);
 
 /* filled in with info about this driver, wrt it servicing client busses */
 static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo;
-
+/*****************************************************/
+/* DebugFS entries                                   */
+/*****************************************************/
+/* dentry is used to create the debugfs entry directory
+ * for virtpci
+ */
+static struct dentry *virtpci_debugfs_dir;
+static struct dentry *info_debugfs_entry;
+/* info_debugfs_entry is used to tell virtpci to display current info
+ * kept in the driver
+ */
+#define DIR_DEBUGFS_ENTRY "virtpci"
+#define INFO_DEBUGFS_ENTRY_FN "info"
 
 struct virtpci_busdev {
 	struct device virtpci_bus_device;
@@ -588,7 +607,8 @@ static void delete_all(void)
 /* deletes all vnics or vhbas
  * returns 0 failure, 1 success,
  */
-static int delete_all_virt(VIRTPCI_DEV_TYPE devtype, struct del_vbus_guestpart *delparams)
+static int delete_all_virt(VIRTPCI_DEV_TYPE devtype,
+			struct del_vbus_guestpart *delparams)
 {
 	int i;
 	unsigned char busid[BUS_ID_SIZE];
@@ -1375,6 +1395,97 @@ void virtpci_unregister_driver(struct virtpci_driver *drv)
 	DBGINF("Leaving\n");
 }
 EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
+/*****************************************************/
+/* debugfs filesystem functions						*/
+/*****************************************************/
+struct print_vbus_info {
+	int *length;
+	char *buf;
+};
+
+static int print_vbus(struct device *vbus, void *data)
+{
+	struct print_vbus_info *p = (struct print_vbus_info *)data;
+
+	*p->length += sprintf(p->buf + *p->length, "bus_id:%s\n",
+			      dev_name(vbus));
+	return 0;		/* no error */
+}
+
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+			      size_t len, loff_t *offset)
+{
+	int str_pos = 0;
+	struct virtpci_dev *tmpvpcidev;
+	unsigned long flags;
+	struct print_vbus_info printparam;
+	char *vbuf;
+	loff_t pos = *offset;
+
+	if (pos < 0)
+		return -EINVAL;
+
+	if (pos > 0 || !len)
+		return 0;
+
+	vbuf = kzalloc(len, GFP_KERNEL);
+	if (!vbuf)
+		return -ENOMEM;
+
+
+	str_pos += snprintf(vbuf + str_pos, len - str_pos,
+			"\n Virtual PCI Bus devices\n");
+	printparam.length = &str_pos;
+	printparam.buf = vbuf;
+	if (bus_for_each_dev(&virtpci_bus_type, NULL,
+			     (void *) &printparam, print_vbus))
+		LOGERR("Failed to find bus\n");
+
+	str_pos += snprintf(vbuf + str_pos, len - str_pos,
+			"\n Virtual PCI devices\n");
+	read_lock_irqsave(&VpcidevListLock, flags);
+	tmpvpcidev = VpcidevListHead;
+	while (tmpvpcidev) {
+		if (tmpvpcidev->devtype == VIRTHBA_TYPE) {
+			str_pos += snprintf(vbuf + str_pos, len - str_pos,
+					"[%d:%d] VHba:%08x:%08x max-config:%d-%d-%d-%d",
+				    tmpvpcidev->busNo, tmpvpcidev->deviceNo,
+				    tmpvpcidev->scsi.wwnn.wwnn1,
+				    tmpvpcidev->scsi.wwnn.wwnn2,
+				    tmpvpcidev->scsi.max.max_channel,
+				    tmpvpcidev->scsi.max.max_id,
+				    tmpvpcidev->scsi.max.max_lun,
+				    tmpvpcidev->scsi.max.cmd_per_lun);
+		} else {
+			str_pos += snprintf(vbuf + str_pos, len - str_pos,
+					"[%d:%d] VNic:%02x:%02x:%02x:%02x:%02x:%02x num_rcv_bufs:%d mtu:%d",
+				    tmpvpcidev->busNo, tmpvpcidev->deviceNo,
+				    tmpvpcidev->net.mac_addr[0],
+				    tmpvpcidev->net.mac_addr[1],
+				    tmpvpcidev->net.mac_addr[2],
+				    tmpvpcidev->net.mac_addr[3],
+				    tmpvpcidev->net.mac_addr[4],
+				    tmpvpcidev->net.mac_addr[5],
+				    tmpvpcidev->net.num_rcv_bufs,
+				    tmpvpcidev->net.mtu);
+		}
+		str_pos +=
+		    snprintf(vbuf + str_pos, len - str_pos, " chanptr:%p\n",
+			    tmpvpcidev->queueinfo.chan);
+		tmpvpcidev = tmpvpcidev->next;
+	}
+	read_unlock_irqrestore(&VpcidevListLock, flags);
+
+	str_pos += snprintf(vbuf + str_pos, len - str_pos, "\n");
+	if (copy_to_user(buf, vbuf, str_pos)) {
+		kfree(vbuf);
+		return -EFAULT;
+	}
+
+	kfree(vbuf);
+	*offset += str_pos;
+	return str_pos;
+}
 
 /*****************************************************/
 /* Module Init & Exit functions                      */
@@ -1426,7 +1537,10 @@ static int __init virtpci_mod_init(void)
 
 	LOGINF("successfully registered virtpci_ctrlchan_func (0x%p) as callback.\n",
 	     (void *) &virtpci_ctrlchan_func);
-
+	/*create debugfs directory*/
+	virtpci_debugfs_dir = debugfs_create_dir(DIR_DEBUGFS_ENTRY, NULL);
+	info_debugfs_entry = debugfs_create_file(INFO_DEBUGFS_ENTRY_FN, S_IRUSR,
+				virtpci_debugfs_dir, NULL, &debugfs_info_fops);
 	LOGINF("Leaving\n");
 	POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO);
 	return 0;
@@ -1442,7 +1556,8 @@ static void __exit virtpci_mod_exit(void)
 
 	device_unregister(&virtpci_rootbus_device);
 	bus_unregister(&virtpci_bus_type);
-
+	/*debug_fs file and directory removal*/
+	debugfs_remove(virtpci_debugfs_dir);
 	LOGINF("Leaving\n");
 
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH 1/2] staging: unisys: remove all proc entries from virtpci
@ 2014-07-08 17:21 Erik Arfvidson
  2014-07-08 17:21 ` [PATCH 2/2] staging: unisys: added virtpci info entry Erik Arfvidson
  0 siblings, 1 reply; 11+ messages in thread
From: Erik Arfvidson @ 2014-07-08 17:21 UTC (permalink / raw)
  To: erik.arfvidson, gregkh, sparmaintainer, driverdev-devel, benjamin.romer

This patch removes all proc entries from virtpci

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
---
 drivers/staging/unisys/virtpci/virtpci.c | 309 +------------------------------
 1 file changed, 1 insertion(+), 308 deletions(-)

diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c
index 5ab17e7..7d840b0 100644
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ b/drivers/staging/unisys/virtpci/virtpci.c
@@ -34,7 +34,6 @@
 #include <linux/list.h>
 #include <linux/slab.h>
 #include <linux/mod_devicetable.h>
-#include <linux/proc_fs.h>
 #include <linux/if_ether.h>
 #include <linux/version.h>
 #include "version.h"
@@ -100,18 +99,7 @@ static int virtpci_device_suspend(struct device *dev, pm_message_t state);
 static int virtpci_device_resume(struct device *dev);
 static int virtpci_device_probe(struct device *dev);
 static int virtpci_device_remove(struct device *dev);
-static ssize_t virt_proc_write(struct file *file, const char __user *buffer,
-			       size_t count, loff_t *ppos);
-static ssize_t info_proc_read(struct file *file, char __user *buf,
-			      size_t len, loff_t *offset);
 
-static const struct file_operations proc_virt_fops = {
-	.write = virt_proc_write,
-};
-
-static const struct file_operations proc_info_fops = {
-	.read = info_proc_read,
-};
 
 /*****************************************************/
 /* Globals                                           */
@@ -152,19 +140,6 @@ static DEFINE_RWLOCK(VpcidevListLock);
 /* filled in with info about this driver, wrt it servicing client busses */
 static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo;
 
-/* virtpci_proc_dir_entry is used to create the proc entry directory
- * for virtpci
- */
-static struct proc_dir_entry *virtpci_proc_dir;
-/* virt_proc_entry is used to tell virtpci to add/delete vhbas/vnics/vbuses */
-static struct proc_dir_entry *virt_proc_entry;
-/* info_proc_entry is used to tell virtpci to display current info
- * kept in the driver
- */
-static struct proc_dir_entry *info_proc_entry;
-#define VIRT_PROC_ENTRY_FN "virt"
-#define INFO_PROC_ENTRY_FN "info"
-#define DIR_PROC_ENTRY "virtpci"
 
 struct virtpci_busdev {
 	struct device virtpci_bus_device;
@@ -1402,274 +1377,6 @@ void virtpci_unregister_driver(struct virtpci_driver *drv)
 EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
 
 /*****************************************************/
-/* proc filesystem functions						 */
-/*****************************************************/
-struct print_vbus_info {
-	int *length;
-	char *buf;
-};
-
-static int print_vbus(struct device *vbus, void *data)
-{
-	struct print_vbus_info *p = (struct print_vbus_info *) data;
-	int l = *(p->length);
-
-	*(p->length) = l + sprintf(p->buf + l, "bus_id:%s\n", dev_name(vbus));
-	return 0;		/* no error */
-}
-
-static ssize_t info_proc_read(struct file *file, char __user *buf,
-			      size_t len, loff_t *offset)
-{
-	int length = 0;
-	struct virtpci_dev *tmpvpcidev;
-	unsigned long flags;
-	struct print_vbus_info printparam;
-	char *vbuf;
-	loff_t pos = *offset;
-
-	if (pos < 0)
-		return -EINVAL;
-
-	if (pos > 0 || !len)
-		return 0;
-
-	vbuf = kzalloc(len, GFP_KERNEL);
-	if (!vbuf)
-		return -ENOMEM;
-
-	length += sprintf(vbuf + length, "CHANSOCK is not defined.\n");
-
-	length += sprintf(vbuf + length, "\n Virtual PCI Bus devices\n");
-	printparam.length = &length;
-	printparam.buf = vbuf;
-	if (bus_for_each_dev(&virtpci_bus_type, NULL,
-			     (void *) &printparam, print_vbus))
-		LOGERR("delete of all vbus failed\n");
-
-	length += sprintf(vbuf + length, "\n Virtual PCI devices\n");
-	read_lock_irqsave(&VpcidevListLock, flags);
-	tmpvpcidev = VpcidevListHead;
-	while (tmpvpcidev) {
-		if (tmpvpcidev->devtype == VIRTHBA_TYPE) {
-			length += sprintf(vbuf + length, "[%d:%d] VHba:%08x:%08x max-config:%d-%d-%d-%d",
-				    tmpvpcidev->busNo, tmpvpcidev->deviceNo,
-				    tmpvpcidev->scsi.wwnn.wwnn1,
-				    tmpvpcidev->scsi.wwnn.wwnn2,
-				    tmpvpcidev->scsi.max.max_channel,
-				    tmpvpcidev->scsi.max.max_id,
-				    tmpvpcidev->scsi.max.max_lun,
-				    tmpvpcidev->scsi.max.cmd_per_lun);
-		} else {
-			length += sprintf(vbuf + length, "[%d:%d] VNic:%02x:%02x:%02x:%02x:%02x:%02x num_rcv_bufs:%d mtu:%d",
-				    tmpvpcidev->busNo, tmpvpcidev->deviceNo,
-				    tmpvpcidev->net.mac_addr[0],
-				    tmpvpcidev->net.mac_addr[1],
-				    tmpvpcidev->net.mac_addr[2],
-				    tmpvpcidev->net.mac_addr[3],
-				    tmpvpcidev->net.mac_addr[4],
-				    tmpvpcidev->net.mac_addr[5],
-				    tmpvpcidev->net.num_rcv_bufs,
-				    tmpvpcidev->net.mtu);
-		}
-		length +=
-		    sprintf(vbuf + length, " chanptr:%p\n",
-			    tmpvpcidev->queueinfo.chan);
-		tmpvpcidev = tmpvpcidev->next;
-	}
-	read_unlock_irqrestore(&VpcidevListLock, flags);
-
-	length += sprintf(vbuf + length, "\n");
-	if (copy_to_user(buf, vbuf, length)) {
-		kfree(vbuf);
-		return -EFAULT;
-	}
-
-	kfree(vbuf);
-	*offset += length;
-	return length;
-}
-
-static ssize_t virt_proc_write(struct file *file, const char __user *buffer,
-			       size_t count, loff_t *ppos)
-{
-	char buf[16];
-	int type, i, action = 0xffff;
-	unsigned int busno, deviceno;
-	void __iomem *chanptr;
-	struct add_vbus_guestpart busaddparams;
-	struct add_virt_guestpart addparams;
-	struct del_vbus_guestpart busdelparams;
-	struct del_virt_guestpart delparams;
-#ifdef STORAGE_CHANNEL
-	U64 storagechannel;
-#endif
-
-#define PRINT_USAGE_RETURN {\
-	LOGERR("usage: 0-0-<chanptr>					==> delete vhba\n"); \
-	LOGERR("usage: 0-1-<chanptr>-<busNo>-<deviceNo>	==> add vhba\n"); \
-	LOGERR("usage: 0-f-<busNo>						==> delete all vhbas\n"); \
-	LOGERR("\n"); \
-	LOGERR("usage: 1-0-<chanptr>					==> delete vnic\n"); \
-	LOGERR("usage: 1-1-<chanptr>-<busNo>-<deviceNo>	==> add vnic\n"); \
-	LOGERR("usage: 1-f-<busNo>						==> delete all vnics\n"); \
-	LOGERR("\n"); \
-	LOGERR("usage: 6-0-<busNo>						==> delete vbus\n"); \
-	LOGERR("usage: 6-1-<busNo>						==> add vbus\n"); \
-	LOGERR("usage: 6-f								==> delete all vbuses\n"); \
-	LOGERR("usage: 98-<busNo>-<deviceNo>			==> INJECT Client delete vnic\n"); \
-	LOGERR("usage: 99-<chanptr>-<busNo>-<deviceNo>	==> INJECT Client add vnic\n"); \
-	return -EINVAL; \
-}
-
-	if (count >= ARRAY_SIZE(buf))
-		return -EINVAL;
-
-	if (copy_from_user(buf, buffer, count)) {
-		LOGERR("copy_from_user failed.\n");
-		return -EFAULT;
-	}
-
-	i = sscanf(buf, "%x-%x", &type, &action);
-	if (i < 2)
-		PRINT_USAGE_RETURN;
-
-	if (type == 0x98) {
-		/* client inject delete vnic */
-		i = sscanf(buf, "%x-%d-%d", &type, &busno, &deviceno);
-		if (i != 3)
-			PRINT_USAGE_RETURN;
-		uislib_client_inject_del_vnic(busno, deviceno);
-		return count;	/* success */
-	} else if (type == 0x99) {
-		/* client inject add vnic */
-		i = sscanf(buf, "%x-%p-%d-%d", &type, &chanptr, &busno,
-			   &deviceno);
-		if (i != 4)
-			PRINT_USAGE_RETURN;
-		if (!uislib_client_inject_add_vnic(busno, deviceno,
-						   __pa(chanptr),
-						   MIN_IO_CHANNEL_SIZE,
-						   1, /* test msg */
-						   NULL_UUID_LE, /* inst guid */
-						   NULL)) { /*interrupt info */
-			LOGERR("FAILED to inject add vnic\n");
-			return -EFAULT;
-		}
-		return count;	/* success */
-	}
-
-	if ((type != VIRTHBA_TYPE) && (type != VIRTNIC_TYPE)
-	    && (type != VIRTBUS_TYPE))
-		PRINT_USAGE_RETURN;
-
-	if (type == VIRTBUS_TYPE) {
-		i = sscanf(buf, "%x-%x-%d", &type, &action, &busno);
-		switch (action) {
-		case 0:
-			/* delete vbus */
-			if (i != 3)
-				break;
-			busdelparams.busNo = busno;
-			if (delete_vbus(&busdelparams))
-				return count;	/* success */
-			return -EFAULT;
-
-		case 1:
-			/* add vbus */
-			if (i != 3)
-				break;
-			busaddparams.chanptr = NULL;	/* NOT YET USED */
-			busaddparams.busNo = busno;
-			if (add_vbus(&busaddparams))
-				return count;	/* success */
-			return -EFAULT;
-
-		case 0xf:
-			/* delete all vbuses and all vhbas/vnics on the buses */
-			if (i != 2)
-				break;
-			delete_all();
-			return count;	/* success */
-		default:
-			break;
-		}
-		PRINT_USAGE_RETURN;
-	}
-
-	/* if (type == VIRTNIC_TYPE) or         if (type == VIRTHBA_TYPE) */
-	switch (action) {
-	case 0:
-		/* delete vhba/vnic */
-		i = sscanf(buf, "%x-%x-%p", &type, &action, &chanptr);
-		if (i != 3)
-			break;
-		delparams.chanptr = chanptr;
-		if (type == VIRTHBA_TYPE) {
-			if (delete_vhba(&delparams))
-				return count;	/* success */
-		} else {
-			if (delete_vnic(&delparams))
-				return count;	/* success */
-		}
-		return -EFAULT;
-
-	case 1:
-		/* add vhba/vnic */
-		i = sscanf(buf, "%x-%x-%p-%d-%d", &type, &action, &chanptr,
-			   &busno, &deviceno);
-		if (i != 5)
-			break;
-		addparams.chanptr = chanptr;
-		addparams.busNo = busno;
-		addparams.deviceNo = deviceno;
-		if (type == VIRTHBA_TYPE) {
-			if (add_vhba(&addparams))
-				return count;	/* success */
-		} else {
-			if (add_vnic(&addparams))
-				return count;	/* success */
-		}
-		return -EFAULT;
-
-#ifdef STORAGE_CHANNEL
-	case 2:
-		/* add vhba */
-		i = sscanf(buf, "%x-%x-%d-%d", &type, &action, &busno,
-			   &deviceno);
-		if (i != 4)
-			break;
-		storagechannel = uislib_storage_channel(0);	/* Get my storage channel */
-		/* ioremap_cache it now */
-		addparams.chanptr =
-		    (void *) ioremap_cache(storagechannel, IO_CHANNEL_SIZE);
-		if (addparams.chanptr == NULL) {
-			LOGERR("Failure to get remap storage channel.\n");
-			return -EFAULT;
-		}
-		addparams.busNo = busno;
-		addparams.deviceNo = deviceno;
-		if (type == VIRTHBA_TYPE) {
-			if (add_vhba(&addparams))
-				return count;	/* success */
-		}
-		return -EFAULT;
-#endif
-	case 0xf:
-		/* delete all vhbas/vnics */
-		i = sscanf(buf, "%x-%x-%d", &type, &action, &busno);
-		if (i != 3)
-			break;
-		busdelparams.busNo = busno;
-		delete_all_virt(type, &busdelparams);
-		return count;	/* success */
-	default:
-		break;
-	}
-	PRINT_USAGE_RETURN;
-}
-
-/*****************************************************/
 /* Module Init & Exit functions                      */
 /*****************************************************/
 
@@ -1719,12 +1426,7 @@ static int __init virtpci_mod_init(void)
 
 	LOGINF("successfully registered virtpci_ctrlchan_func (0x%p) as callback.\n",
 	     (void *) &virtpci_ctrlchan_func);
-	/* create the proc directories */
-	virtpci_proc_dir = proc_mkdir(DIR_PROC_ENTRY, NULL);
-	virt_proc_entry = proc_create(VIRT_PROC_ENTRY_FN, 0, virtpci_proc_dir,
-				      &proc_virt_fops);
-	info_proc_entry = proc_create(INFO_PROC_ENTRY_FN, 0, virtpci_proc_dir,
-				      &proc_info_fops);
+
 	LOGINF("Leaving\n");
 	POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO);
 	return 0;
@@ -1741,15 +1443,6 @@ static void __exit virtpci_mod_exit(void)
 	device_unregister(&virtpci_rootbus_device);
 	bus_unregister(&virtpci_bus_type);
 
-	if (virt_proc_entry)
-		remove_proc_entry(VIRT_PROC_ENTRY_FN, virtpci_proc_dir);
-
-	if (info_proc_entry)
-		remove_proc_entry(INFO_PROC_ENTRY_FN, virtpci_proc_dir);
-
-	if (virtpci_proc_dir)
-		remove_proc_entry(DIR_PROC_ENTRY, NULL);
-
 	LOGINF("Leaving\n");
 
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-07-11 13:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-10 14:34 [PATCH 2/2] staging: unisys: added virtpci info entry Erik Arfvidson
2014-07-10 14:51 ` Greg KH
2014-07-11 13:00   ` Romer, Benjamin M
2014-07-11 13:29     ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2014-07-09 20:22 Erik Arfvidson
2014-07-09 20:40 ` Greg KH
2014-07-09 20:41 ` Greg KH
2014-07-08 17:21 [PATCH 1/2] staging: unisys: remove all proc entries from virtpci Erik Arfvidson
2014-07-08 17:21 ` [PATCH 2/2] staging: unisys: added virtpci info entry Erik Arfvidson
2014-07-08 17:34   ` Greg KH
2014-07-08 17:52   ` Dan Carpenter
2014-07-08 19:22     ` Erik Arfvidson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.