Summary: | Patch for ide-floppy for devfs support | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Chris Gianelloni (RETIRED) <wolf31o2> |
Component: | Unclassified | Assignee: | x86-kernel (DEPRECATED) <x86-kernel> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
Patch for devfs and ide-floppy
Corrected patch New patch version |
Description
Chris Gianelloni (RETIRED)
2003-03-29 16:15:41 UTC
Created attachment 9995 [details, diff]
Patch for devfs and ide-floppy
Comment on attachment 9995 [details, diff] Patch for devfs and ide-floppy >diff -urN linux-2.4.20-gentoo-r2/drivers/ide/ide-floppy.c linux-2.4.20-gentoo-r2-fixed/drivers/ide/ide-floppy.c >--- linux-2.4.20-gentoo-r2/drivers/ide/ide-floppy.c 2003-03-29 15:26:31.000000000 -0500 >+++ linux-2.4.20-gentoo-r2-fixed/drivers/ide/ide-floppy.c 2003-03-29 15:19:33.000000000 -0500 >@@ -97,6 +97,7 @@ > #include <linux/slab.h> > #include <linux/cdrom.h> > #include <linux/ide.h> >+#include <linux/devfs_fs_kernel.h> > > #include <asm/byteorder.h> > #include <asm/irq.h> >@@ -271,6 +272,7 @@ > */ > typedef struct { > ide_drive_t *drive; >+ devfs_handle_t de; /* devfs entry */ > > idefloppy_pc_t *pc; /* Current packet command */ > idefloppy_pc_t *failed_pc; /* Last failed packet command */ >@@ -661,6 +663,8 @@ > #define IDEFLOPPY_MIN(a,b) ((a)<(b) ? (a):(b)) > #define IDEFLOPPY_MAX(a,b) ((a)>(b) ? (a):(b)) > >+extern devfs_handle_t ide_devfs_handle; /* Hook into ide devfs chain */ >+ > /* > * Too bad. The drive wants to send us data which we are not ready to accept. > * Just throw it away. >@@ -1457,9 +1461,14 @@ > if (memcmp (descriptor, &floppy->capacity, sizeof (idefloppy_capacity_descriptor_t))) > printk (KERN_INFO "%s: %dkB, %d blocks, %d sector size\n", drive->name, blocks * length / 1024, blocks, length); > floppy->capacity = *descriptor; >- if (!length || length % 512) >+ if (!length || length % 512) { > printk (KERN_NOTICE "%s: %d bytes block size not supported\n", drive->name, length); >- else { >+ } 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; >+ } else { > floppy->blocks = blocks; > floppy->block_size = length; > if ((floppy->bs_factor = length / 512) != 1) >@@ -2010,6 +2019,9 @@ > struct idefloppy_id_gcw gcw; > int major = HWIF(drive)->major, i; > int minor = drive->select.b.unit << PARTN_BITS; >+ char fname[64],iname[64]; /* for devfs */ >+ devfs_handle_t idefloppy_devfs_handle; /* for devfs */ >+ ide_hwif_t *hwif = HWIF(drive); > > *((unsigned short *) &gcw) = drive->id->config; > drive->driver_data = floppy; >@@ -2063,6 +2075,21 @@ > hwif->gd->flags[i] |= GENHD_FL_REMOVABLE; > break; > } >+ >+/* Always register drive with devfs */ >+ floppy->de = devfs_register (drive->de, "disc", DEVFS_FL_REMOVABLE, >+ major, minor, >+ S_IFBLK | S_IRUGO | S_IWUGO, >+ ide_fops, NULL); >+ /* Create ide/fd entry in devfs */ >+idefloppy_devfs_handle = devfs_mk_dir(ide_devfs_handle,"fd",NULL); >+ >+ sprintf (fname, "c%db%dt%du%d", >+ (hwif->channel && hwif->mate) ? hwif->mate->index : hwif->index, hwif->channel, i, hwif->drives[i].lun); >+ sprintf (iname, "../host%d/bus%d/target%d/lun%d/disc", >+ (hwif->channel && hwif->mate) ? hwif->mate->index : hwif->index, >+ hwif->channel, i, hwif->drives[i].lun); >+devfs_mk_symlink(idefloppy_devfs_handle, fname, DEVFS_FL_REMOVABLE, iname, NULL, NULL); > } > > static int idefloppy_cleanup (ide_drive_t *drive) >@@ -2071,6 +2098,8 @@ > > if (ide_unregister_subdriver (drive)) > return 1; >+ devfs_unregister(floppy->de); >+ > drive->driver_data = NULL; > kfree (floppy); > return 0; >diff -urN linux-2.4.20-gentoo-r2/drivers/ide/ide-probe.c linux-2.4.20-gentoo-r2-fixed/drivers/ide/ide-probe.c >--- linux-2.4.20-gentoo-r2/drivers/ide/ide-probe.c 2003-03-29 15:26:31.000000000 -0500 >+++ linux-2.4.20-gentoo-r2-fixed/drivers/ide/ide-probe.c 2003-03-29 15:21:32.000000000 -0500 >@@ -124,6 +124,7 @@ > if (!strstr(id->model, "oppy") && !strstr(id->model, "poyp") && !strstr(id->model, "ZIP")) > printk("cdrom or floppy?, assuming "); > if (drive->media != ide_cdrom) { >+ drive->removable = 1; > printk ("FLOPPY"); > break; > } Comment on attachment 9995 [details, diff]
Patch for devfs and ide-floppy
Remove this patch
Created attachment 9996 [details, diff]
Corrected patch
Using this patch, I do get errors in mlogs that say: devfs_register(disc): could not append to parent, err: -17 /dev/ide/host0/bus0/target0/lun0: p1 p2 p3 p4 i'll look @ here in the coming week. Thanks, Jay i won't add this patch @ this time. sorry, Jay Created attachment 11985 [details, diff]
New patch version
Without this patch, LS-120, Click! and Zip drives are useless in Gentoo using
the ide-floppy driver.
|