public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandra Seetharaman <sekharan@us.ibm.com>
To: Hannes Reinecke <hare@suse.de>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/2] Add 'tpgs' sysfs attribute for SCSI devices
Date: Thu, 16 Apr 2009 09:30:16 -0700	[thread overview]
Message-ID: <1239899416.1196.10.camel@chandra-ubuntu> (raw)
In-Reply-To: <20090319080634.918B718C79D@pentland.suse.de>

Looks good to me

Acked-by: Chandra Seetharaman <sekharan@us.ibm.com>

On Thu, 2009-03-19 at 09:06 +0100, Hannes Reinecke wrote:
> We need the 'TGPS' setting of the inquiry data
> to properly support ALUA. So just add an accessor
> for the stored inquiry data and display it
> in sysfs.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/scsi/scsi_sysfs.c  |   10 ++++++++++
>  include/scsi/scsi_device.h |    5 +++++
>  2 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index fa4711d..cccdd89 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -586,6 +586,15 @@ sdev_store_timeout (struct device *dev, struct device_attribute *attr,
>  static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout);
> 
>  static ssize_t
> +sdev_show_tpgs (struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct scsi_device *sdev;
> +	sdev = to_scsi_device(dev);
> +	return snprintf(buf, 20, "%d\n", scsi_device_tpgs(sdev));
> +}
> +static DEVICE_ATTR(tpgs, S_IRUGO, sdev_show_tpgs, NULL);
> +
> +static ssize_t
>  store_rescan_field (struct device *dev, struct device_attribute *attr,
>  		    const char *buf, size_t count)
>  {
> @@ -745,6 +754,7 @@ static struct attribute *scsi_sdev_attrs[] = {
>  	&dev_attr_vendor.attr,
>  	&dev_attr_model.attr,
>  	&dev_attr_rev.attr,
> +	&dev_attr_tpgs.attr,
>  	&dev_attr_rescan.attr,
>  	&dev_attr_delete.attr,
>  	&dev_attr_state.attr,
> diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
> index 3f566af..6ac6321 100644
> --- a/include/scsi/scsi_device.h
> +++ b/include/scsi/scsi_device.h
> @@ -450,6 +450,11 @@ static inline int scsi_device_protection(struct scsi_device *sdev)
>  	return sdev->scsi_level > SCSI_2 && sdev->inquiry[5] & (1<<0);
>  }
> 
> +static inline int scsi_device_tpgs(struct scsi_device *sdev)
> +{
> +	return (sdev->inquiry[5] >> 4) &3;
> +}
> +
>  #define MODULE_ALIAS_SCSI_DEVICE(type) \
>  	MODULE_ALIAS("scsi:t-" __stringify(type) "*")
>  #define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x"


      parent reply	other threads:[~2009-04-16 16:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-19  8:06 [PATCH 1/2] Add 'tpgs' sysfs attribute for SCSI devices Hannes Reinecke
2009-03-19 10:42 ` Nicholas A. Bellinger
2009-04-16 16:30 ` Chandra Seetharaman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1239899416.1196.10.camel@chandra-ubuntu \
    --to=sekharan@us.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sekharan@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox