diff options
author | Kristen Carlson Accardi <kristen.c.accardi@intel.com> | 2007-05-23 16:57:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-23 23:14:11 -0400 |
commit | 86ce18d7b7925bfd6b64c061828ca2a857ee83b8 (patch) | |
tree | b753b7fd6d195aa7ed9eebc5a3917c5f20786260 /block/genhd.c | |
parent | 352823160613b65fdaa558be486720a71f75ed86 (diff) |
genhd: expose AN to user space
Allow user space to determine if a disk supports Asynchronous Notification of
media changes. This is done by adding a new sysfs file "capability_flags",
which is documented in (insert file name). This sysfs file will export all
disk capabilities flags to user space. We also define a new flag to define
the media change notification capability.
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 10 |
1 files changed, 9 insertions, 1 deletions
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 | 426 | static ssize_t disk_capability_read(struct gendisk *disk, char *page) | |
427 | { | ||
428 | return sprintf(page, "%x\n", disk->flags); | ||
429 | } | ||
427 | static ssize_t disk_stats_read(struct gendisk * disk, char *page) | 430 | static 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 | }; |
472 | static struct disk_attribute disk_attr_capability = { | ||
473 | .attr = {.name = "capability", .mode = S_IRUGO }, | ||
474 | .show = disk_capability_read | ||
475 | }; | ||
469 | static struct disk_attribute disk_attr_stat = { | 476 | static 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 |