Lines 97-102
Link Here
|
97 |
#include <linux/slab.h> |
97 |
#include <linux/slab.h> |
98 |
#include <linux/cdrom.h> |
98 |
#include <linux/cdrom.h> |
99 |
#include <linux/ide.h> |
99 |
#include <linux/ide.h> |
|
|
100 |
#include <linux/devfs_fs_kernel.h> |
100 |
|
101 |
|
101 |
#include <asm/byteorder.h> |
102 |
#include <asm/byteorder.h> |
102 |
#include <asm/irq.h> |
103 |
#include <asm/irq.h> |
Lines 271-276
Link Here
|
271 |
*/ |
272 |
*/ |
272 |
typedef struct { |
273 |
typedef struct { |
273 |
ide_drive_t *drive; |
274 |
ide_drive_t *drive; |
|
|
275 |
devfs_handle_t de; /* devfs entry */ |
274 |
|
276 |
|
275 |
idefloppy_pc_t *pc; /* Current packet command */ |
277 |
idefloppy_pc_t *pc; /* Current packet command */ |
276 |
idefloppy_pc_t *failed_pc; /* Last failed packet command */ |
278 |
idefloppy_pc_t *failed_pc; /* Last failed packet command */ |
Lines 661-666
Link Here
|
661 |
#define IDEFLOPPY_MIN(a,b) ((a)<(b) ? (a):(b)) |
663 |
#define IDEFLOPPY_MIN(a,b) ((a)<(b) ? (a):(b)) |
662 |
#define IDEFLOPPY_MAX(a,b) ((a)>(b) ? (a):(b)) |
664 |
#define IDEFLOPPY_MAX(a,b) ((a)>(b) ? (a):(b)) |
663 |
|
665 |
|
|
|
666 |
extern devfs_handle_t ide_devfs_handle; /* Hook into ide devfs chain */ |
667 |
|
664 |
/* |
668 |
/* |
665 |
* Too bad. The drive wants to send us data which we are not ready to accept. |
669 |
* Too bad. The drive wants to send us data which we are not ready to accept. |
666 |
* Just throw it away. |
670 |
* Just throw it away. |
Lines 1457-1465
Link Here
|
1457 |
if (memcmp (descriptor, &floppy->capacity, sizeof (idefloppy_capacity_descriptor_t))) |
1461 |
if (memcmp (descriptor, &floppy->capacity, sizeof (idefloppy_capacity_descriptor_t))) |
1458 |
printk (KERN_INFO "%s: %dkB, %d blocks, %d sector size\n", drive->name, blocks * length / 1024, blocks, length); |
1462 |
printk (KERN_INFO "%s: %dkB, %d blocks, %d sector size\n", drive->name, blocks * length / 1024, blocks, length); |
1459 |
floppy->capacity = *descriptor; |
1463 |
floppy->capacity = *descriptor; |
1460 |
if (!length || length % 512) |
1464 |
if (!length || length % 512) { |
1461 |
printk (KERN_NOTICE "%s: %d bytes block size not supported\n", drive->name, length); |
1465 |
printk (KERN_NOTICE "%s: %d bytes block size not supported\n", drive->name, length); |
1462 |
else { |
1466 |
} else if (!i && descriptor->dc == CAPACITY_NO_CARTRIDGE && drive->removable && !(length % 512)) { |
|
|
1467 |
/* Set these two so that idefloppy_capacity returns a |
1468 |
positive value, needed for devfs registration. */ |
1469 |
floppy->blocks = blocks; |
1470 |
floppy->bs_factor = length / 512; |
1471 |
} else { |
1463 |
floppy->blocks = blocks; |
1472 |
floppy->blocks = blocks; |
1464 |
floppy->block_size = length; |
1473 |
floppy->block_size = length; |
1465 |
if ((floppy->bs_factor = length / 512) != 1) |
1474 |
if ((floppy->bs_factor = length / 512) != 1) |
Lines 2010-2015
Link Here
|
2010 |
struct idefloppy_id_gcw gcw; |
2019 |
struct idefloppy_id_gcw gcw; |
2011 |
int major = HWIF(drive)->major, i; |
2020 |
int major = HWIF(drive)->major, i; |
2012 |
int minor = drive->select.b.unit << PARTN_BITS; |
2021 |
int minor = drive->select.b.unit << PARTN_BITS; |
|
|
2022 |
char fname[64],iname[64]; /* for devfs */ |
2023 |
devfs_handle_t idefloppy_devfs_handle; /* for devfs */ |
2024 |
ide_hwif_t *hwif = HWIF(drive); |
2013 |
|
2025 |
|
2014 |
*((unsigned short *) &gcw) = drive->id->config; |
2026 |
*((unsigned short *) &gcw) = drive->id->config; |
2015 |
drive->driver_data = floppy; |
2027 |
drive->driver_data = floppy; |
Lines 2063-2068
Link Here
|
2063 |
hwif->gd->flags[i] |= GENHD_FL_REMOVABLE; |
2075 |
hwif->gd->flags[i] |= GENHD_FL_REMOVABLE; |
2064 |
break; |
2076 |
break; |
2065 |
} |
2077 |
} |
|
|
2078 |
|
2079 |
/* Always register drive with devfs */ |
2080 |
floppy->de = devfs_register (drive->de, "disc", DEVFS_FL_REMOVABLE, |
2081 |
major, minor, |
2082 |
S_IFBLK | S_IRUGO | S_IWUGO, |
2083 |
ide_fops, NULL); |
2084 |
/* Create ide/fd entry in devfs */ |
2085 |
idefloppy_devfs_handle = devfs_mk_dir(ide_devfs_handle,"fd",NULL); |
2086 |
|
2087 |
sprintf (fname, "c%db%dt%du%d", |
2088 |
(hwif->channel && hwif->mate) ? hwif->mate->index : hwif->index, hwif->channel, i, hwif->drives[i].lun); |
2089 |
sprintf (iname, "../host%d/bus%d/target%d/lun%d/disc", |
2090 |
(hwif->channel && hwif->mate) ? hwif->mate->index : hwif->index, |
2091 |
hwif->channel, i, hwif->drives[i].lun); |
2092 |
devfs_mk_symlink(idefloppy_devfs_handle, fname, DEVFS_FL_REMOVABLE, iname, NULL, NULL); |
2066 |
} |
2093 |
} |
2067 |
|
2094 |
|
2068 |
static int idefloppy_cleanup (ide_drive_t *drive) |
2095 |
static int idefloppy_cleanup (ide_drive_t *drive) |
Lines 2071-2076
Link Here
|
2071 |
|
2098 |
|
2072 |
if (ide_unregister_subdriver (drive)) |
2099 |
if (ide_unregister_subdriver (drive)) |
2073 |
return 1; |
2100 |
return 1; |
|
|
2101 |
devfs_unregister(floppy->de); |
2102 |
|
2074 |
drive->driver_data = NULL; |
2103 |
drive->driver_data = NULL; |
2075 |
kfree (floppy); |
2104 |
kfree (floppy); |
2076 |
return 0; |
2105 |
return 0; |