Lines Matching +full:proc +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0
6 * the PROC file system and the SCSI device drivers
10 * (c) 1995 Michael Neuffer neuffer@goofy.zdv.uni-mainz.de
14 * Andreas Heilwagen <crashcar@informatik.uni-koblenz.de>
51 * struct scsi_proc_entry - (host template, SCSI proc dir) association
68 ssize_t ret = -ENOMEM; in proc_scsi_host_write()
72 return -EOVERFLOW; in proc_scsi_host_write()
74 if (!shost->hostt->write_info) in proc_scsi_host_write()
75 return -EINVAL; in proc_scsi_host_write()
79 ret = -EFAULT; in proc_scsi_host_write()
82 ret = shost->hostt->write_info(shost, page, count); in proc_scsi_host_write()
91 struct Scsi_Host *shost = m->private; in proc_scsi_show()
92 return shost->hostt->show_info(m, shost); in proc_scsi_show()
109 if (e->sht == sht) in __scsi_lookup_proc_entry()
128 * scsi_template_proc_dir() - returns the procfs dir for a SCSI host template
136 return e ? e->proc_dir : NULL; in scsi_template_proc_dir()
149 * scsi_proc_hostdir_add - Create directory in /proc for a scsi host
152 * Sets sht->proc_dir to the new directory.
159 if (!sht->show_info) in scsi_proc_hostdir_add()
167 ret = -ENOMEM; in scsi_proc_hostdir_add()
171 if (e->present++) in scsi_proc_hostdir_add()
173 e->proc_dir = proc_mkdir(sht->proc_name, proc_scsi); in scsi_proc_hostdir_add()
174 if (!e->proc_dir) { in scsi_proc_hostdir_add()
176 sht->proc_name); in scsi_proc_hostdir_add()
177 ret = -ENOMEM; in scsi_proc_hostdir_add()
180 e->sht = sht; in scsi_proc_hostdir_add()
181 list_add_tail(&e->entry, &scsi_proc_list); in scsi_proc_hostdir_add()
193 * scsi_proc_hostdir_rm - remove directory in /proc for a scsi host
200 if (!sht->show_info) in scsi_proc_hostdir_rm()
205 if (e && !--e->present) { in scsi_proc_hostdir_rm()
206 remove_proc_entry(sht->proc_name, proc_scsi); in scsi_proc_hostdir_rm()
207 list_del(&e->entry); in scsi_proc_hostdir_rm()
215 * scsi_proc_host_add - Add entry for this host to appropriate /proc dir
220 const struct scsi_host_template *sht = shost->hostt; in scsi_proc_host_add()
225 if (!sht->show_info) in scsi_proc_host_add()
232 sprintf(name,"%d", shost->host_no); in scsi_proc_host_add()
233 p = proc_create_data(name, S_IRUGO | S_IWUSR, e->proc_dir, in scsi_proc_host_add()
246 * scsi_proc_host_rm - remove this host's entry from /proc
251 const struct scsi_host_template *sht = shost->hostt; in scsi_proc_host_rm()
255 if (!sht->show_info) in scsi_proc_host_rm()
262 sprintf(name,"%d", shost->host_no); in scsi_proc_host_rm()
263 remove_proc_entry(name, e->proc_dir); in scsi_proc_host_rm()
266 * proc_print_scsidevice - return data about this host
270 * Description: prints Host, Channel, Id, Lun, Vendor, Model, Rev, Type,
284 "Host: scsi%d Channel: %02d Id: %02d Lun: %02llu\n Vendor: ", in proc_print_scsidevice()
285 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); in proc_print_scsidevice()
287 if (sdev->vendor[i] >= 0x20) in proc_print_scsidevice()
288 seq_putc(s, sdev->vendor[i]); in proc_print_scsidevice()
295 if (sdev->model[i] >= 0x20) in proc_print_scsidevice()
296 seq_putc(s, sdev->model[i]); in proc_print_scsidevice()
303 if (sdev->rev[i] >= 0x20) in proc_print_scsidevice()
304 seq_putc(s, sdev->rev[i]); in proc_print_scsidevice()
311 seq_printf(s, " Type: %s ", scsi_device_type(sdev->type)); in proc_print_scsidevice()
313 sdev->scsi_level - (sdev->scsi_level > 1)); in proc_print_scsidevice()
314 if (sdev->scsi_level == 2) in proc_print_scsidevice()
324 * scsi_add_single_device - Respond to user request to probe for/add device
325 * @host: user-supplied decimal integer
326 * @channel: user-supplied decimal integer
327 * @id: user-supplied decimal integer
328 * @lun: user-supplied decimal integer
330 * Description: called by writing "scsi add-single-device" to /proc/scsi/scsi.
338 static int scsi_add_single_device(uint host, uint channel, uint id, uint lun) in scsi_add_single_device() argument
341 int error = -ENXIO; in scsi_add_single_device()
347 if (shost->transportt->user_scan) in scsi_add_single_device()
348 error = shost->transportt->user_scan(shost, channel, id, lun); in scsi_add_single_device()
350 error = scsi_scan_host_selected(shost, channel, id, lun, in scsi_add_single_device()
357 * scsi_remove_single_device - Respond to user request to remove a device
358 * @host: user-supplied decimal integer
359 * @channel: user-supplied decimal integer
360 * @id: user-supplied decimal integer
361 * @lun: user-supplied decimal integer
363 * Description: called by writing "scsi remove-single-device" to
364 * /proc/scsi/scsi. Does a scsi_device_lookup() and scsi_remove_device()
366 static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun) in scsi_remove_single_device() argument
370 int error = -ENXIO; in scsi_remove_single_device()
375 sdev = scsi_device_lookup(shost, channel, id, lun); in scsi_remove_single_device()
387 * proc_scsi_write - handle writes to /proc/scsi/scsi
394 * Host, Channel, ID, and Lun. To use,
395 * "echo 'scsi add-single-device 0 1 2 3' > /proc/scsi/scsi" or
396 * "echo 'scsi remove-single-device 0 1 2 3' > /proc/scsi/scsi" with
397 * "0 1 2 3" replaced by the Host, Channel, Id, and Lun.
408 int host, channel, id, lun; in proc_scsi_write() local
413 return -EINVAL; in proc_scsi_write()
417 return -ENOMEM; in proc_scsi_write()
419 err = -EFAULT; in proc_scsi_write()
423 err = -EINVAL; in proc_scsi_write()
428 end = buffer + PAGE_SIZE - 1; in proc_scsi_write()
434 * Usage: echo "scsi add-single-device 0 1 2 3" >/proc/scsi/scsi in proc_scsi_write()
435 * with "0 1 2 3" replaced by your "Host Channel Id Lun". in proc_scsi_write()
437 if (!strncmp("scsi add-single-device", buffer, 22)) { in proc_scsi_write()
442 id = (p + 1 < end) ? simple_strtoul(p + 1, &p, 0) : 0; in proc_scsi_write()
445 err = scsi_add_single_device(host, channel, id, lun); in proc_scsi_write()
448 * Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi in proc_scsi_write()
449 * with "0 1 2 3" replaced by your "Host Channel Id Lun". in proc_scsi_write()
451 } else if (!strncmp("scsi remove-single-device", buffer, 25)) { in proc_scsi_write()
456 id = (p + 1 < end) ? simple_strtoul(p + 1, &p, 0) : 0; in proc_scsi_write()
459 err = scsi_remove_single_device(host, channel, id, lun); in proc_scsi_write()
488 if (!n--) in scsi_seq_start()
490 sfile->private++; in scsi_seq_start()
498 sfile->private++; in scsi_seq_next()
509 if (!sfile->private) in scsi_seq_show()
523 * proc_scsi_open - glue function
547 * scsi_init_procfs - create scsi and scsi/scsi in procfs
566 return -ENOMEM; in scsi_init_procfs()
570 * scsi_exit_procfs - Remove scsi/scsi and scsi from procfs