]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fix display of NBD in /proc/partitions
authorAndrew Morton <akpm@osdl.org>
Wed, 18 Feb 2004 12:55:44 +0000 (04:55 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 18 Feb 2004 12:55:44 +0000 (04:55 -0800)
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
drivers/block/nbd.c
drivers/block/rd.c
include/linux/genhd.h

index a6b4e858eaa170daf53855c30984cdb2e90b3e90..3b70f812d265710f5365ebc66f1aab4314ac9e64 100644 (file)
@@ -262,8 +262,9 @@ static int show_partition(struct seq_file *part, void *v)
 
        /* 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 */
index 2784fbd4c17049e2734e3ec27543a348cd9b0bdc..a88005e7779ea18833cd4fcdef9415309ef4f0fe 100644 (file)
@@ -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);
index aadef364d25ec25f82d9ea5ac44bdc831aaa4a05..9e5a0e3637027c891664c9e55ed9e1ba8fd5f6b0 100644 (file)
@@ -354,6 +354,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);
index 14e79799fbd5547863981440728ed91b02ba08e5..91443522b9d80e8486bd292257a909b2eeed4c1b 100644 (file)
@@ -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;