Skip to contentSkip to conversation

2.6.0-test1: device files wrong in devfs

DAC960 Andrey Borzenkov 1 participant 1 message Aug 30, 2003 1 message not in the archive Block layer

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 17 lines · Andrew Morton

just going through my inbox...

Begin forwarded message:

Date: Mon, 28 Jul 2003 22:14:45 -0700
From: Dave Olien <[email protected]>
To: Andrew Morton <[email protected]>
Cc: [email protected], Christoph Hellwig <[email protected]>
Subject: Re: Fw: [DAC960] 2.6.0-test1: device files wrong in devfs

I just looked a little more closely at more of the drivers. The following are OK. They call devfs_mk_dir() and devfs_mk_bdev() directly to make entries in devfs.

Quoted 9 lines

floppy98.c, floppy.c, umem.c, xd.c

This leaves these that don't seem to make devfs entries:

cciss.c and amiflop.c, ataflop.c, z2ram.c, acsi.c, ps2esdi.c

A quick fix might be to just add initialization of devfs_name following the init of disk_name, as I did in the DAC960.c

this is not quick fix, this is the only right fix. The only problem is what to set devfs_name to :)

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 ...

-andrey

Quoted 13 lines · Dave Olien
Quoted 12 lines

At quick glance, other drivers that look suspicious under drivers/block:

	acsi.c --- driver for Atari hard disks
	ataflop.c
	amiflop.c
	floppy98.c
	floppy.c
	ps2esdi.c
	z2ram.c
	umem.c
	xd.c
Quoted 8 lines
Quoted 8 lines

A lot of these may be obsolete drivers, although they have been updated to use the new gendisk structures.

Quoted 4 lines · Andrew Morton

I assume that IDE gets it right. And scsi appears to do it centrally.

cciss.c appears to not be setting devfs_name. Christoph, could you please suggest a fix?

src/linux-2.6.0-test4-smp/drivers/block/acsi.c renamed from drivers/block/acsi.c +5 -1
@@ -1729,10 +1729,14 @@
 	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);
src/linux-2.6.0-test4-smp/drivers/block/cciss.c renamed from drivers/block/cciss.c +1 -0
@@ -2562,6 +2562,7 @@
 		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;
src/linux-2.6.0-test4-smp/drivers/block/ps2esdi.c renamed from drivers/block/ps2esdi.c +1 -0
@@ -421,6 +421,7 @@
 		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;
 	}
src/linux-2.6.0-test4-smp/drivers/block/umem.c renamed from drivers/block/umem.c +1 -4
@@ -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 @@
 			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 @@
 		del_gendisk(mm_gendisk[i]);
 		put_disk(mm_gendisk[i]);
 	}
-	devfs_remove("umem");
 
 	pci_unregister_driver(&mm_pci_driver);
 
src/linux-2.6.0-test4-smp/drivers/block/xd.c renamed from drivers/block/xd.c +1 -4
@@ -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 @@
 	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 @@
 		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 @@
 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 @@
 	}
 	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);
src/linux-2.6.0-test4-smp/drivers/block/z2ram.c renamed from drivers/block/z2ram.c +1 -0
@@ -354,6 +354,7 @@
     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);