diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-22 17:21:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-22 00:54:49 -0400 |
commit | 27f302519148f311307637d4c9a6d0fd87d07e4c (patch) | |
tree | 36693a6ec709b037730bb343e72bd8cc508999dc /block | |
parent | 66c64afec16a7b46212ecb2fa99998923bbeea3f (diff) |
block: make /proc/partitions and /proc/diskstats use class_find_device()
Use the proper class iterator function instead of mucking around in the
internals of the class structures.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'block')
-rw-r--r-- | block/genhd.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/block/genhd.c b/block/genhd.c index 70f1d7075783..c13cc77291af 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -317,17 +317,21 @@ static void *part_start(struct seq_file *part, loff_t *pos) | |||
317 | return NULL; | 317 | return NULL; |
318 | } | 318 | } |
319 | 319 | ||
320 | static int find_next(struct device *dev, void *data) | ||
321 | { | ||
322 | if (dev->type == &disk_type) | ||
323 | return 1; | ||
324 | return 0; | ||
325 | } | ||
326 | |||
320 | static void *part_next(struct seq_file *part, void *v, loff_t *pos) | 327 | static void *part_next(struct seq_file *part, void *v, loff_t *pos) |
321 | { | 328 | { |
322 | struct gendisk *gp = v; | 329 | struct gendisk *gp = v; |
323 | struct device *dev; | 330 | struct device *dev; |
324 | ++*pos; | 331 | ++*pos; |
325 | list_for_each_entry(dev, &gp->dev.node, node) { | 332 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
326 | if (&dev->node == &block_class.devices) | 333 | if (dev) |
327 | return NULL; | 334 | return dev_to_disk(dev); |
328 | if (dev->type == &disk_type) | ||
329 | return dev_to_disk(dev); | ||
330 | } | ||
331 | return NULL; | 335 | return NULL; |
332 | } | 336 | } |
333 | 337 | ||
@@ -578,12 +582,9 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos) | |||
578 | struct device *dev; | 582 | struct device *dev; |
579 | 583 | ||
580 | ++*pos; | 584 | ++*pos; |
581 | list_for_each_entry(dev, &gp->dev.node, node) { | 585 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
582 | if (&dev->node == &block_class.devices) | 586 | if (dev) |
583 | return NULL; | 587 | return dev_to_disk(dev); |
584 | if (dev->type == &disk_type) | ||
585 | return dev_to_disk(dev); | ||
586 | } | ||
587 | return NULL; | 588 | return NULL; |
588 | } | 589 | } |
589 | 590 | ||