----- Original Message -----
From: "Martin Wilck" <Martin.Wilck@fujitsu-siemens.com>
To: "Richard Gooch" <rgooch@ras.ucalgary.ca>
Cc: "Martin Wilck" <Martin.Wilck@fujitsu-siemens.com>; "devfs mailing list"
<devfs@oss.sgi.com>; "Linux Kernel mailing list"
<linux-kernel@vger.kernel.org>
Sent: Friday, July 27, 2001 12:34 PM
Subject: [PATCH]: ide-floppy & devfs
>
> Hi,
>
> The following patch causes ide-floppy to register a disc
> even if no cartridge is in the drive, so that devfs creates
> nodes for the drive for later use. Without this patch,
> if devfs is used, no device node is ever created, and
> ide-floppy must be rmmoded and reloaded if a floppy is inserted
> into a drive that was empty at boot time.
>
> The reason is that grok_partitions() returns immediately if the
> device passed has a size parameter of 0, which was the case
> in ide-floppy with no cartrifge in the drive.
>
> The patch is against 2.4.7.
>
> It is somewhat a hack, perhaps somebody else finds a more elegant
> way to do it. But it makes sense that an empty drive
> does not return a capacity of 0, but the capacity of a standard media
> cartridge.
>
> Martin
>
> --
> Martin Wilck <Martin.Wilck@fujitsu-siemens.com>
> FSC EP PS DS1, Paderborn Tel. +49 5251 8 15113
>
> --- 2.4.7a/drivers/ide/ide-probe.c Sun Mar 18 18:25:02 2001
> +++ 2.4.7/drivers/ide/ide-probe.c Fri Jul 27 23:01:49 2001
> @@ -122,6 +122,7 @@
> printk("cdrom or floppy?, assuming ");
> if (drive->media != ide_cdrom) {
> printk ("FLOPPY");
> + drive->removable = 1;
> break;
> }
> }
> --- 2.4.7a/drivers/ide/ide-floppy.c Wed Jul 25 20:20:44 2001
> +++ 2.4.7/drivers/ide/ide-floppy.c Fri Jul 27 23:00:38 2001
> @@ -1279,7 +1279,15 @@
> printk (KERN_NOTICE "%s: warning: non 512 bytes block size not fully
supported\n", drive->name);
> rc = 0;
> }
> - }
> + } else if (!i && descriptor->dc == CAPACITY_NO_CARTRIDGE
> + && drive->removable && !(length % 512)) {
> + /*
> + Set these two so that idefloppy_capacity returns a positive value,
> + needed for devfs registration.
> + */
> + floppy->blocks = blocks;
> + floppy->bs_factor = length / 512;
> + };
> #if IDEFLOPPY_DEBUG_INFO
> if (!i) printk (KERN_INFO "Descriptor 0 Code: %d\n", descriptor->dc);
> printk (KERN_INFO "Descriptor %d: %dkB, %d blocks, %d sector size\n", i,
blocks * length / 1024, blocks, length);
>
>
>
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/