From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core patches for 2.6.8-rc1
Date: Wed, 14 Jul 2004 17:18:24 -0700 [thread overview]
Message-ID: <1089850704407@kroah.com> (raw)
In-Reply-To: <10898507032467@kroah.com>
ChangeSet 1.1784.12.8, 2004/07/14 16:20:29-07:00, olh@suse.de
[PATCH] add removeable sysfs block device attribute
This patch adds a /block/*/removeable sysfs attribute. A value of 1
indicates the media can change anytime. This is a hint for userland
to poll such devices for possible media changes, and leave all others alone.
There is currently no way to see if a connected usb-storage device is a
disk or a card reader. It will also show 1 for CD and ZIP drives.
It was done by Patrick Mansfield a while ago. I can probably not
sigh-off his work. ;)
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/block/genhd.c | 11 +++++++++++
1 files changed, 11 insertions(+)
diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
--- a/drivers/block/genhd.c 2004-07-14 17:10:38 -07:00
+++ b/drivers/block/genhd.c 2004-07-14 17:10:38 -07:00
@@ -352,6 +352,12 @@
{
return sprintf(page, "%d\n", disk->minors);
}
+static ssize_t disk_removable_read(struct gendisk * disk, char *page)
+{
+ return sprintf(page, "%d\n",
+ (disk->flags & GENHD_FL_REMOVABLE ? 1 : 0));
+
+}
static ssize_t disk_size_read(struct gendisk * disk, char *page)
{
return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk));
@@ -384,6 +390,10 @@
.attr = {.name = "range", .mode = S_IRUGO },
.show = disk_range_read
};
+static struct disk_attribute disk_attr_removable = {
+ .attr = {.name = "removable", .mode = S_IRUGO },
+ .show = disk_removable_read
+};
static struct disk_attribute disk_attr_size = {
.attr = {.name = "size", .mode = S_IRUGO },
.show = disk_size_read
@@ -396,6 +406,7 @@
static struct attribute * default_attrs[] = {
&disk_attr_dev.attr,
&disk_attr_range.attr,
+ &disk_attr_removable.attr,
&disk_attr_size.attr,
&disk_attr_stat.attr,
NULL,
prev parent reply other threads:[~2004-07-15 0:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-15 0:16 [BK PATCH] Driver Core patches for 2.6.8-rc1 Greg KH
2004-07-15 0:18 ` [PATCH] " Greg KH
2004-07-15 0:18 ` Greg KH
2004-07-15 0:18 ` Greg KH
2004-07-15 0:18 ` Greg KH
2004-07-15 0:18 ` Greg KH
2004-07-15 0:18 ` Greg KH
2004-07-15 0:18 ` Greg KH
2004-07-15 0:18 ` Greg KH
2004-07-15 0:18 ` Greg KH [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=1089850704407@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.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