All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: Patrick Mansfield <patmans@us.ibm.com>,
	Christoph Hellwig <hch@infradead.org>,
	Matthew Dharm <mdharm-scsi@one-eyed-alien.net>,
	SCSI development list <linux-scsi@vger.kernel.org>,
	USB Storage List <usb-storage@one-eyed-alien.net>
Subject: PATCH: (as168) Sysfs attribute file for max_sectors
Date: Wed, 7 Jan 2004 11:16:07 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.0401071113560.850-100000@ida.rowland.org> (raw)
In-Reply-To: <1073418475.2047.82.camel@mulgrave>

On 6 Jan 2004, James Bottomley wrote:

> Not really.  For most drivers, the max_sectors is a driver table
> parameter and the user shouldn't be changing it.
> 
> The value can be acceptably exported read only in scsi_sysfs.c;  then,
> you could use the attribute overriding code to make this read/write for
> usb-storage only.

Is this patch okay?  (Along with exporting max_sectors read-only, it fixes
two small typos.)

Alan Stern


===== scsi_sysfs.c 1.24 vs edited =====
--- 1.24/drivers/scsi/scsi_sysfs.c	Wed Nov 26 18:52:56 2003
+++ edited/drivers/scsi/scsi_sysfs.c	Wed Jan  7 11:11:44 2004
@@ -200,7 +200,7 @@
 
 
 /*
- * sdev_rd_attr: create a function and attribute variable for a
+ * sdev_rw_attr: create a function and attribute variable for a
  * read/write field.
  */
 #define sdev_rw_attr(field, format_string)				\
@@ -217,7 +217,7 @@
 static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, sdev_show_##field, sdev_store_##field)
 
 /*
- * sdev_rd_attr: create a function and attribute variable for a
+ * sdev_rw_attr: create a function and attribute variable for a
  * read/write bit field.
  */
 #define sdev_rw_attr_bit(field)						\
@@ -283,6 +283,16 @@
 };
 static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
 
+static ssize_t
+sdev_show_max_sectors(struct device *dev, char *buf)
+{
+	struct scsi_device *sdev;
+	sdev = to_scsi_device(dev);
+	return snprintf (buf, 20, "%d\n", sdev->request_queue->max_sectors);
+}
+static DEVICE_ATTR(max_sectors, S_IRUGO, sdev_show_max_sectors, NULL);
+
+
 /* Default template for device attributes.  May NOT be modified */
 static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
 	&dev_attr_device_blocked,
@@ -295,6 +305,7 @@
 	&dev_attr_online,
 	&dev_attr_rescan,
 	&dev_attr_delete,
+	&dev_attr_max_sectors,
 	NULL
 };
 


  reply	other threads:[~2004-01-07 16:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20031207051634.GB21951@one-eyed-alien.net>
2003-12-08 16:15 ` Notify about errors during initialization Alan Stern
2004-01-05  2:10   ` Matthew Dharm
2004-01-05 22:04     ` Alan Stern
2004-01-05 22:13       ` Christoph Hellwig
2004-01-05 23:32         ` Mike Anderson
2004-01-06 16:17           ` Christoph Hellwig
2004-01-06 17:15             ` Patrick Mansfield
2004-01-06 17:18               ` Christoph Hellwig
2004-01-06 18:08                 ` Mike Anderson
2004-01-06 18:08                   ` Christoph Hellwig
2004-01-06 19:04                     ` Mike Anderson
2004-01-06 18:07               ` Sysfs attribute file for max_sectors Alan Stern
2004-01-06 18:23                 ` James Bottomley
2004-01-06 19:31                   ` Alan Stern
2004-01-06 19:47                     ` James Bottomley
2004-01-07 16:16                       ` Alan Stern [this message]
2004-01-06 21:11                     ` Patrick Mansfield
2004-01-06 21:14                       ` Jens Axboe
2004-01-06 22:00                       ` Alan Stern

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=Pine.LNX.4.44L0.0401071113560.850-100000@ida.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=James.Bottomley@steeleye.com \
    --cc=hch@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mdharm-scsi@one-eyed-alien.net \
    --cc=patmans@us.ibm.com \
    --cc=usb-storage@one-eyed-alien.net \
    /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 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.