The recent change to /proc/partitions which prevents it from displaying
removeable media accidentally caused 128 NBD and 16 ramdisk partitions to
appear in /proc/partitions instead.

So add a specific gendisk flag which says "don't show me in /proc/partitions"
and use that.



---

 drivers/block/genhd.c |    5 +++--
 drivers/block/nbd.c   |    1 +
 drivers/block/rd.c    |    1 +
 include/linux/genhd.h |    9 +++++----
 4 files changed, 10 insertions(+), 6 deletions(-)

diff -puN drivers/block/nbd.c~nbd-proc-partitions-fix drivers/block/nbd.c
--- 25/drivers/block/nbd.c~nbd-proc-partitions-fix	2004-02-10 20:06:17.000000000 -0800
+++ 25-akpm/drivers/block/nbd.c	2004-02-10 20:07:26.000000000 -0800
@@ -741,6 +741,7 @@ static int __init nbd_init(void)
 		disk->first_minor = i;
 		disk->fops = &nbd_fops;
 		disk->private_data = &nbd_dev[i];
+		disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
 		sprintf(disk->disk_name, "nbd%d", i);
 		sprintf(disk->devfs_name, "nbd/%d", i);
 		set_capacity(disk, 0x3ffffe);
diff -puN drivers/block/genhd.c~nbd-proc-partitions-fix drivers/block/genhd.c
--- 25/drivers/block/genhd.c~nbd-proc-partitions-fix	2004-02-10 20:06:17.000000000 -0800
+++ 25-akpm/drivers/block/genhd.c	2004-02-10 20:08:15.000000000 -0800
@@ -262,8 +262,9 @@ static int show_partition(struct seq_fil
 
 	/* Don't show non-partitionable removeable devices or empty devices */
 	if (!get_capacity(sgp) ||
-	    (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE))
-		)
+			(sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)))
+		return 0;
+	if (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)
 		return 0;
 
 	/* show the full disk and all non-0 size partitions of it */
diff -puN include/linux/genhd.h~nbd-proc-partitions-fix include/linux/genhd.h
--- 25/include/linux/genhd.h~nbd-proc-partitions-fix	2004-02-10 20:06:17.000000000 -0800
+++ 25-akpm/include/linux/genhd.h	2004-02-10 20:08:36.000000000 -0800
@@ -64,10 +64,11 @@ struct hd_struct {
 	int policy, partno;
 };
 
-#define GENHD_FL_REMOVABLE  1
-#define GENHD_FL_DRIVERFS  2
-#define GENHD_FL_CD	8
-#define GENHD_FL_UP	16
+#define GENHD_FL_REMOVABLE			1
+#define GENHD_FL_DRIVERFS			2
+#define GENHD_FL_CD				8
+#define GENHD_FL_UP				16
+#define GENHD_FL_SUPPRESS_PARTITION_INFO	32
 
 struct disk_stats {
 	unsigned read_sectors, write_sectors;
diff -puN drivers/block/rd.c~nbd-proc-partitions-fix drivers/block/rd.c
--- 25/drivers/block/rd.c~nbd-proc-partitions-fix	2004-02-11 00:29:52.000000000 -0800
+++ 25-akpm/drivers/block/rd.c	2004-02-11 00:30:19.000000000 -0800
@@ -363,6 +363,7 @@ static int __init rd_init(void)
 		disk->first_minor = i;
 		disk->fops = &rd_bd_op;
 		disk->queue = rd_queue[i];
+		disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
 		sprintf(disk->disk_name, "ram%d", i);
 		sprintf(disk->devfs_name, "rd/%d", i);
 		set_capacity(disk, rd_size * 2);

_