diff options
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r-- | drivers/scsi/scsi_sysfs.c | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 074e8cc30955..406b3038bbad 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -80,7 +80,7 @@ const char *scsi_host_state_name(enum scsi_host_state state) | |||
80 | return name; | 80 | return name; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int check_set(unsigned int *val, char *src) | 83 | static int check_set(unsigned long long *val, char *src) |
84 | { | 84 | { |
85 | char *last; | 85 | char *last; |
86 | 86 | ||
@@ -90,7 +90,7 @@ static int check_set(unsigned int *val, char *src) | |||
90 | /* | 90 | /* |
91 | * Doesn't check for int overflow | 91 | * Doesn't check for int overflow |
92 | */ | 92 | */ |
93 | *val = simple_strtoul(src, &last, 0); | 93 | *val = simple_strtoull(src, &last, 0); |
94 | if (*last != '\0') | 94 | if (*last != '\0') |
95 | return 1; | 95 | return 1; |
96 | } | 96 | } |
@@ -99,11 +99,11 @@ static int check_set(unsigned int *val, char *src) | |||
99 | 99 | ||
100 | static int scsi_scan(struct Scsi_Host *shost, const char *str) | 100 | static int scsi_scan(struct Scsi_Host *shost, const char *str) |
101 | { | 101 | { |
102 | char s1[15], s2[15], s3[15], junk; | 102 | char s1[15], s2[15], s3[17], junk; |
103 | unsigned int channel, id, lun; | 103 | unsigned long long channel, id, lun; |
104 | int res; | 104 | int res; |
105 | 105 | ||
106 | res = sscanf(str, "%10s %10s %10s %c", s1, s2, s3, &junk); | 106 | res = sscanf(str, "%10s %10s %16s %c", s1, s2, s3, &junk); |
107 | if (res != 3) | 107 | if (res != 3) |
108 | return -EINVAL; | 108 | return -EINVAL; |
109 | if (check_set(&channel, s1)) | 109 | if (check_set(&channel, s1)) |
@@ -333,8 +333,8 @@ store_shost_eh_deadline(struct device *dev, struct device_attribute *attr, | |||
333 | 333 | ||
334 | static DEVICE_ATTR(eh_deadline, S_IRUGO | S_IWUSR, show_shost_eh_deadline, store_shost_eh_deadline); | 334 | static DEVICE_ATTR(eh_deadline, S_IRUGO | S_IWUSR, show_shost_eh_deadline, store_shost_eh_deadline); |
335 | 335 | ||
336 | shost_rd_attr(use_blk_mq, "%d\n"); | ||
336 | shost_rd_attr(unique_id, "%u\n"); | 337 | shost_rd_attr(unique_id, "%u\n"); |
337 | shost_rd_attr(host_busy, "%hu\n"); | ||
338 | shost_rd_attr(cmd_per_lun, "%hd\n"); | 338 | shost_rd_attr(cmd_per_lun, "%hd\n"); |
339 | shost_rd_attr(can_queue, "%hd\n"); | 339 | shost_rd_attr(can_queue, "%hd\n"); |
340 | shost_rd_attr(sg_tablesize, "%hu\n"); | 340 | shost_rd_attr(sg_tablesize, "%hu\n"); |
@@ -344,7 +344,16 @@ shost_rd_attr(prot_capabilities, "%u\n"); | |||
344 | shost_rd_attr(prot_guard_type, "%hd\n"); | 344 | shost_rd_attr(prot_guard_type, "%hd\n"); |
345 | shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); | 345 | shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); |
346 | 346 | ||
347 | static ssize_t | ||
348 | show_host_busy(struct device *dev, struct device_attribute *attr, char *buf) | ||
349 | { | ||
350 | struct Scsi_Host *shost = class_to_shost(dev); | ||
351 | return snprintf(buf, 20, "%d\n", atomic_read(&shost->host_busy)); | ||
352 | } | ||
353 | static DEVICE_ATTR(host_busy, S_IRUGO, show_host_busy, NULL); | ||
354 | |||
347 | static struct attribute *scsi_sysfs_shost_attrs[] = { | 355 | static struct attribute *scsi_sysfs_shost_attrs[] = { |
356 | &dev_attr_use_blk_mq.attr, | ||
348 | &dev_attr_unique_id.attr, | 357 | &dev_attr_unique_id.attr, |
349 | &dev_attr_host_busy.attr, | 358 | &dev_attr_host_busy.attr, |
350 | &dev_attr_cmd_per_lun.attr, | 359 | &dev_attr_cmd_per_lun.attr, |
@@ -577,14 +586,30 @@ static int scsi_sdev_check_buf_bit(const char *buf) | |||
577 | /* | 586 | /* |
578 | * Create the actual show/store functions and data structures. | 587 | * Create the actual show/store functions and data structures. |
579 | */ | 588 | */ |
580 | sdev_rd_attr (device_blocked, "%d\n"); | ||
581 | sdev_rd_attr (device_busy, "%d\n"); | ||
582 | sdev_rd_attr (type, "%d\n"); | 589 | sdev_rd_attr (type, "%d\n"); |
583 | sdev_rd_attr (scsi_level, "%d\n"); | 590 | sdev_rd_attr (scsi_level, "%d\n"); |
584 | sdev_rd_attr (vendor, "%.8s\n"); | 591 | sdev_rd_attr (vendor, "%.8s\n"); |
585 | sdev_rd_attr (model, "%.16s\n"); | 592 | sdev_rd_attr (model, "%.16s\n"); |
586 | sdev_rd_attr (rev, "%.4s\n"); | 593 | sdev_rd_attr (rev, "%.4s\n"); |
587 | 594 | ||
595 | static ssize_t | ||
596 | sdev_show_device_busy(struct device *dev, struct device_attribute *attr, | ||
597 | char *buf) | ||
598 | { | ||
599 | struct scsi_device *sdev = to_scsi_device(dev); | ||
600 | return snprintf(buf, 20, "%d\n", atomic_read(&sdev->device_busy)); | ||
601 | } | ||
602 | static DEVICE_ATTR(device_busy, S_IRUGO, sdev_show_device_busy, NULL); | ||
603 | |||
604 | static ssize_t | ||
605 | sdev_show_device_blocked(struct device *dev, struct device_attribute *attr, | ||
606 | char *buf) | ||
607 | { | ||
608 | struct scsi_device *sdev = to_scsi_device(dev); | ||
609 | return snprintf(buf, 20, "%d\n", atomic_read(&sdev->device_blocked)); | ||
610 | } | ||
611 | static DEVICE_ATTR(device_blocked, S_IRUGO, sdev_show_device_blocked, NULL); | ||
612 | |||
588 | /* | 613 | /* |
589 | * TODO: can we make these symlinks to the block layer ones? | 614 | * TODO: can we make these symlinks to the block layer ones? |
590 | */ | 615 | */ |
@@ -1230,13 +1255,13 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev) | |||
1230 | device_initialize(&sdev->sdev_gendev); | 1255 | device_initialize(&sdev->sdev_gendev); |
1231 | sdev->sdev_gendev.bus = &scsi_bus_type; | 1256 | sdev->sdev_gendev.bus = &scsi_bus_type; |
1232 | sdev->sdev_gendev.type = &scsi_dev_type; | 1257 | sdev->sdev_gendev.type = &scsi_dev_type; |
1233 | dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%d", | 1258 | dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%llu", |
1234 | sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); | 1259 | sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); |
1235 | 1260 | ||
1236 | device_initialize(&sdev->sdev_dev); | 1261 | device_initialize(&sdev->sdev_dev); |
1237 | sdev->sdev_dev.parent = get_device(&sdev->sdev_gendev); | 1262 | sdev->sdev_dev.parent = get_device(&sdev->sdev_gendev); |
1238 | sdev->sdev_dev.class = &sdev_class; | 1263 | sdev->sdev_dev.class = &sdev_class; |
1239 | dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%d", | 1264 | dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%llu", |
1240 | sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); | 1265 | sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); |
1241 | sdev->scsi_level = starget->scsi_level; | 1266 | sdev->scsi_level = starget->scsi_level; |
1242 | transport_setup_device(&sdev->sdev_gendev); | 1267 | transport_setup_device(&sdev->sdev_gendev); |