Re: [PATCH v2] scsi: Export SCSI Inquiry data to sysfs

2015-10-21 Thread Hannes Reinecke
On 09/24/2015 04:54 PM, Johannes Thumshirn wrote:
> 
> Ping?
> 
I really would like to see them included, as with this we can move
the udev rules over to not issuing any SG_IO commands during event
processing. This helps a lot for multipath failover scenarios.

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries & Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] scsi: Export SCSI Inquiry data to sysfs

2015-09-24 Thread Johannes Thumshirn

Ping?
-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] scsi: Export SCSI Inquiry data to sysfs

2015-08-14 Thread 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
000 8005 3205 001f  4551 554d 2020 2020
010 4551 554d 4420 4456 522d 4d4f 2020 2020
020 2e32 2e33
024

Signed-off-by: Johannes Thumshirn jthumsh...@suse.de
Reviewed-by: Hannes Reinecke h...@suse.de
---

Chanes to v1:
* Correct typo userlang - userland in commit message.

 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 9ad4116..5ecb65d 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.5.0

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html