From 323907801e58b87e4ef0fd69b6e3f8fc85e99ae6 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 3 Feb 2004 18:44:47 -0800 Subject: [PATCH] [PATCH] /proc/paritions: omit removable media From: Neil Brown If programs like mount use /proc/partitions to find filesystems based on labels, then surely we want md devices in there as they often contain filesystems. If the problem is that mount-by-label takes forever with removable media then surely the "right" approch is the following patch, and then actually set this flag on the "floppy.c" device. (It is already set for ide-floppy and sd devices). --- drivers/block/floppy.c | 1 + drivers/block/genhd.c | 6 ++++-- drivers/ide/ide-cd.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 7c5085a3d1938..a2c30ede8cc03 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4376,6 +4376,7 @@ int __init floppy_init(void) /* to be cleaned up... */ disks[drive]->private_data = (void*)(long)drive; disks[drive]->queue = floppy_queue; + disks[drive]->flags |= GENHD_FL_REMOVABLE; add_disk(disks[drive]); } diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c index 06a7d4ea0d1bd..a6b4e858eaa17 100644 --- a/drivers/block/genhd.c +++ b/drivers/block/genhd.c @@ -260,8 +260,10 @@ static int show_partition(struct seq_file *part, void *v) if (&sgp->kobj.entry == block_subsys.kset.list.next) seq_puts(part, "major minor #blocks name\n\n"); - /* Don't show non-partitionable devices or empty devices */ - if (!get_capacity(sgp) || sgp->minors == 1) + /* Don't show non-partitionable removeable devices or empty devices */ + if (!get_capacity(sgp) || + (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)) + ) return 0; /* show the full disk and all non-0 size partitions of it */ diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index ea535e042eec9..ca6e4a7dfaf5a 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -3511,7 +3511,7 @@ static int ide_cdrom_attach (ide_drive_t *drive) snprintf(g->devfs_name, sizeof(g->devfs_name), "%s/cd", drive->devfs_name); g->driverfs_dev = &drive->gendev; - g->flags = GENHD_FL_CD; + g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; if (ide_cdrom_setup(drive)) { struct cdrom_device_info *devinfo = &info->devinfo; DRIVER(drive)->busy--; -- 2.53.0