linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/34] scsi proc_ops: add struct scsi_host_template::proc_ops
@ 2012-02-22 19:45 Alexey Dobriyan
  2012-02-22 19:45 ` [PATCH 02/34] scsi proc_ops: convert drivers/scsi/scsi_debug.c Alexey Dobriyan
                   ` (33 more replies)
  0 siblings, 34 replies; 37+ messages in thread
From: Alexey Dobriyan @ 2012-02-22 19:45 UTC (permalink / raw)
  To: JBottomley; +Cc: linux-scsi, Alexey Dobriyan

The last user of ->write_proc interface is scsi_proc.c passing through
data to individual drivers. There are still quite a few drivers using
->proc_info interface, so do conversion gradually.

Introduce temporary logic allowing both ->proc_info and ->proc_ops
with ->proc_ops being the first thing to check, convert drivers,
remove ->proc_info interface.

Removing all relevant SCSI proc files is risky because it'd take only one
broken user to revert whole thing and do it right.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 drivers/scsi/scsi_proc.c |   20 +++++++++++++++-----
 include/scsi/scsi_host.h |    1 +
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index ad747dc..31da690 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -106,7 +106,7 @@ out:
 
 void scsi_proc_hostdir_add(struct scsi_host_template *sht)
 {
-	if (!sht->proc_info)
+	if (!sht->proc_info && !sht->proc_ops)
 		return;
 
 	mutex_lock(&global_host_template_mutex);
@@ -125,7 +125,7 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht)
  */
 void scsi_proc_hostdir_rm(struct scsi_host_template *sht)
 {
-	if (!sht->proc_info)
+	if (!sht->proc_info && !sht->proc_ops)
 		return;
 
 	mutex_lock(&global_host_template_mutex);
@@ -151,16 +151,26 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
 		return;
 
 	sprintf(name,"%d", shost->host_no);
-	p = create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
+	if (sht->proc_ops) {
+		mode_t mode;
+
+		mode = S_IRUGO;
+		if (sht->proc_ops->write)
+			mode |= S_IWUSR;
+		p = proc_create_data(name, mode, sht->proc_dir,
+				     sht->proc_ops, shost);
+	} else {
+		p = create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
 			sht->proc_dir, proc_scsi_read, shost);
+		if (p)
+			p->write_proc = proc_scsi_write_proc;
+	}
 	if (!p) {
 		printk(KERN_ERR "%s: Failed to register host %d in"
 		       "%s\n", __func__, shost->host_no,
 		       sht->proc_name);
 		return;
 	} 
-
-	p->write_proc = proc_scsi_write_proc;
 }
 
 /**
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 5f7d5b3..f81c80f 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -341,6 +341,7 @@ struct scsi_host_template {
 	 * Status: OBSOLETE
 	 */
 	int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int);
+	const struct file_operations *proc_ops;
 
 	/*
 	 * This is an optional routine that allows the transport to become
-- 
1.7.3.4


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

end of thread, other threads:[~2012-03-22 17:25 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-22 19:45 [PATCH 01/34] scsi proc_ops: add struct scsi_host_template::proc_ops Alexey Dobriyan
2012-02-22 19:45 ` [PATCH 02/34] scsi proc_ops: convert drivers/scsi/scsi_debug.c Alexey Dobriyan
2012-02-22 19:45 ` [PATCH 03/34] scsi proc_ops: convert drivers/scsi/nsp32.c Alexey Dobriyan
2012-02-22 19:45 ` [PATCH 04/34] scsi proc_ops: convert drivers/scsi/imm.c Alexey Dobriyan
2012-02-22 19:45 ` [PATCH 05/34] scsi proc_ops: convert drivers/scsi/ppa.c Alexey Dobriyan
2012-02-22 19:45 ` [PATCH 06/34] scsi proc_ops: convert drivers/scsi/atp870u.c Alexey Dobriyan
2012-02-22 19:45 ` [PATCH 07/34] scsi proc_ops: convert drivers/scsi/dc395x.c Alexey Dobriyan
2012-02-22 19:45 ` [PATCH 08/34] scsi proc_ops: convert drivers/scsi/ibmmca.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 09/34] scsi proc_ops: convert drivers/scsi/wd7000.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 10/34] scsi proc_ops: convert drivers/scsi/pcmcia/nsp_cs.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 11/34] scsi proc_ops: convert drivers/scsi/fd_mcs.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 12/34] scsi proc_ops: convert drivers/scsi/aha152x.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 13/34] scsi proc_ops: convert drivers/scsi/sym53c8xx_2/sym_glue.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 14/34] scsi proc_ops: convert drivers/scsi/advansys.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 15/34] scsi proc_ops: convert drivers/scsi/BusLogic.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 16/34] scsi proc_ops: convert drivers/scsi/aha1740.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 17/34] scsi proc_ops: convert drivers/scsi/aic7xxx_old.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 18/34] scsi proc_ops: convert drivers/scsi/ips.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 19/34] scsi proc_ops: convert drivers/scsi/in2000.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 20/34] scsi proc_ops: convert aic79xx Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 21/34] scsi proc_ops: convert aic7xxx Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 22/34] scsi proc_ops: convert drivers/scsi/dpt_i2o.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 23/34] scsi proc_ops: convert drivers/scsi/gdth.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 24/34] scsi proc_ops: convert drivers/usb/storage/scsiglue.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 25/34] scsi proc_ops: convert drivers/block/cciss.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 26/34] scsi proc_ops: convert drivers/message/fusion/ Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 27/34] scsi proc_ops: remove tcm_loop proc code Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 28/34] scsi proc_ops: convert drivers/scsi/eata_pio.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 29/34] scsi proc_ops: convert drivers/ata/sata_svw.c Alexey Dobriyan
2012-03-22 17:25   ` Jeff Garzik
2012-02-22 19:46 ` [PATCH 30/34] scsi proc_ops: convert drivers/scsi/g_NCR5380.c Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 31/34] scsi proc_ops: convert NCR5380-based drivers Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 32/34] scsi proc_ops: convert drivers/scsi/arm/ drivers Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 33/34] scsi proc_ops: convert wd33c93-based drivers Alexey Dobriyan
2012-02-22 19:46 ` [PATCH 34/34] scsi proc_ops: remove scsi_host_template::proc_info Alexey Dobriyan
2012-02-29 13:39 ` [PATCH 01/34] scsi proc_ops: add struct scsi_host_template::proc_ops Alexey Dobriyan
2012-02-29 22:29   ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).