patch-2.4.0-test2 linux/drivers/ide/ide-cd.c
Next file: linux/drivers/ide/ide-disk.c
Previous file: linux/drivers/ide/icside.c
Back to the patch index
Back to the overall index
- Lines: 90
- Date:
Wed Jun 21 22:31:01 2000
- Orig file:
v2.4.0-test1/linux/drivers/ide/ide-cd.c
- Orig date:
Thu May 11 15:30:07 2000
diff -u --recursive --new-file v2.4.0-test1/linux/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -426,11 +426,13 @@
while (hi > lo) {
mid = (lo + hi) / 2;
- if (packet_command_texts[mid].packet_command == failed_command->c[0]) {
+ if (packet_command_texts[mid].packet_command ==
+ failed_command->c[0]) {
s = packet_command_texts[mid].text;
break;
}
- else if (packet_command_texts[mid].packet_command > failed_command->c[0])
+ if (packet_command_texts[mid].packet_command >
+ failed_command->c[0])
hi = mid;
else
lo = mid+1;
@@ -1524,7 +1526,7 @@
memset(&pc, 0, sizeof(pc));
pc.sense = sense;
pc.c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL;
- pc.c[4] = lockflag ? 3 : 0;
+ pc.c[4] = lockflag ? 1 : 0;
stat = cdrom_queue_packet_command (drive, &pc);
}
@@ -1624,7 +1626,8 @@
/* Try to read the entire TOC for the disk into our internal buffer. */
static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
{
- int stat, ntracks, i;
+ int minor, stat, ntracks, i;
+ kdev_t dev;
struct cdrom_info *info = drive->driver_data;
struct atapi_toc *toc = info->toc;
struct {
@@ -1663,8 +1666,10 @@
#endif /* not STANDARD_ATAPI */
ntracks = toc->hdr.last_track - toc->hdr.first_track + 1;
- if (ntracks <= 0) return -EIO;
- if (ntracks > MAX_TRACKS) ntracks = MAX_TRACKS;
+ if (ntracks <= 0)
+ return -EIO;
+ if (ntracks > MAX_TRACKS)
+ ntracks = MAX_TRACKS;
/* Now read the whole schmeer. */
stat = cdrom_read_tocentry(drive, toc->hdr.first_track, 1, 0,
@@ -1755,13 +1760,13 @@
toc->xa_flag = (ms_tmp.hdr.first_track != ms_tmp.hdr.last_track);
/* Now try to get the total cdrom capacity. */
-#if 0
- stat = cdrom_get_last_written(MKDEV(HWIF(drive)->major, minor),
- (long *)&toc->capacity);
+ minor = (drive->select.b.unit) << PARTN_BITS;
+ dev = MKDEV(HWIF(drive)->major, minor);
+ stat = cdrom_get_last_written(dev, (long *)&toc->capacity);
if (stat)
-#endif
- stat = cdrom_read_capacity(drive, &toc->capacity, sense);
- if (stat) toc->capacity = 0x1fffff;
+ stat = cdrom_read_capacity(drive, &toc->capacity, sense);
+ if (stat)
+ toc->capacity = 0x1fffff;
/* Remember that we've read this stuff. */
CDROM_STATE_FLAGS (drive)->toc_valid = 1;
@@ -2194,9 +2199,9 @@
if (!CDROM_CONFIG_FLAGS (drive)->close_tray)
devinfo->mask |= CDC_CLOSE_TRAY;
- devinfo->de = devfs_register(drive->de, "cd", 2, DEVFS_FL_DEFAULT,
+ devinfo->de = devfs_register(drive->de, "cd", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor,
- S_IFBLK | S_IRUGO | S_IWUGO, 0, 0,
+ S_IFBLK | S_IRUGO | S_IWUGO,
ide_fops, NULL);
return register_cdrom(devinfo);
@@ -2552,7 +2557,8 @@
{
unsigned capacity;
- return cdrom_read_capacity(drive, &capacity, NULL) ? 0 : capacity * SECTORS_PER_FRAME;
+ return cdrom_read_capacity(drive, &capacity, NULL)
+ ? 0 : capacity * SECTORS_PER_FRAME;
}
static
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)