Lines Matching +full:single +full:- +full:channel
1 // SPDX-License-Identifier: GPL-2.0
10 * (c) 1995 Michael Neuffer neuffer@goofy.zdv.uni-mainz.de
14 * Andreas Heilwagen <crashcar@informatik.uni-koblenz.de>
46 /* Protect sht->present and sht->proc_dir */
53 ssize_t ret = -ENOMEM; in proc_scsi_host_write()
57 return -EOVERFLOW; in proc_scsi_host_write()
59 if (!shost->hostt->write_info) in proc_scsi_host_write()
60 return -EINVAL; in proc_scsi_host_write()
64 ret = -EFAULT; in proc_scsi_host_write()
67 ret = shost->hostt->write_info(shost, page, count); in proc_scsi_host_write()
76 struct Scsi_Host *shost = m->private; in proc_scsi_show()
77 return shost->hostt->show_info(m, shost); in proc_scsi_show()
95 * scsi_proc_hostdir_add - Create directory in /proc for a scsi host
98 * Sets sht->proc_dir to the new directory.
103 if (!sht->show_info) in scsi_proc_hostdir_add()
107 if (!sht->present++) { in scsi_proc_hostdir_add()
108 sht->proc_dir = proc_mkdir(sht->proc_name, proc_scsi); in scsi_proc_hostdir_add()
109 if (!sht->proc_dir) in scsi_proc_hostdir_add()
111 __func__, sht->proc_name); in scsi_proc_hostdir_add()
117 * scsi_proc_hostdir_rm - remove directory in /proc for a scsi host
122 if (!sht->show_info) in scsi_proc_hostdir_rm()
126 if (!--sht->present && sht->proc_dir) { in scsi_proc_hostdir_rm()
127 remove_proc_entry(sht->proc_name, proc_scsi); in scsi_proc_hostdir_rm()
128 sht->proc_dir = NULL; in scsi_proc_hostdir_rm()
135 * scsi_proc_host_add - Add entry for this host to appropriate /proc dir
140 struct scsi_host_template *sht = shost->hostt; in scsi_proc_host_add()
144 if (!sht->proc_dir) in scsi_proc_host_add()
147 sprintf(name,"%d", shost->host_no); in scsi_proc_host_add()
149 sht->proc_dir, &proc_scsi_ops, shost); in scsi_proc_host_add()
152 "%s\n", __func__, shost->host_no, in scsi_proc_host_add()
153 sht->proc_name); in scsi_proc_host_add()
157 * scsi_proc_host_rm - remove this host's entry from /proc
164 if (!shost->hostt->proc_dir) in scsi_proc_host_rm()
167 sprintf(name,"%d", shost->host_no); in scsi_proc_host_rm()
168 remove_proc_entry(name, shost->hostt->proc_dir); in scsi_proc_host_rm()
171 * proc_print_scsidevice - return data about this host
175 * Description: prints Host, Channel, Id, Lun, Vendor, Model, Rev, Type,
189 "Host: scsi%d Channel: %02d Id: %02d Lun: %02llu\n Vendor: ", in proc_print_scsidevice()
190 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); in proc_print_scsidevice()
192 if (sdev->vendor[i] >= 0x20) in proc_print_scsidevice()
193 seq_putc(s, sdev->vendor[i]); in proc_print_scsidevice()
200 if (sdev->model[i] >= 0x20) in proc_print_scsidevice()
201 seq_putc(s, sdev->model[i]); in proc_print_scsidevice()
208 if (sdev->rev[i] >= 0x20) in proc_print_scsidevice()
209 seq_putc(s, sdev->rev[i]); in proc_print_scsidevice()
216 seq_printf(s, " Type: %s ", scsi_device_type(sdev->type)); in proc_print_scsidevice()
218 sdev->scsi_level - (sdev->scsi_level > 1)); in proc_print_scsidevice()
219 if (sdev->scsi_level == 2) in proc_print_scsidevice()
229 * scsi_add_single_device - Respond to user request to probe for/add device
230 * @host: user-supplied decimal integer
231 * @channel: user-supplied decimal integer
232 * @id: user-supplied decimal integer
233 * @lun: user-supplied decimal integer
235 * Description: called by writing "scsi add-single-device" to /proc/scsi/scsi.
243 static int scsi_add_single_device(uint host, uint channel, uint id, uint lun) in scsi_add_single_device() argument
246 int error = -ENXIO; in scsi_add_single_device()
252 if (shost->transportt->user_scan) in scsi_add_single_device()
253 error = shost->transportt->user_scan(shost, channel, id, lun); in scsi_add_single_device()
255 error = scsi_scan_host_selected(shost, channel, id, lun, in scsi_add_single_device()
262 * scsi_remove_single_device - Respond to user request to remove a device
263 * @host: user-supplied decimal integer
264 * @channel: user-supplied decimal integer
265 * @id: user-supplied decimal integer
266 * @lun: user-supplied decimal integer
268 * Description: called by writing "scsi remove-single-device" to
271 static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun) in scsi_remove_single_device() argument
275 int error = -ENXIO; in scsi_remove_single_device()
280 sdev = scsi_device_lookup(shost, channel, id, lun); in scsi_remove_single_device()
292 * proc_scsi_write - handle writes to /proc/scsi/scsi
299 * Host, Channel, ID, and Lun. To use,
300 * "echo 'scsi add-single-device 0 1 2 3' > /proc/scsi/scsi" or
301 * "echo 'scsi remove-single-device 0 1 2 3' > /proc/scsi/scsi" with
302 * "0 1 2 3" replaced by the Host, Channel, Id, and Lun.
305 * SATA, Firewire, Fibre Channel, etc) dynamically assign these values to
313 int host, channel, id, lun; in proc_scsi_write() local
318 return -EINVAL; in proc_scsi_write()
322 return -ENOMEM; in proc_scsi_write()
324 err = -EFAULT; in proc_scsi_write()
328 err = -EINVAL; in proc_scsi_write()
331 else if (buffer[PAGE_SIZE-1]) in proc_scsi_write()
335 * Usage: echo "scsi add-single-device 0 1 2 3" >/proc/scsi/scsi in proc_scsi_write()
336 * with "0 1 2 3" replaced by your "Host Channel Id Lun". in proc_scsi_write()
338 if (!strncmp("scsi add-single-device", buffer, 22)) { in proc_scsi_write()
342 channel = simple_strtoul(p + 1, &p, 0); in proc_scsi_write()
346 err = scsi_add_single_device(host, channel, id, lun); in proc_scsi_write()
349 * Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi in proc_scsi_write()
350 * with "0 1 2 3" replaced by your "Host Channel Id Lun". in proc_scsi_write()
352 } else if (!strncmp("scsi remove-single-device", buffer, 25)) { in proc_scsi_write()
356 channel = simple_strtoul(p + 1, &p, 0); in proc_scsi_write()
360 err = scsi_remove_single_device(host, channel, id, lun); in proc_scsi_write()
389 if (!n--) in scsi_seq_start()
391 sfile->private++; in scsi_seq_start()
399 sfile->private++; in scsi_seq_next()
410 if (!sfile->private) in scsi_seq_show()
424 * proc_scsi_open - glue function
448 * scsi_init_procfs - create scsi and scsi/scsi in procfs
467 return -ENOMEM; in scsi_init_procfs()
471 * scsi_exit_procfs - Remove scsi/scsi and scsi from procfs