* [PATCH] osduld: Add osdname & systemid sysfs at scsi_osd class
@ 2012-10-24 21:51 Boaz Harrosh
2012-10-24 21:55 ` [osd-dev] " Boaz Harrosh
0 siblings, 1 reply; 3+ messages in thread
From: Boaz Harrosh @ 2012-10-24 21:51 UTC (permalink / raw)
To: James Bottomley, linux-scsi, open-osd
This patch adds the support for the following two read-only sysfs attributes
to scsi_osd class members : osdname & systemid
These attributes will show up as below in sysfs class hierarchy:
/sys/class/scsi_osd/osdX/osdname
/sys/class/scsi_osd/osdX/systemid
The osdname & systemid are OSD device attributes which uniquely
identify a device on the network, while it's IP and certainly
it's /dev/osdX device path might change.
Userspace utilities (e.g. mkfs.exofs) can parse these attributes to
identify the correct OSD in safer and faster way.
(Today osd apps open each device in the system and send a
attributes query for these, in order to access the user
requested device)
Signed-off-by: Sachin Bhamare <sbhamare@panasas.com>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
drivers/scsi/osd/osd_uld.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index d4ed9eb..4375417 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -97,9 +97,37 @@ struct osd_dev_handle {
static DEFINE_IDA(osd_minor_ida);
+/*
+ * scsi sysfs attribute operations
+ */
+static ssize_t osdname_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct osd_uld_device *ould = container_of(dev, struct osd_uld_device,
+ class_dev);
+ return sprintf(buf, "%s\n", ould->odi.osdname);
+}
+
+static ssize_t systemid_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct osd_uld_device *ould = container_of(dev, struct osd_uld_device,
+ class_dev);
+
+ memcpy(buf, ould->odi.systemid, ould->odi.systemid_len);
+ return ould->odi.systemid_len;
+}
+
+static struct device_attribute osd_uld_attrs[] = {
+ __ATTR(osdname, S_IRUGO, osdname_show, NULL),
+ __ATTR(systemid, S_IRUGO, systemid_show, NULL),
+ __ATTR_NULL,
+};
+
static struct class osd_uld_class = {
.owner = THIS_MODULE,
.name = "scsi_osd",
+ .dev_attrs = osd_uld_attrs,
};
/*
--
1.7.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [osd-dev] [PATCH] osduld: Add osdname & systemid sysfs at scsi_osd class
2012-10-24 21:51 [PATCH] osduld: Add osdname & systemid sysfs at scsi_osd class Boaz Harrosh
@ 2012-10-24 21:55 ` Boaz Harrosh
2012-11-05 20:15 ` Boaz Harrosh
0 siblings, 1 reply; 3+ messages in thread
From: Boaz Harrosh @ 2012-10-24 21:55 UTC (permalink / raw)
To: James Bottomley, linux-scsi, open-osd
On 10/24/2012 02:51 PM, Boaz Harrosh wrote:
>
> This patch adds the support for the following two read-only sysfs attributes
> to scsi_osd class members : osdname & systemid
>
> These attributes will show up as below in sysfs class hierarchy:
> /sys/class/scsi_osd/osdX/osdname
> /sys/class/scsi_osd/osdX/systemid
>
> The osdname & systemid are OSD device attributes which uniquely
> identify a device on the network, while it's IP and certainly
> it's /dev/osdX device path might change.
> Userspace utilities (e.g. mkfs.exofs) can parse these attributes to
> identify the correct OSD in safer and faster way.
>
> (Today osd apps open each device in the system and send a
> attributes query for these, in order to access the user
> requested device)
>
> Signed-off-by: Sachin Bhamare <sbhamare@panasas.com>
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
James hi.
This is for the next (v3.8) merge window. Please submit to scsi-misc tree.
It is actually a very old well tested, but forgotten patch.
Thanks
Boaz
> ---
> drivers/scsi/osd/osd_uld.c | 28 ++++++++++++++++++++++++++++
> 1 files changed, 28 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
> index d4ed9eb..4375417 100644
> --- a/drivers/scsi/osd/osd_uld.c
> +++ b/drivers/scsi/osd/osd_uld.c
> @@ -97,9 +97,37 @@ struct osd_dev_handle {
>
> static DEFINE_IDA(osd_minor_ida);
>
> +/*
> + * scsi sysfs attribute operations
> + */
> +static ssize_t osdname_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct osd_uld_device *ould = container_of(dev, struct osd_uld_device,
> + class_dev);
> + return sprintf(buf, "%s\n", ould->odi.osdname);
> +}
> +
> +static ssize_t systemid_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct osd_uld_device *ould = container_of(dev, struct osd_uld_device,
> + class_dev);
> +
> + memcpy(buf, ould->odi.systemid, ould->odi.systemid_len);
> + return ould->odi.systemid_len;
> +}
> +
> +static struct device_attribute osd_uld_attrs[] = {
> + __ATTR(osdname, S_IRUGO, osdname_show, NULL),
> + __ATTR(systemid, S_IRUGO, systemid_show, NULL),
> + __ATTR_NULL,
> +};
> +
> static struct class osd_uld_class = {
> .owner = THIS_MODULE,
> .name = "scsi_osd",
> + .dev_attrs = osd_uld_attrs,
> };
>
> /*
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [osd-dev] [PATCH] osduld: Add osdname & systemid sysfs at scsi_osd class
2012-10-24 21:55 ` [osd-dev] " Boaz Harrosh
@ 2012-11-05 20:15 ` Boaz Harrosh
0 siblings, 0 replies; 3+ messages in thread
From: Boaz Harrosh @ 2012-11-05 20:15 UTC (permalink / raw)
To: James Bottomley, linux-scsi, open-osd
On 10/24/2012 02:55 PM, Boaz Harrosh wrote:
> On 10/24/2012 02:51 PM, Boaz Harrosh wrote:
>>
>> This patch adds the support for the following two read-only sysfs attributes
>> to scsi_osd class members : osdname & systemid
>>
>> These attributes will show up as below in sysfs class hierarchy:
>> /sys/class/scsi_osd/osdX/osdname
>> /sys/class/scsi_osd/osdX/systemid
>>
>> The osdname & systemid are OSD device attributes which uniquely
>> identify a device on the network, while it's IP and certainly
>> it's /dev/osdX device path might change.
>> Userspace utilities (e.g. mkfs.exofs) can parse these attributes to
>> identify the correct OSD in safer and faster way.
>>
>> (Today osd apps open each device in the system and send a
>> attributes query for these, in order to access the user
>> requested device)
>>
>> Signed-off-by: Sachin Bhamare <sbhamare@panasas.com>
>> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
>
> James hi.
>
> This is for the next (v3.8) merge window. Please submit to scsi-misc tree.
>
James ping!
Do you want that I push it through my osd tree?
Thanks
Boaz
> It is actually a very old well tested, but forgotten patch.
>
> Thanks
> Boaz
>
>> ---
>> drivers/scsi/osd/osd_uld.c | 28 ++++++++++++++++++++++++++++
>> 1 files changed, 28 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
>> index d4ed9eb..4375417 100644
>> --- a/drivers/scsi/osd/osd_uld.c
>> +++ b/drivers/scsi/osd/osd_uld.c
>> @@ -97,9 +97,37 @@ struct osd_dev_handle {
>>
>> static DEFINE_IDA(osd_minor_ida);
>>
>> +/*
>> + * scsi sysfs attribute operations
>> + */
>> +static ssize_t osdname_show(struct device *dev, struct device_attribute *attr,
>> + char *buf)
>> +{
>> + struct osd_uld_device *ould = container_of(dev, struct osd_uld_device,
>> + class_dev);
>> + return sprintf(buf, "%s\n", ould->odi.osdname);
>> +}
>> +
>> +static ssize_t systemid_show(struct device *dev, struct device_attribute *attr,
>> + char *buf)
>> +{
>> + struct osd_uld_device *ould = container_of(dev, struct osd_uld_device,
>> + class_dev);
>> +
>> + memcpy(buf, ould->odi.systemid, ould->odi.systemid_len);
>> + return ould->odi.systemid_len;
>> +}
>> +
>> +static struct device_attribute osd_uld_attrs[] = {
>> + __ATTR(osdname, S_IRUGO, osdname_show, NULL),
>> + __ATTR(systemid, S_IRUGO, systemid_show, NULL),
>> + __ATTR_NULL,
>> +};
>> +
>> static struct class osd_uld_class = {
>> .owner = THIS_MODULE,
>> .name = "scsi_osd",
>> + .dev_attrs = osd_uld_attrs,
>> };
>>
>> /*
>>
>
>
> _______________________________________________
> osd-dev mailing list
> osd-dev@open-osd.org
> http://mailman.open-osd.org/mailman/listinfo/osd-dev
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-05 20:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-24 21:51 [PATCH] osduld: Add osdname & systemid sysfs at scsi_osd class Boaz Harrosh
2012-10-24 21:55 ` [osd-dev] " Boaz Harrosh
2012-11-05 20:15 ` Boaz Harrosh
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.