From 223f1907e09ce375f9cd9cb24a2ec1d66f9f5fc2 Mon Sep 17 00:00:00 2001 From: Kristen Carlson Accardi Date: Wed, 23 May 2007 13:57:38 -0700 Subject: [PATCH] --- yaml --- r: 56874 b: refs/heads/master c: 86ce18d7b7925bfd6b64c061828ca2a857ee83b8 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/block/capability.txt | 15 +++++++++++++++ trunk/block/genhd.c | 10 +++++++++- trunk/include/linux/genhd.h | 1 + 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 trunk/Documentation/block/capability.txt diff --git a/[refs] b/[refs] index 3e2b9d7c60bb..33df32c97382 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 352823160613b65fdaa558be486720a71f75ed86 +refs/heads/master: 86ce18d7b7925bfd6b64c061828ca2a857ee83b8 diff --git a/trunk/Documentation/block/capability.txt b/trunk/Documentation/block/capability.txt new file mode 100644 index 000000000000..2f1729424ef4 --- /dev/null +++ b/trunk/Documentation/block/capability.txt @@ -0,0 +1,15 @@ +Generic Block Device Capability +=============================================================================== +This file documents the sysfs file block//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. + diff --git a/trunk/block/genhd.c b/trunk/block/genhd.c index 93a2cf654597..7efa8bb25da9 100644 --- a/trunk/block/genhd.c +++ b/trunk/block/genhd.c @@ -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(); @@ -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 @@ -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 diff --git a/trunk/include/linux/genhd.h b/trunk/include/linux/genhd.h index 4c03ee353e78..3fcfed2168a7 100644 --- a/trunk/include/linux/genhd.h +++ b/trunk/include/linux/genhd.h @@ -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