linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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>
Subject: [PATCH]: ide-floppy & devfs
Date: Fri, 27 Jul 2001 21:34:33 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.30.0107272127060.16993-100000@biker.pdb.fsc.net> (raw)
In-Reply-To: <200107271541.f6RFfFe12463@mobilix.ras.ucalgary.ca>


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);


       reply	other threads:[~2001-07-27 19:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200107271541.f6RFfFe12463@mobilix.ras.ucalgary.ca>
2001-07-27 19:34 ` Martin Wilck [this message]
2001-07-27 23:40   ` [PATCH]: ide-floppy & devfs Kevin P. Fleming
2001-07-28 12:15   ` Richard Gooch
2001-07-28 16:23     ` Kevin P. Fleming
2001-08-07 20:25       ` Paul Bristow
2001-08-07 18:28         ` Kevin P. Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.30.0107272127060.16993-100000@biker.pdb.fsc.net \
    --to=martin.wilck@fujitsu-siemens.com \
    --cc=devfs@oss.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rgooch@ras.ucalgary.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).