]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Initialise devfs_name in various block drivers
authorAndrew Morton <akpm@osdl.org>
Tue, 9 Sep 2003 17:18:38 +0000 (10:18 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 9 Sep 2003 17:18:38 +0000 (10:18 -0700)
From: Andrey Borzenkov <arvidjaar@mail.ru>

Various block drivers are currently devfs-unaware.  Andrey's patch attempts
to give them reasonable representations in devfs.

 "The attached patch suggests some possible names for non-floppy devices
  based on reading driver source.  I have to ask if these make sense.  At
  least for cciss Mandrake devfsd patch expects different names but it
  seems to be mistake (it assumes single controller always)

 "For floppy it is not as simple.  Floppy cannot use genhd and must
  create names manually; but I do not know what names are appropriate or
  expected.

 "For acsi the target/lun name may have problem of creating compat names
  (if any) by devfsd.

 "Please note that none of them created any devfs name under 2.4 as well.
   So it is not a regression ..."

drivers/block/acsi.c
drivers/block/cciss.c
drivers/block/ps2esdi.c
drivers/block/umem.c
drivers/block/xd.c
drivers/block/z2ram.c

index 4c4c3caff9c1cc967ddf03263a815bb6f680abea..a11792b4f280eb205a952d7ddc8e8aa9472ca171 100644 (file)
@@ -1729,10 +1729,14 @@ int acsi_init( void )
        for( i = 0; i < NDevices; ++i ) {
                struct gendisk *disk = acsi_gendisk[i];
                sprintf(disk->disk_name, "ad%c", 'a'+i);
+               aip = &acsi_info[NDevices];
+               sprintf(disk->devfs_name, "ad/target%d/lun%d", aip->target, aip->lun);
                disk->major = ACSI_MAJOR;
                disk->first_minor = i << 4;
-               if (acsi_info[i].type != HARDDISK)
+               if (acsi_info[i].type != HARDDISK) {
                        disk->minors = 1;
+                       strcat(disk->devfs_name, "/disc");
+               }
                disk->fops = &acsi_fops;
                disk->private_data = &acsi_info[i];
                set_capacity(disk, acsi_info[i].size);
index 06075c5b4394690917bf49e5bea661d4fbb2754e..1a3285bec60791b7c762441fb4c04524a4e0f540 100644 (file)
@@ -2531,6 +2531,7 @@ static int __init cciss_init_one(struct pci_dev *pdev,
                struct gendisk *disk = hba[i]->gendisk[j];
 
                sprintf(disk->disk_name, "cciss/c%dd%d", i, j);
+               sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j);
                disk->major = COMPAQ_CISS_MAJOR + i;
                disk->first_minor = j << NWD_SHIFT;
                disk->fops = &cciss_fops;
index 0fd192d2530c85c5d8859b208d9d73916556f2e2..90ae6c2eeb588f3816b1ab19bba9859fe7278bf4 100644 (file)
@@ -421,6 +421,7 @@ static int __init ps2esdi_geninit(void)
                disk->major = PS2ESDI_MAJOR;
                disk->first_minor = i<<6;
                sprintf(disk->disk_name, "ed%c", 'a'+i);
+               sprintf(disk->devfs_name, "ed/target%d", i);
                disk->fops = &ps2esdi_fops;
                ps2esdi_gendisk[i] = disk;
        }
index 362d0943de3a388d1976b1c3fa27830eca3036c1..31cd010f4d56aa5e84f37d365f27928f7b67b945 100644 (file)
@@ -52,7 +52,6 @@
 
 #include <linux/fcntl.h>        /* O_ACCMODE */
 #include <linux/hdreg.h>  /* HDIO_GETGEO */
-#include <linux/devfs_fs_kernel.h>
 
 #include <linux/umem.h>
 
@@ -1204,11 +1203,10 @@ int __init mm_init(void)
                        goto out;
        }
 
-       devfs_mk_dir("umem");
-
        for (i = 0; i < num_cards; i++) {
                struct gendisk *disk = mm_gendisk[i];
                sprintf(disk->disk_name, "umem%c", 'a'+i);
+               sprintf(disk->devfs_name, "umem/card%d", i);
                spin_lock_init(&cards[i].lock);
                disk->major = major_nr;
                disk->first_minor  = i << MM_SHIFT;
@@ -1245,7 +1243,6 @@ void __exit mm_cleanup(void)
                del_gendisk(mm_gendisk[i]);
                put_disk(mm_gendisk[i]);
        }
-       devfs_remove("umem");
 
        pci_unregister_driver(&mm_pci_driver);
 
index dc06ce7adfa6b37429e8441ad54055a06710ee9d..b4ae8414cd2ebcbbfea60dc5665336bfa155e6b1 100644 (file)
@@ -45,7 +45,6 @@
 #include <linux/ioport.h>
 #include <linux/init.h>
 #include <linux/wait.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/blkdev.h>
 #include <linux/blkpg.h>
 
@@ -182,7 +181,6 @@ static int __init xd_init(void)
        if (!xd_queue)
                goto out1a;
 
-       devfs_mk_dir("xd");
        if (xd_detect(&controller,&address)) {
 
                printk("Detected a%s controller (type %d) at address %06x\n",
@@ -213,6 +211,7 @@ static int __init xd_init(void)
                disk->major = XT_DISK_MAJOR;
                disk->first_minor = i<<6;
                sprintf(disk->disk_name, "xd%c", i+'a');
+               sprintf(disk->devfs_name, "xd/target%d", i);
                disk->fops = &xd_fops;
                disk->private_data = p;
                disk->queue = xd_queue;
@@ -249,7 +248,6 @@ out4:
 out3:
        release_region(xd_iobase,4);
 out2:
-       devfs_remove("xd");
        blk_cleanup_queue(xd_queue);
 out1a:
        unregister_blkdev(XT_DISK_MAJOR, "xd");
@@ -1064,7 +1062,6 @@ void cleanup_module(void)
        }
        blk_cleanup_queue(xd_queue);
        release_region(xd_iobase,4);
-       devfs_remove("xd");
        if (xd_drives) {
                free_irq(xd_irq, NULL);
                free_dma(xd_dma);
index c952ff90a23d8980528408c0aff163fbf89e5bab..958a5e1f70c75889fa80c1e3d4f86431c651270b 100644 (file)
@@ -354,6 +354,7 @@ z2_init(void)
     z2ram_gendisk->first_minor = 0;
     z2ram_gendisk->fops = &z2_fops;
     sprintf(z2ram_gendisk->disk_name, "z2ram");
+    strcpy(z2ram_gendisk->devfs_name, z2ram_gendisk->disk_name);
 
     z2ram_gendisk->queue = z2_queue;
     add_disk(z2ram_gendisk);