aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/block/capability.txt15
-rw-r--r--block/genhd.c10
-rw-r--r--include/linux/genhd.h1
3 files changed, 25 insertions, 1 deletions
diff --git a/Documentation/block/capability.txt b/Documentation/block/capability.txt
new file mode 100644
index 000000000000..2f1729424ef4
--- /dev/null
+++ b/Documentation/block/capability.txt
@@ -0,0 +1,15 @@
1Generic Block Device Capability
2===============================================================================
3This file documents the sysfs file block/<disk>/capability
4
5capability is a hex word indicating which capabilities a specific disk
6supports. For more information on bits not listed here, see
7include/linux/genhd.h
8
9Capability Value
10-------------------------------------------------------------------------------
11GENHD_FL_MEDIA_CHANGE_NOTIFY 4
12 When this bit is set, the disk supports Asynchronous Notification
13 of media change events. These events will be broadcast to user
14 space via kernel uevent.
15
diff --git a/block/genhd.c b/block/genhd.c
index 93a2cf654597..7efa8bb25da9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -423,7 +423,10 @@ static ssize_t disk_size_read(struct gendisk * disk, char *page)
423{ 423{
424 return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk)); 424 return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk));
425} 425}
426 426static ssize_t disk_capability_read(struct gendisk *disk, char *page)
427{
428 return sprintf(page, "%x\n", disk->flags);
429}
427static ssize_t disk_stats_read(struct gendisk * disk, char *page) 430static ssize_t disk_stats_read(struct gendisk * disk, char *page)
428{ 431{
429 preempt_disable(); 432 preempt_disable();
@@ -466,6 +469,10 @@ static struct disk_attribute disk_attr_size = {
466 .attr = {.name = "size", .mode = S_IRUGO }, 469 .attr = {.name = "size", .mode = S_IRUGO },
467 .show = disk_size_read 470 .show = disk_size_read
468}; 471};
472static struct disk_attribute disk_attr_capability = {
473 .attr = {.name = "capability", .mode = S_IRUGO },
474 .show = disk_capability_read
475};
469static struct disk_attribute disk_attr_stat = { 476static struct disk_attribute disk_attr_stat = {
470 .attr = {.name = "stat", .mode = S_IRUGO }, 477 .attr = {.name = "stat", .mode = S_IRUGO },
471 .show = disk_stats_read 478 .show = disk_stats_read
@@ -506,6 +513,7 @@ static struct attribute * default_attrs[] = {
506 &disk_attr_removable.attr, 513 &disk_attr_removable.attr,
507 &disk_attr_size.attr, 514 &disk_attr_size.attr,
508 &disk_attr_stat.attr, 515 &disk_attr_stat.attr,
516 &disk_attr_capability.attr,
509#ifdef CONFIG_FAIL_MAKE_REQUEST 517#ifdef CONFIG_FAIL_MAKE_REQUEST
510 &disk_attr_fail.attr, 518 &disk_attr_fail.attr,
511#endif 519#endif
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 4c03ee353e78..3fcfed2168a7 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -94,6 +94,7 @@ struct hd_struct {
94 94
95#define GENHD_FL_REMOVABLE 1 95#define GENHD_FL_REMOVABLE 1
96#define GENHD_FL_DRIVERFS 2 96#define GENHD_FL_DRIVERFS 2
97#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4
97#define GENHD_FL_CD 8 98#define GENHD_FL_CD 8
98#define GENHD_FL_UP 16 99#define GENHD_FL_UP 16
99#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 100#define GENHD_FL_SUPPRESS_PARTITION_INFO 32