aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-31 13:27:56 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:13:29 -0400
commit70ef457dc92bdd03c0c8d640fce45909166983a1 (patch)
tree4e9f07b21a48b291a2ad8048d0faa3f6ea706a1b
parentd89537e1b124ad661ea340798965a96e123cb211 (diff)
scsi: bury ->proc_info()
all users converted to ->show_info()/->write_info() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/scsi/scsi_proc.c79
-rw-r--r--include/scsi/scsi_host.h3
2 files changed, 9 insertions, 73 deletions
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 6f4c3cff03bb..1670ba7ad6af 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -45,58 +45,6 @@ static struct proc_dir_entry *proc_scsi;
45/* Protect sht->present and sht->proc_dir */ 45/* Protect sht->present and sht->proc_dir */
46static DEFINE_MUTEX(global_host_template_mutex); 46static DEFINE_MUTEX(global_host_template_mutex);
47 47
48/**
49 * proc_scsi_read - handle read from /proc by calling host's proc_info() command
50 * @buffer: passed to proc_info
51 * @start: passed to proc_info
52 * @offset: passed to proc_info
53 * @length: passed to proc_info
54 * @eof: returns whether length read was less than requested
55 * @data: pointer to a &struct Scsi_Host
56 */
57
58static int proc_scsi_read(char *buffer, char **start, off_t offset,
59 int length, int *eof, void *data)
60{
61 struct Scsi_Host *shost = data;
62 int n;
63
64 n = shost->hostt->proc_info(shost, buffer, start, offset, length, 0);
65 *eof = (n < length);
66
67 return n;
68}
69
70/**
71 * proc_scsi_write_proc - Handle write to /proc by calling host's proc_info()
72 * @file: not used
73 * @buf: source of data to write.
74 * @count: number of bytes (at most PROC_BLOCK_SIZE) to write.
75 * @data: pointer to &struct Scsi_Host
76 */
77static int proc_scsi_write_proc(struct file *file, const char __user *buf,
78 unsigned long count, void *data)
79{
80 struct Scsi_Host *shost = data;
81 ssize_t ret = -ENOMEM;
82 char *page;
83 char *start;
84
85 if (count > PROC_BLOCK_SIZE)
86 return -EOVERFLOW;
87
88 page = (char *)__get_free_page(GFP_KERNEL);
89 if (page) {
90 ret = -EFAULT;
91 if (copy_from_user(page, buf, count))
92 goto out;
93 ret = shost->hostt->proc_info(shost, page, &start, 0, count, 1);
94 }
95out:
96 free_page((unsigned long)page);
97 return ret;
98}
99
100static ssize_t proc_scsi_host_write(struct file *file, const char __user *buf, 48static ssize_t proc_scsi_host_write(struct file *file, const char __user *buf,
101 size_t count, loff_t *ppos) 49 size_t count, loff_t *ppos)
102{ 50{
@@ -149,7 +97,7 @@ static const struct file_operations proc_scsi_fops = {
149 97
150void scsi_proc_hostdir_add(struct scsi_host_template *sht) 98void scsi_proc_hostdir_add(struct scsi_host_template *sht)
151{ 99{
152 if (!sht->proc_info && !sht->show_info) 100 if (!sht->show_info)
153 return; 101 return;
154 102
155 mutex_lock(&global_host_template_mutex); 103 mutex_lock(&global_host_template_mutex);
@@ -168,7 +116,7 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht)
168 */ 116 */
169void scsi_proc_hostdir_rm(struct scsi_host_template *sht) 117void scsi_proc_hostdir_rm(struct scsi_host_template *sht)
170{ 118{
171 if (!sht->proc_info && !sht->show_info) 119 if (!sht->show_info)
172 return; 120 return;
173 121
174 mutex_lock(&global_host_template_mutex); 122 mutex_lock(&global_host_template_mutex);
@@ -194,23 +142,12 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
194 return; 142 return;
195 143
196 sprintf(name,"%d", shost->host_no); 144 sprintf(name,"%d", shost->host_no);
197 if (sht->show_info) { 145 p = proc_create_data(name, S_IRUGO | S_IWUSR,
198 p = proc_create_data(name, S_IRUGO | S_IWUSR, 146 sht->proc_dir, &proc_scsi_fops, shost);
199 sht->proc_dir, &proc_scsi_fops, shost); 147 if (!p)
200 if (!p) 148 printk(KERN_ERR "%s: Failed to register host %d in"
201 goto Fail; 149 "%s\n", __func__, shost->host_no,
202 return; 150 sht->proc_name);
203 }
204 p = create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
205 sht->proc_dir, proc_scsi_read, shost);
206 if (p) {
207 p->write_proc = proc_scsi_write_proc;
208 return;
209 }
210Fail:
211 printk(KERN_ERR "%s: Failed to register host %d in"
212 "%s\n", __func__, shost->host_no,
213 sht->proc_name);
214} 151}
215 152
216/** 153/**
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 70e08e442bfc..755243572219 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -341,7 +341,6 @@ struct scsi_host_template {
341 * 341 *
342 * Status: OBSOLETE 342 * Status: OBSOLETE
343 */ 343 */
344 int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int);
345 int (*show_info)(struct seq_file *, struct Scsi_Host *); 344 int (*show_info)(struct seq_file *, struct Scsi_Host *);
346 int (*write_info)(struct Scsi_Host *, char *, int); 345 int (*write_info)(struct Scsi_Host *, char *, int);
347 346
@@ -378,7 +377,7 @@ struct scsi_host_template {
378 377
379 /* 378 /*
380 * Used to store the procfs directory if a driver implements the 379 * Used to store the procfs directory if a driver implements the
381 * proc_info or show_info method. 380 * show_info method.
382 */ 381 */
383 struct proc_dir_entry *proc_dir; 382 struct proc_dir_entry *proc_dir;
384 383