aboutsummaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c
index b5664440896c..93a2cf654597 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -213,6 +213,59 @@ struct gendisk *get_gendisk(dev_t dev, int *part)
213 return kobj ? to_disk(kobj) : NULL; 213 return kobj ? to_disk(kobj) : NULL;
214} 214}
215 215
216/*
217 * print a full list of all partitions - intended for places where the root
218 * filesystem can't be mounted and thus to give the victim some idea of what
219 * went wrong
220 */
221void __init printk_all_partitions(void)
222{
223 int n;
224 struct gendisk *sgp;
225
226 mutex_lock(&block_subsys_lock);
227 /* For each block device... */
228 list_for_each_entry(sgp, &block_subsys.list, kobj.entry) {
229 char buf[BDEVNAME_SIZE];
230 /*
231 * Don't show empty devices or things that have been surpressed
232 */
233 if (get_capacity(sgp) == 0 ||
234 (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO))
235 continue;
236
237 /*
238 * Note, unlike /proc/partitions, I am showing the numbers in
239 * hex - the same format as the root= option takes.
240 */
241 printk("%02x%02x %10llu %s",
242 sgp->major, sgp->first_minor,
243 (unsigned long long)get_capacity(sgp) >> 1,
244 disk_name(sgp, 0, buf));
245 if (sgp->driverfs_dev != NULL &&
246 sgp->driverfs_dev->driver != NULL)
247 printk(" driver: %s\n",
248 sgp->driverfs_dev->driver->name);
249 else
250 printk(" (driver?)\n");
251
252 /* now show the partitions */
253 for (n = 0; n < sgp->minors - 1; ++n) {
254 if (sgp->part[n] == NULL)
255 continue;
256 if (sgp->part[n]->nr_sects == 0)
257 continue;
258 printk(" %02x%02x %10llu %s\n",
259 sgp->major, n + 1 + sgp->first_minor,
260 (unsigned long long)sgp->part[n]->nr_sects >> 1,
261 disk_name(sgp, n + 1, buf));
262 } /* partition subloop */
263 } /* Block device loop */
264
265 mutex_unlock(&block_subsys_lock);
266 return;
267}
268
216#ifdef CONFIG_PROC_FS 269#ifdef CONFIG_PROC_FS
217/* iterator */ 270/* iterator */
218static void *part_start(struct seq_file *part, loff_t *pos) 271static void *part_start(struct seq_file *part, loff_t *pos)