Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56874
b: refs/heads/master
c: 86ce18d
h: refs/heads/master
v: v3
  • Loading branch information
Kristen Carlson Accardi authored and Linus Torvalds committed May 24, 2007
1 parent 77a2660 commit 223f190
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 352823160613b65fdaa558be486720a71f75ed86
refs/heads/master: 86ce18d7b7925bfd6b64c061828ca2a857ee83b8
15 changes: 15 additions & 0 deletions trunk/Documentation/block/capability.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Generic Block Device Capability
===============================================================================
This file documents the sysfs file block/<disk>/capability

capability is a hex word indicating which capabilities a specific disk
supports. For more information on bits not listed here, see
include/linux/genhd.h

Capability Value
-------------------------------------------------------------------------------
GENHD_FL_MEDIA_CHANGE_NOTIFY 4
When this bit is set, the disk supports Asynchronous Notification
of media change events. These events will be broadcast to user
space via kernel uevent.

10 changes: 9 additions & 1 deletion trunk/block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,10 @@ static ssize_t disk_size_read(struct gendisk * disk, char *page)
{
return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk));
}

static ssize_t disk_capability_read(struct gendisk *disk, char *page)
{
return sprintf(page, "%x\n", disk->flags);
}
static ssize_t disk_stats_read(struct gendisk * disk, char *page)
{
preempt_disable();
Expand Down Expand Up @@ -466,6 +469,10 @@ static struct disk_attribute disk_attr_size = {
.attr = {.name = "size", .mode = S_IRUGO },
.show = disk_size_read
};
static struct disk_attribute disk_attr_capability = {
.attr = {.name = "capability", .mode = S_IRUGO },
.show = disk_capability_read
};
static struct disk_attribute disk_attr_stat = {
.attr = {.name = "stat", .mode = S_IRUGO },
.show = disk_stats_read
Expand Down Expand Up @@ -506,6 +513,7 @@ static struct attribute * default_attrs[] = {
&disk_attr_removable.attr,
&disk_attr_size.attr,
&disk_attr_stat.attr,
&disk_attr_capability.attr,
#ifdef CONFIG_FAIL_MAKE_REQUEST
&disk_attr_fail.attr,
#endif
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/genhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct hd_struct {

#define GENHD_FL_REMOVABLE 1
#define GENHD_FL_DRIVERFS 2
#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4
#define GENHD_FL_CD 8
#define GENHD_FL_UP 16
#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
Expand Down

0 comments on commit 223f190

Please sign in to comment.