public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@steeleye.com>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	SCSI Mailing List <linux-scsi@vger.kernel.org>,
	Patrick Mochel <mochel@osdl.org>, Greg KH <greg@kroah.com>,
	Mike Anderson <andmike@us.ibm.com>
Subject: Re: [RFC] support for sysfs string based properties for SCSI (1/3)
Date: 03 May 2003 14:19:23 -0500	[thread overview]
Message-ID: <1051989565.2036.14.camel@mulgrave> (raw)
In-Reply-To: <1051989099.2036.7.camel@mulgrave>

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

On Sat, 2003-05-03 at 14:11, James Bottomley wrote:
> 
> This first patch is of general interest (the other two are going to the
> SCSI list only).
> 
> The problem this seeks to solve is that we have a bunch of properties in
> SCSI that we'd like to expose through the sysfs interface.  The
> mid-layer can get their values, but setting them requires co-operation
> from the host drivers, thus we'd like to expose a show/store interface
> to all the SCSI drivers.
> 
> The current one call back per sysfs file is a bit unwieldy for
> encapsulating in an interface like this.  what this patch does is to
> allow a fallback show/store method of the bus type (if the device type
> doesn't exist).  However, the bus_type show/store passes in the
> attribute so a comparison may be done against the name of the attribute.
> 
> For details of how all this gets used, see the following SCSI patches.
> 
> James

And this time with the correct attachment.

James


[-- Attachment #2: Type: text/plain, Size: 1821 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1196  -> 1.1197 
#	 drivers/base/core.c	1.65    -> 1.66   
#	include/linux/device.h	1.87    -> 1.88   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/05/03	jejb@raven.il.steeleye.com	1.1197
# sysfs: add default show/store for bus_type
# 
# These are used if the device_attribute show/store are empty.  They
# allow buses to do string based parsing of the device properties.
# --------------------------------------------
#
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c	Sat May  3 14:18:21 2003
+++ b/drivers/base/core.c	Sat May  3 14:18:21 2003
@@ -42,6 +42,8 @@
 
 	if (dev_attr->show)
 		ret = dev_attr->show(dev,buf);
+	else if (dev->bus->show)
+		ret = dev->bus->show(dev, buf, attr);
 	return ret;
 }
 
@@ -55,6 +57,8 @@
 
 	if (dev_attr->store)
 		ret = dev_attr->store(dev,buf,count);
+	else if (dev->bus->store)
+		ret = dev->bus->store(dev,buf,count,attr);
 	return ret;
 }
 
diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h	Sat May  3 14:18:21 2003
+++ b/include/linux/device.h	Sat May  3 14:18:21 2003
@@ -74,6 +74,10 @@
 	struct device * (*add)	(struct device * parent, char * bus_id);
 	int		(*hotplug) (struct device *dev, char **envp, 
 				    int num_envp, char *buffer, int buffer_size);
+	ssize_t (*show)(struct device * dev, char * buf,
+			struct attribute *attr);
+	ssize_t (*store)(struct device * dev, const char * buf, size_t count,
+			 struct attribute *attr);
 };
 
 

  reply	other threads:[~2003-05-03 19:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-03 19:11 [RFC] support for sysfs string based properties for SCSI (1/3) James Bottomley
2003-05-03 19:19 ` James Bottomley [this message]
2003-05-03 19:25   ` [RFC] support for sysfs string based properties for SCSI (2/3) James Bottomley
2003-05-03 19:30     ` [RFC] support for sysfs string based properties for SCSI (3/3) James Bottomley
2003-05-05 17:02   ` [RFC] support for sysfs string based properties for SCSI (1/3) Greg KH
2003-05-05 17:08     ` James Bottomley
2003-05-05 17:17       ` Greg KH
2003-05-05 20:08         ` Mike Anderson
2003-05-06  0:05         ` James Bottomley
2003-05-13 21:02   ` Patrick Mochel

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=1051989565.2036.14.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=andmike@us.ibm.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mochel@osdl.org \
    /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