* [PATCH RESEND] scsi: Export SCSI Inquiry data to sysfs
@ 2015-11-09 9:56 Johannes Thumshirn
2015-11-09 12:04 ` Christoph Hellwig
2015-11-09 16:47 ` Martin K. Petersen
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2015-11-09 9:56 UTC (permalink / raw)
To: James Bottomley, Martin K. Petersen
Cc: Hannes Reinecke, linux-scsi, Johannes Thumshirn
Export the RAW SCSI Inquiry to sysfs as binfile. This way the data can be used
by userland without the need to have and ioctl or use the sg_inq tool.
Here is an example of the provided data
linux:~ # hexdump /sys/class/scsi_device/1\:0\:0\:0/device/inquiry
0000000 8005 3205 001f 0000 4551 554d 2020 2020
0000010 4551 554d 4420 4456 522d 4d4f 2020 2020
0000020 2e32 2e33
0000024
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
1st sent on Aug. 14 2015
1st resend on Oct. 30 2015
drivers/scsi/scsi_sysfs.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index b333389..fdcf0ab 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -773,6 +773,29 @@ static struct bin_attribute dev_attr_vpd_##_page = { \
sdev_vpd_pg_attr(pg83);
sdev_vpd_pg_attr(pg80);
+static ssize_t show_inquiry(struct file *filep, struct kobject *kobj,
+ struct bin_attribute *bin_attr,
+ char *buf, loff_t off, size_t count)
+{
+ struct device *dev = container_of(kobj, struct device, kobj);
+ struct scsi_device *sdev = to_scsi_device(dev);
+
+ if (!sdev->inquiry)
+ return -EINVAL;
+
+ return memory_read_from_buffer(buf, count, &off, sdev->inquiry,
+ sdev->inquiry_len);
+}
+
+static struct bin_attribute dev_attr_inquiry = {
+ .attr = {
+ .name = "inquiry",
+ .mode = S_IRUGO,
+ },
+ .size = 0,
+ .read = show_inquiry,
+};
+
static ssize_t
show_iostat_counterbits(struct device *dev, struct device_attribute *attr,
char *buf)
@@ -957,6 +980,7 @@ static struct attribute *scsi_sdev_attrs[] = {
static struct bin_attribute *scsi_sdev_bin_attrs[] = {
&dev_attr_vpd_pg83,
&dev_attr_vpd_pg80,
+ &dev_attr_inquiry,
NULL
};
static struct attribute_group scsi_sdev_attr_group = {
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] scsi: Export SCSI Inquiry data to sysfs
2015-11-09 9:56 [PATCH RESEND] scsi: Export SCSI Inquiry data to sysfs Johannes Thumshirn
@ 2015-11-09 12:04 ` Christoph Hellwig
2015-11-09 16:47 ` Martin K. Petersen
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2015-11-09 12:04 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: James Bottomley, Martin K. Petersen, Hannes Reinecke, linux-scsi
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] scsi: Export SCSI Inquiry data to sysfs
2015-11-09 9:56 [PATCH RESEND] scsi: Export SCSI Inquiry data to sysfs Johannes Thumshirn
2015-11-09 12:04 ` Christoph Hellwig
@ 2015-11-09 16:47 ` Martin K. Petersen
1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2015-11-09 16:47 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: James Bottomley, Martin K. Petersen, Hannes Reinecke, linux-scsi
>>>>> "Johannes" == Johannes Thumshirn <jthumshirn@suse.de> writes:
Johannes> Export the RAW SCSI Inquiry to sysfs as binfile. This way the
Johannes> data can be used by userland without the need to have and
Johannes> ioctl or use the sg_inq tool.
Applied.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH RESEND] scsi: Export SCSI Inquiry data to sysfs
@ 2015-10-30 12:06 Johannes Thumshirn
0 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2015-10-30 12:06 UTC (permalink / raw)
To: James Bottomley; +Cc: Hannes Reinecke, linux-scsi, Johannes Thumshirn
Export the RAW SCSI Inquiry to sysfs as binfile. This way the data can be used
by userland without the need to have and ioctl or use the sg_inq tool.
Here is an example of the provided data
linux:~ # hexdump /sys/class/scsi_device/1\:0\:0\:0/device/inquiry
0000000 8005 3205 001f 0000 4551 554d 2020 2020
0000010 4551 554d 4420 4456 522d 4d4f 2020 2020
0000020 2e32 2e33
0000024
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
drivers/scsi/scsi_sysfs.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index b333389..fdcf0ab 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -773,6 +773,29 @@ static struct bin_attribute dev_attr_vpd_##_page = { \
sdev_vpd_pg_attr(pg83);
sdev_vpd_pg_attr(pg80);
+static ssize_t show_inquiry(struct file *filep, struct kobject *kobj,
+ struct bin_attribute *bin_attr,
+ char *buf, loff_t off, size_t count)
+{
+ struct device *dev = container_of(kobj, struct device, kobj);
+ struct scsi_device *sdev = to_scsi_device(dev);
+
+ if (!sdev->inquiry)
+ return -EINVAL;
+
+ return memory_read_from_buffer(buf, count, &off, sdev->inquiry,
+ sdev->inquiry_len);
+}
+
+static struct bin_attribute dev_attr_inquiry = {
+ .attr = {
+ .name = "inquiry",
+ .mode = S_IRUGO,
+ },
+ .size = 0,
+ .read = show_inquiry,
+};
+
static ssize_t
show_iostat_counterbits(struct device *dev, struct device_attribute *attr,
char *buf)
@@ -957,6 +980,7 @@ static struct attribute *scsi_sdev_attrs[] = {
static struct bin_attribute *scsi_sdev_bin_attrs[] = {
&dev_attr_vpd_pg83,
&dev_attr_vpd_pg80,
+ &dev_attr_inquiry,
NULL
};
static struct attribute_group scsi_sdev_attr_group = {
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-09 16:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09 9:56 [PATCH RESEND] scsi: Export SCSI Inquiry data to sysfs Johannes Thumshirn
2015-11-09 12:04 ` Christoph Hellwig
2015-11-09 16:47 ` Martin K. Petersen
-- strict thread matches above, loose matches on Subject: below --
2015-10-30 12:06 Johannes Thumshirn
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.