*/
void __init printk_all_partitions(void)
{
- mutex_lock(&block_class_lock);
class_for_each_device(&block_class, NULL, NULL, printk_partition);
- mutex_unlock(&block_class_lock);
}
#ifdef CONFIG_PROC_FS
static void *part_start(struct seq_file *part, loff_t *pos)
{
struct device *dev;
- loff_t k = *pos;
+ loff_t n = *pos;
- if (!k)
+ if (!n)
part->private = (void *)1LU; /* tell show to print header */
- mutex_lock(&block_class_lock);
- dev = class_find_device(&block_class, NULL, &k, find_start);
- if (dev) {
- put_device(dev);
+ dev = class_find_device(&block_class, NULL, &n, find_start);
+ if (dev)
return dev_to_disk(dev);
- }
+
return NULL;
}
static void part_stop(struct seq_file *part, void *v)
{
- mutex_unlock(&block_class_lock);
}
static int show_partition(struct seq_file *part, void *v)
static void *diskstats_start(struct seq_file *part, loff_t *pos)
{
struct device *dev;
- loff_t k = *pos;
+ loff_t n = *pos;
- mutex_lock(&block_class_lock);
- dev = class_find_device(&block_class, NULL, &k, find_start);
- if (dev) {
- put_device(dev);
+ dev = class_find_device(&block_class, NULL, &n, find_start);
+ if (dev)
return dev_to_disk(dev);
- }
+
return NULL;
}
static void diskstats_stop(struct seq_file *part, void *v)
{
- mutex_unlock(&block_class_lock);
}
static int diskstats_show(struct seq_file *s, void *v)
dev_t devt = MKDEV(0, 0);
struct find_block find;
- mutex_lock(&block_class_lock);
find.name = name;
find.part = part;
dev = class_find_device(&block_class, NULL, &find, match_id);
devt = MKDEV(MAJOR(dev->devt),
MINOR(dev->devt) + part);
}
- mutex_unlock(&block_class_lock);
return devt;
}