--- zzzz-none-000/linux-2.6.13.1/drivers/cdrom/cdrom.c 2005-09-10 02:42:58.000000000 +0000 +++ ohio-7170-487/linux-2.6.13.1/drivers/cdrom/cdrom.c 2007-08-17 12:10:39.000000000 +0000 @@ -1,4 +1,4 @@ -/* linux/drivers/cdrom/cdrom.c. +/* linux/drivers/cdrom/cdrom.c. Copyright (c) 1996, 1997 David A. van Leeuwen. Copyright (c) 1997, 1998 Erik Andersen Copyright (c) 1998, 1999 Jens Axboe @@ -63,8 +63,8 @@ 2.12 Jan 24, 1998 -- Erik Andersen -- Fixed a bug in the IOCTL_IN and IOCTL_OUT macros. It turns out that - copy_*_user does not return EFAULT on error, but instead returns the number - of bytes not copied. I was returning whatever non-zero stuff came back from + copy_*_user does not return EFAULT on error, but instead returns the number + of bytes not copied. I was returning whatever non-zero stuff came back from the copy_*_user functions directly, which would result in strange errors. 2.13 July 17, 1998 -- Erik Andersen @@ -78,7 +78,7 @@ 2.14 August 17, 1998 -- Erik Andersen -- Fixed a bug in cdrom_media_changed and handling of reporting that - the media had changed for devices that _don't_ implement media_changed. + the media had changed for devices that _don't_ implement media_changed. Thanks to Grant R. Guenther for spotting this bug. -- Made a few things more pedanticly correct. @@ -86,12 +86,12 @@ -- New maintainers! Erik was too busy to continue the work on the driver, so now Chris Zwilling and Jens Axboe will do their best to follow in his footsteps - + 2.51 Dec 20, 1998 - Jens Axboe -- Check if drive is capable of doing what we ask before blindly changing cdi->options in various ioctl. -- Added version to proc entry. - + 2.52 Jan 16, 1999 - Jens Axboe -- Fixed an error in open_for_data where we would sometimes not return the correct error value. Thanks Huba Gaspar . @@ -100,7 +100,7 @@ modules had entries in dev. Feb 02 - real bug was in sysctl.c where dev would be removed even though it was used. cdrom.c just illuminated that bug. - + 2.53 Feb 22, 1999 - Jens Axboe -- Fixup of several ioctl calls, in particular CDROM_SET_OPTIONS has been "rewritten" because capabilities and options aren't in sync. They @@ -110,16 +110,16 @@ -- Added CDROM_DEBUG ioctl. Enable debug messages on-the-fly. -- Added CDROM_GET_CAPABILITY ioctl. This relieves userspace programs from parsing /proc/sys/dev/cdrom/info. - + 2.54 Mar 15, 1999 - Jens Axboe -- Check capability mask from low level driver when counting tracks as per suggestion from Corey J. Scotts . - + 2.55 Apr 25, 1999 - Jens Axboe -- autoclose was mistakenly checked against CDC_OPEN_TRAY instead of CDC_CLOSE_TRAY. -- proc info didn't mask against capabilities mask. - + 3.00 Aug 5, 1999 - Jens Axboe -- Unified audio ioctl handling across CD-ROM drivers. A lot of the code was duplicated before. Drives that support the generic packet @@ -137,13 +137,13 @@ -- Now default to checking media type. -- CDROM_SEND_PACKET ioctl added. The infrastructure was in place for doing this anyway, with the generic_packet addition. - + 3.01 Aug 6, 1999 - Jens Axboe -- Fix up the sysctl handling so that the option flags get set correctly. -- Fix up ioctl handling so the device specific ones actually get called :). - + 3.02 Aug 8, 1999 - Jens Axboe -- Fixed volume control on SCSI drives (or others with longer audio page). @@ -152,7 +152,7 @@ DVD structures and ioctls in the first place! He designed the original DVD patches for ide-cd and while I rearranged and unified them, the interface is still the same. - + 3.03 Sep 1, 1999 - Jens Axboe -- Moved the rest of the audio ioctls from the CD-ROM drivers here. Only CDROMREADTOCENTRY and CDROMREADTOCHDR are left. @@ -177,7 +177,7 @@ for ide-cd to handle multisession discs. -- Export cdrom_mode_sense and cdrom_mode_select. -- init_cdrom_command() for setting up a cgc command. - + 3.05 Oct 24, 1999 - Jens Axboe -- Changed the interface for CDROM_SEND_PACKET. Before it was virtually impossible to send the drive data in a sensible way. @@ -210,7 +210,7 @@ DVD_HOST_SEND_RPC_STATE did not set buffer size in cdb, and dvd_do_auth passed uninitialized data to drive because init_cdrom_command did not clear a 0 sized buffer. - + 3.09 May 12, 2000 - Jens Axboe -- Fix Video-CD on SCSI drives that don't support READ_CD command. In that case switch block size and issue plain READ_10 again, then switch @@ -272,7 +272,7 @@ #include #include #include -#include +#include #include #include #include @@ -319,7 +319,7 @@ if ((ERRLOGMASK & type) || debug==1 ) \ printk(KERN_INFO "cdrom: " fmt, ## args) #else -#define cdinfo(type, fmt, args...) +#define cdinfo(type, fmt, args...) #endif /* These are used to simplify getting data in from and back to user land */ @@ -342,7 +342,7 @@ static int open_for_data(struct cdrom_device_info * cdi); static int check_for_audio_disc(struct cdrom_device_info * cdi, struct cdrom_device_ops * cdo); -static void sanitize_format(union cdrom_addr *addr, +static void sanitize_format(union cdrom_addr *addr, u_char * curr, u_char requested); static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, unsigned long arg); @@ -357,7 +357,7 @@ #ifdef CONFIG_SYSCTL static void cdrom_sysctl_register(void); -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_SYSCTL */ static struct cdrom_device_info *topCdromPtr; static int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi, @@ -386,7 +386,7 @@ struct cdrom_device_ops *cdo = cdi->ops; int *change_capability = (int *)&cdo->capability; /* hack */ - cdinfo(CD_OPEN, "entering register_cdrom\n"); + cdinfo(CD_OPEN, "entering register_cdrom\n"); if (cdo->open == NULL || cdo->release == NULL) return -2; @@ -395,7 +395,7 @@ banner_printed = 1; #ifdef CONFIG_SYSCTL cdrom_sysctl_register(); -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_SYSCTL */ } ENSURE(drive_status, CDC_DRIVE_STATUS ); @@ -412,7 +412,7 @@ cdi->mc_flags = 0; cdo->n_minors = 0; cdi->options = CDO_USE_FFLAGS; - + if (autoclose==1 && CDROM_CAN(CDC_CLOSE_TRAY)) cdi->options |= (int) CDO_AUTO_CLOSE; if (autoeject==1 && CDROM_CAN(CDC_OPEN_TRAY)) @@ -435,7 +435,7 @@ cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name); spin_lock(&cdrom_lock); - cdi->next = topCdromPtr; + cdi->next = topCdromPtr; topCdromPtr = cdi; spin_unlock(&cdrom_lock); return 0; @@ -445,7 +445,7 @@ int unregister_cdrom(struct cdrom_device_info *unreg) { struct cdrom_device_info *cdi, *prev; - cdinfo(CD_OPEN, "entering unregister_cdrom\n"); + cdinfo(CD_OPEN, "entering unregister_cdrom\n"); prev = NULL; spin_lock(&cdrom_lock); @@ -905,7 +905,7 @@ ram_write = 1; else (void) cdrom_is_random_writable(cdi, &ram_write); - + if (mrw) cdi->mask &= ~CDC_MRW; else @@ -995,7 +995,7 @@ { int ret; - cdinfo(CD_OPEN, "entering cdrom_open\n"); + cdinfo(CD_OPEN, "entering cdrom_open\n"); /* if this was a O_NONBLOCK open and we should honor the flags, * do a quick open without drive/disc integrity checks. */ @@ -1043,38 +1043,38 @@ can do clever things. If it can't, well, we at least tried! */ if (cdo->drive_status != NULL) { ret = cdo->drive_status(cdi, CDSL_CURRENT); - cdinfo(CD_OPEN, "drive_status=%d\n", ret); + cdinfo(CD_OPEN, "drive_status=%d\n", ret); if (ret == CDS_TRAY_OPEN) { - cdinfo(CD_OPEN, "the tray is open...\n"); + cdinfo(CD_OPEN, "the tray is open...\n"); /* can/may i close it? */ if (CDROM_CAN(CDC_CLOSE_TRAY) && cdi->options & CDO_AUTO_CLOSE) { - cdinfo(CD_OPEN, "trying to close the tray.\n"); + cdinfo(CD_OPEN, "trying to close the tray.\n"); ret=cdo->tray_move(cdi,0); if (ret) { - cdinfo(CD_OPEN, "bummer. tried to close the tray but failed.\n"); + cdinfo(CD_OPEN, "bummer. tried to close the tray but failed.\n"); /* Ignore the error from the low level driver. We don't care why it - couldn't close the tray. We only care - that there is no disc in the drive, + couldn't close the tray. We only care + that there is no disc in the drive, since that is the _REAL_ problem here.*/ ret=-ENOMEDIUM; goto clean_up_and_return; } } else { - cdinfo(CD_OPEN, "bummer. this drive can't close the tray.\n"); + cdinfo(CD_OPEN, "bummer. this drive can't close the tray.\n"); ret=-ENOMEDIUM; goto clean_up_and_return; } /* Ok, the door should be closed now.. Check again */ ret = cdo->drive_status(cdi, CDSL_CURRENT); if ((ret == CDS_NO_DISC) || (ret==CDS_TRAY_OPEN)) { - cdinfo(CD_OPEN, "bummer. the tray is still not closed.\n"); + cdinfo(CD_OPEN, "bummer. the tray is still not closed.\n"); cdinfo(CD_OPEN, "tray might not contain a medium.\n"); ret=-ENOMEDIUM; goto clean_up_and_return; } - cdinfo(CD_OPEN, "the tray is now closed.\n"); + cdinfo(CD_OPEN, "the tray is now closed.\n"); } /* the door should be closed now, check for the disc */ ret = cdo->drive_status(cdi, CDSL_CURRENT); @@ -1095,9 +1095,9 @@ if (cdi->options & CDO_CHECK_TYPE) { /* give people a warning shot, now that CDO_CHECK_TYPE is the default case! */ - cdinfo(CD_OPEN, "bummer. wrong media type.\n"); + cdinfo(CD_OPEN, "bummer. wrong media type.\n"); cdinfo(CD_WARNING, "pid %d must open device O_NONBLOCK!\n", - (unsigned int)current->pid); + (unsigned int)current->pid); ret=-EMEDIUMTYPE; goto clean_up_and_return; } @@ -1106,32 +1106,32 @@ } } - cdinfo(CD_OPEN, "all seems well, opening the device.\n"); + cdinfo(CD_OPEN, "all seems well, opening the device.\n"); /* all seems well, we can open the device */ ret = cdo->open(cdi, 0); /* open for data */ - cdinfo(CD_OPEN, "opening the device gave me %d.\n", ret); + cdinfo(CD_OPEN, "opening the device gave me %d.\n", ret); /* After all this careful checking, we shouldn't have problems - opening the device, but we don't want the device locked if + opening the device, but we don't want the device locked if this somehow fails... */ if (ret) { - cdinfo(CD_OPEN, "open device failed.\n"); + cdinfo(CD_OPEN, "open device failed.\n"); goto clean_up_and_return; } if (CDROM_CAN(CDC_LOCK) && (cdi->options & CDO_LOCK)) { cdo->lock_door(cdi, 1); cdinfo(CD_OPEN, "door locked.\n"); } - cdinfo(CD_OPEN, "device opened successfully.\n"); + cdinfo(CD_OPEN, "device opened successfully.\n"); return ret; /* Something failed. Try to unlock the drive, because some drivers (notably ide-cd) lock the drive after every command. This produced - a nasty bug where after mount failed, the drive would remain locked! - This ensures that the drive gets unlocked after a mount fails. This - is a goto to avoid bloating the driver with redundant code. */ + a nasty bug where after mount failed, the drive would remain locked! + This ensures that the drive gets unlocked after a mount fails. This + is a goto to avoid bloating the driver with redundant code. */ clean_up_and_return: - cdinfo(CD_WARNING, "open failed.\n"); + cdinfo(CD_WARNING, "open failed.\n"); if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) { cdo->lock_door(cdi, 0); cdinfo(CD_OPEN, "door unlocked.\n"); @@ -1152,42 +1152,42 @@ return 0; if (cdo->drive_status != NULL) { ret = cdo->drive_status(cdi, CDSL_CURRENT); - cdinfo(CD_OPEN, "drive_status=%d\n", ret); + cdinfo(CD_OPEN, "drive_status=%d\n", ret); if (ret == CDS_TRAY_OPEN) { - cdinfo(CD_OPEN, "the tray is open...\n"); + cdinfo(CD_OPEN, "the tray is open...\n"); /* can/may i close it? */ if (CDROM_CAN(CDC_CLOSE_TRAY) && cdi->options & CDO_AUTO_CLOSE) { - cdinfo(CD_OPEN, "trying to close the tray.\n"); + cdinfo(CD_OPEN, "trying to close the tray.\n"); ret=cdo->tray_move(cdi,0); if (ret) { - cdinfo(CD_OPEN, "bummer. tried to close tray but failed.\n"); + cdinfo(CD_OPEN, "bummer. tried to close tray but failed.\n"); /* Ignore the error from the low level driver. We don't care why it - couldn't close the tray. We only care - that there is no disc in the drive, + couldn't close the tray. We only care + that there is no disc in the drive, since that is the _REAL_ problem here.*/ return -ENOMEDIUM; } } else { - cdinfo(CD_OPEN, "bummer. this driver can't close the tray.\n"); + cdinfo(CD_OPEN, "bummer. this driver can't close the tray.\n"); return -ENOMEDIUM; } /* Ok, the door should be closed now.. Check again */ ret = cdo->drive_status(cdi, CDSL_CURRENT); if ((ret == CDS_NO_DISC) || (ret==CDS_TRAY_OPEN)) { - cdinfo(CD_OPEN, "bummer. the tray is still not closed.\n"); + cdinfo(CD_OPEN, "bummer. the tray is still not closed.\n"); return -ENOMEDIUM; - } + } if (ret!=CDS_DISC_OK) { - cdinfo(CD_OPEN, "bummer. disc isn't ready.\n"); + cdinfo(CD_OPEN, "bummer. disc isn't ready.\n"); return -EIO; - } - cdinfo(CD_OPEN, "the tray is now closed.\n"); - } + } + cdinfo(CD_OPEN, "the tray is now closed.\n"); + } } cdrom_count_tracks(cdi, &tracks); - if (tracks.error) + if (tracks.error) return(tracks.error); if (tracks.audio==0) @@ -1202,7 +1202,7 @@ struct cdrom_device_ops *cdo = cdi->ops; int opened_for_data; - cdinfo(CD_CLOSE, "entering cdrom_release\n"); + cdinfo(CD_CLOSE, "entering cdrom_release\n"); if (cdi->use_count > 0) cdi->use_count--; @@ -1233,7 +1233,7 @@ return 0; } -static int cdrom_read_mech_status(struct cdrom_device_info *cdi, +static int cdrom_read_mech_status(struct cdrom_device_info *cdi, struct cdrom_changer_info *buf) { struct packet_command cgc; @@ -1270,10 +1270,10 @@ struct cdrom_changer_info *info; int ret; - cdinfo(CD_CHANGER, "entering cdrom_slot_status()\n"); + cdinfo(CD_CHANGER, "entering cdrom_slot_status()\n"); if (cdi->sanyo_slot) return CDS_NO_INFO; - + info = kmalloc(sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; @@ -1291,18 +1291,18 @@ return ret; } -/* Return the number of slots for an ATAPI/SCSI cdrom, - * return 1 if not a changer. +/* Return the number of slots for an ATAPI/SCSI cdrom, + * return 1 if not a changer. */ -int cdrom_number_of_slots(struct cdrom_device_info *cdi) +int cdrom_number_of_slots(struct cdrom_device_info *cdi) { int status; int nslots = 1; struct cdrom_changer_info *info; - cdinfo(CD_CHANGER, "entering cdrom_number_of_slots()\n"); + cdinfo(CD_CHANGER, "entering cdrom_number_of_slots()\n"); /* cdrom_read_mech_status requires a valid value for capacity: */ - cdi->capacity = 0; + cdi->capacity = 0; info = kmalloc(sizeof(*info), GFP_KERNEL); if (!info) @@ -1317,11 +1317,11 @@ /* If SLOT < 0, unload the current slot. Otherwise, try to load SLOT. */ -static int cdrom_load_unload(struct cdrom_device_info *cdi, int slot) +static int cdrom_load_unload(struct cdrom_device_info *cdi, int slot) { struct packet_command cgc; - cdinfo(CD_CHANGER, "entering cdrom_load_unload()\n"); + cdinfo(CD_CHANGER, "entering cdrom_load_unload()\n"); if (cdi->sanyo_slot && slot < 0) return 0; @@ -1331,7 +1331,7 @@ cgc.cmd[8] = slot; cgc.timeout = 60 * HZ; - /* The Sanyo 3 CD changer uses byte 7 of the + /* The Sanyo 3 CD changer uses byte 7 of the GPCMD_TEST_UNIT_READY to command to switch CDs instead of using the GPCMD_LOAD_UNLOAD opcode. */ if (cdi->sanyo_slot && -1 < slot) { @@ -1350,7 +1350,7 @@ int curslot; int ret; - cdinfo(CD_CHANGER, "entering cdrom_select_disc()\n"); + cdinfo(CD_CHANGER, "entering cdrom_select_disc()\n"); if (!CDROM_CAN(CDC_SELECT_DISC)) return -EDRIVE_CANT_DO_THIS; @@ -1384,7 +1384,7 @@ /* Specifying CDSL_CURRENT will attempt to load the currnet slot, which is useful if it had been previously unloaded. - Whether it can or not, it returns the current slot. + Whether it can or not, it returns the current slot. Similarly, if slot happens to be the current one, we still try and load it. */ if (slot == CDSL_CURRENT) @@ -1424,9 +1424,9 @@ int cdrom_media_changed(struct cdrom_device_info *cdi) { - /* This talks to the VFS, which doesn't like errors - just 1 or 0. - * Returning "0" is always safe (media hasn't been changed). Do that - * if the low-level cdrom driver dosn't support media changed. */ + /* This talks to the VFS, which doesn't like errors - just 1 or 0. + * Returning "0" is always safe (media hasn't been changed). Do that + * if the low-level cdrom driver dosn't support media changed. */ if (cdi == NULL || cdi->ops->media_changed == NULL) return 0; if (!CDROM_CAN(CDC_MEDIA_CHANGED)) @@ -1445,11 +1445,11 @@ tracks->cdi=0; tracks->xa=0; tracks->error=0; - cdinfo(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n"); - if (!CDROM_CAN(CDC_PLAY_AUDIO)) { + cdinfo(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n"); + if (!CDROM_CAN(CDC_PLAY_AUDIO)) { tracks->error=CDS_NO_INFO; return; - } + } /* Grab the TOC header so we can see how many tracks there are */ if ((ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header))) { if (ret == -ENOMEDIUM) @@ -1457,7 +1457,7 @@ else tracks->error = CDS_NO_INFO; return; - } + } /* check what type of tracks are on this disc */ entry.cdte_format = CDROM_MSF; for (i = header.cdth_trk0; i <= header.cdth_trk1; i++) { @@ -1465,11 +1465,11 @@ if (cdi->ops->audio_ioctl(cdi, CDROMREADTOCENTRY, &entry)) { tracks->error=CDS_NO_INFO; return; - } + } if (entry.cdte_ctrl & CDROM_DATA_TRACK) { if (entry.cdte_format == 0x10) tracks->cdi++; - else if (entry.cdte_format == 0x20) + else if (entry.cdte_format == 0x20) tracks->xa++; else tracks->data++; @@ -1477,11 +1477,11 @@ tracks->audio++; cdinfo(CD_COUNT_TRACKS, "track %d: format=%d, ctrl=%d\n", i, entry.cdte_format, entry.cdte_ctrl); - } - cdinfo(CD_COUNT_TRACKS, "disc has %d tracks: %d=audio %d=data %d=Cd-I %d=XA\n", - header.cdth_trk1, tracks->audio, tracks->data, + } + cdinfo(CD_COUNT_TRACKS, "disc has %d tracks: %d=audio %d=data %d=Cd-I %d=XA\n", + header.cdth_trk1, tracks->audio, tracks->data, tracks->cdi, tracks->xa); -} +} /* Requests to the low-level drivers will /always/ be done in the following format convention: @@ -1594,7 +1594,7 @@ switch (ai->type) { /* LU data send */ case DVD_LU_SEND_AGID: - cdinfo(CD_DVD, "entering DVD_LU_SEND_AGID\n"); + cdinfo(CD_DVD, "entering DVD_LU_SEND_AGID\n"); cgc.quiet = 1; setup_report_key(&cgc, ai->lsa.agid, 0); @@ -1606,7 +1606,7 @@ break; case DVD_LU_SEND_KEY1: - cdinfo(CD_DVD, "entering DVD_LU_SEND_KEY1\n"); + cdinfo(CD_DVD, "entering DVD_LU_SEND_KEY1\n"); setup_report_key(&cgc, ai->lsk.agid, 2); if ((ret = cdo->generic_packet(cdi, &cgc))) @@ -1617,7 +1617,7 @@ break; case DVD_LU_SEND_CHALLENGE: - cdinfo(CD_DVD, "entering DVD_LU_SEND_CHALLENGE\n"); + cdinfo(CD_DVD, "entering DVD_LU_SEND_CHALLENGE\n"); setup_report_key(&cgc, ai->lsc.agid, 1); if ((ret = cdo->generic_packet(cdi, &cgc))) @@ -1629,7 +1629,7 @@ /* Post-auth key */ case DVD_LU_SEND_TITLE_KEY: - cdinfo(CD_DVD, "entering DVD_LU_SEND_TITLE_KEY\n"); + cdinfo(CD_DVD, "entering DVD_LU_SEND_TITLE_KEY\n"); cgc.quiet = 1; setup_report_key(&cgc, ai->lstk.agid, 4); cgc.cmd[5] = ai->lstk.lba; @@ -1648,9 +1648,9 @@ break; case DVD_LU_SEND_ASF: - cdinfo(CD_DVD, "entering DVD_LU_SEND_ASF\n"); + cdinfo(CD_DVD, "entering DVD_LU_SEND_ASF\n"); setup_report_key(&cgc, ai->lsasf.agid, 5); - + if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; @@ -1659,7 +1659,7 @@ /* LU data receive (LU changes state) */ case DVD_HOST_SEND_CHALLENGE: - cdinfo(CD_DVD, "entering DVD_HOST_SEND_CHALLENGE\n"); + cdinfo(CD_DVD, "entering DVD_HOST_SEND_CHALLENGE\n"); setup_send_key(&cgc, ai->hsc.agid, 1); buf[1] = 0xe; copy_chal(&buf[4], ai->hsc.chal); @@ -1671,7 +1671,7 @@ break; case DVD_HOST_SEND_KEY2: - cdinfo(CD_DVD, "entering DVD_HOST_SEND_KEY2\n"); + cdinfo(CD_DVD, "entering DVD_HOST_SEND_KEY2\n"); setup_send_key(&cgc, ai->hsk.agid, 3); buf[1] = 0xa; copy_key(&buf[4], ai->hsk.key); @@ -1686,7 +1686,7 @@ /* Misc */ case DVD_INVALIDATE_AGID: cgc.quiet = 1; - cdinfo(CD_DVD, "entering DVD_INVALIDATE_AGID\n"); + cdinfo(CD_DVD, "entering DVD_INVALIDATE_AGID\n"); setup_report_key(&cgc, ai->lsa.agid, 0x3f); if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; @@ -1905,7 +1905,7 @@ case DVD_STRUCT_MANUFACT: return dvd_read_manufact(cdi, s); - + default: cdinfo(CD_WARNING, ": Invalid DVD structure read requested (%d)\n", s->type); @@ -2021,7 +2021,7 @@ cgc->cmd[7] = (nblocks >> 8) & 0xff; cgc->cmd[8] = nblocks & 0xff; cgc->buflen = blksize * nblocks; - + /* set the header info returned */ switch (blksize) { case CD_FRAMESIZE_RAW0 : cgc->cmd[9] = 0x58; break; @@ -2029,7 +2029,7 @@ case CD_FRAMESIZE_RAW : cgc->cmd[9] = 0xf8; break; default : cgc->cmd[9] = 0x10; } - + return cdo->generic_packet(cdi, cgc); } @@ -2188,7 +2188,7 @@ printk("cdrom: dropping to old style cdda (sense=%x)\n", cdi->last_sense); cdi->cdda_method = CDDA_OLD; - return cdrom_read_cdda_old(cdi, ubuf, lba, nframes); + return cdrom_read_cdda_old(cdi, ubuf, lba, nframes); } /* Just about every imaginable ioctl is supported in the Uniform layer @@ -2212,7 +2212,7 @@ case CDROMMULTISESSION: { struct cdrom_multisession ms_info; u_char requested_format; - cdinfo(CD_DO_IOCTL, "entering CDROMMULTISESSION\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMMULTISESSION\n"); if (!(cdo->capability & CDC_MULTI_SESSION)) return -ENOSYS; IOCTL_IN(arg, struct cdrom_multisession, ms_info); @@ -2226,12 +2226,12 @@ sanitize_format(&ms_info.addr, &ms_info.addr_format, requested_format); IOCTL_OUT(arg, struct cdrom_multisession, ms_info); - cdinfo(CD_DO_IOCTL, "CDROMMULTISESSION successful\n"); + cdinfo(CD_DO_IOCTL, "CDROMMULTISESSION successful\n"); return 0; } case CDROMEJECT: { - cdinfo(CD_DO_IOCTL, "entering CDROMEJECT\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMEJECT\n"); if (!CDROM_CAN(CDC_OPEN_TRAY)) return -ENOSYS; if (cdi->use_count != 1 || keeplocked) @@ -2244,14 +2244,14 @@ } case CDROMCLOSETRAY: { - cdinfo(CD_DO_IOCTL, "entering CDROMCLOSETRAY\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMCLOSETRAY\n"); if (!CDROM_CAN(CDC_CLOSE_TRAY)) return -ENOSYS; return cdo->tray_move(cdi, 0); } case CDROMEJECT_SW: { - cdinfo(CD_DO_IOCTL, "entering CDROMEJECT_SW\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMEJECT_SW\n"); if (!CDROM_CAN(CDC_OPEN_TRAY)) return -ENOSYS; if (keeplocked) @@ -2266,7 +2266,7 @@ struct cdrom_changer_info *info; int changed; - cdinfo(CD_DO_IOCTL, "entering CDROM_MEDIA_CHANGED\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_MEDIA_CHANGED\n"); if (!CDROM_CAN(CDC_MEDIA_CHANGED)) return -ENOSYS; @@ -2292,7 +2292,7 @@ } case CDROM_SET_OPTIONS: { - cdinfo(CD_DO_IOCTL, "entering CDROM_SET_OPTIONS\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_SET_OPTIONS\n"); /* options need to be in sync with capability. too late for that, so we have to check each one separately... */ switch (arg) { @@ -2315,20 +2315,20 @@ } case CDROM_CLEAR_OPTIONS: { - cdinfo(CD_DO_IOCTL, "entering CDROM_CLEAR_OPTIONS\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_CLEAR_OPTIONS\n"); cdi->options &= ~(int) arg; return cdi->options; } case CDROM_SELECT_SPEED: { - cdinfo(CD_DO_IOCTL, "entering CDROM_SELECT_SPEED\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_SELECT_SPEED\n"); if (!CDROM_CAN(CDC_SELECT_SPEED)) return -ENOSYS; return cdo->select_speed(cdi, arg); } case CDROM_SELECT_DISC: { - cdinfo(CD_DO_IOCTL, "entering CDROM_SELECT_DISC\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_SELECT_DISC\n"); if (!CDROM_CAN(CDC_SELECT_DISC)) return -ENOSYS; @@ -2338,14 +2338,14 @@ /* cdo->select_disc is a hook to allow a driver-specific * way of seleting disc. However, since there is no - * equiv hook for cdrom_slot_status this may not + * equiv hook for cdrom_slot_status this may not * actually be useful... */ if (cdo->select_disc != NULL) return cdo->select_disc(cdi, arg); /* no driver specific select_disc(), call our own */ - cdinfo(CD_CHANGER, "Using generic cdrom_select_disc()\n"); + cdinfo(CD_CHANGER, "Using generic cdrom_select_disc()\n"); return cdrom_select_disc(cdi, arg); } @@ -2391,23 +2391,23 @@ */ case CDROM_GET_MCN: { struct cdrom_mcn mcn; - cdinfo(CD_DO_IOCTL, "entering CDROM_GET_MCN\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_GET_MCN\n"); if (!(cdo->capability & CDC_MCN)) return -ENOSYS; if ((ret=cdo->get_mcn(cdi, &mcn))) return ret; IOCTL_OUT(arg, struct cdrom_mcn, mcn); - cdinfo(CD_DO_IOCTL, "CDROM_GET_MCN successful\n"); + cdinfo(CD_DO_IOCTL, "CDROM_GET_MCN successful\n"); return 0; } case CDROM_DRIVE_STATUS: { - cdinfo(CD_DO_IOCTL, "entering CDROM_DRIVE_STATUS\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_DRIVE_STATUS\n"); if (!(cdo->capability & CDC_DRIVE_STATUS)) return -ENOSYS; if (!CDROM_CAN(CDC_SELECT_DISC)) return cdo->drive_status(cdi, CDSL_CURRENT); - if ((arg == CDSL_CURRENT) || (arg == CDSL_NONE)) + if ((arg == CDSL_CURRENT) || (arg == CDSL_NONE)) return cdo->drive_status(cdi, CDSL_CURRENT); if (((int)arg >= cdi->capacity)) return -EINVAL; @@ -2418,29 +2418,29 @@ CDROM_DISC_STATUS ioctl is flawed. It makes the false assumption that CDs are all CDS_DATA_1 or all CDS_AUDIO, etc. Unfortunatly, while this is often the case, it is also very common for CDs to - have some tracks with data, and some tracks with audio. Just + have some tracks with data, and some tracks with audio. Just because I feel like it, I declare the following to be the best way to cope. If the CD has ANY data tracks on it, it will be returned as a data CD. If it has any XA tracks, I will return - it as that. Now I could simplify this interface by combining these + it as that. Now I could simplify this interface by combining these returns with the above, but this more clearly demonstrates - the problem with the current interface. Too bad this wasn't - designed to use bitmasks... -Erik + the problem with the current interface. Too bad this wasn't + designed to use bitmasks... -Erik - Well, now we have the option CDS_MIXED: a mixed-type CD. + Well, now we have the option CDS_MIXED: a mixed-type CD. User level programmers might feel the ioctl is not very useful. ---david */ case CDROM_DISC_STATUS: { tracktype tracks; - cdinfo(CD_DO_IOCTL, "entering CDROM_DISC_STATUS\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_DISC_STATUS\n"); cdrom_count_tracks(cdi, &tracks); - if (tracks.error) + if (tracks.error) return(tracks.error); /* Policy mode on */ if (tracks.audio > 0) { - if (tracks.data==0 && tracks.cdi==0 && tracks.xa==0) + if (tracks.data==0 && tracks.cdi==0 && tracks.xa==0) return CDS_AUDIO; else return CDS_MIXED; @@ -2455,7 +2455,7 @@ } case CDROM_CHANGER_NSLOTS: { - cdinfo(CD_DO_IOCTL, "entering CDROM_CHANGER_NSLOTS\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_CHANGER_NSLOTS\n"); return cdi->capacity; } } @@ -2480,7 +2480,7 @@ u_char requested, back; if (!CDROM_CAN(CDC_PLAY_AUDIO)) return -ENOSYS; - /* cdinfo(CD_DO_IOCTL,"entering CDROMSUBCHNL\n");*/ + /* cdinfo(CD_DO_IOCTL,"entering CDROMSUBCHNL\n");*/ IOCTL_IN(arg, struct cdrom_subchnl, q); requested = q.cdsc_format; if (!((requested == CDROM_MSF) || @@ -2493,19 +2493,19 @@ sanitize_format(&q.cdsc_absaddr, &back, requested); sanitize_format(&q.cdsc_reladdr, &q.cdsc_format, requested); IOCTL_OUT(arg, struct cdrom_subchnl, q); - /* cdinfo(CD_DO_IOCTL, "CDROMSUBCHNL successful\n"); */ + /* cdinfo(CD_DO_IOCTL, "CDROMSUBCHNL successful\n"); */ return 0; } case CDROMREADTOCHDR: { struct cdrom_tochdr header; if (!CDROM_CAN(CDC_PLAY_AUDIO)) return -ENOSYS; - /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCHDR\n"); */ + /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCHDR\n"); */ IOCTL_IN(arg, struct cdrom_tochdr, header); if ((ret=cdo->audio_ioctl(cdi, cmd, &header))) return ret; IOCTL_OUT(arg, struct cdrom_tochdr, header); - /* cdinfo(CD_DO_IOCTL, "CDROMREADTOCHDR successful\n"); */ + /* cdinfo(CD_DO_IOCTL, "CDROMREADTOCHDR successful\n"); */ return 0; } case CDROMREADTOCENTRY: { @@ -2513,10 +2513,10 @@ u_char requested_format; if (!CDROM_CAN(CDC_PLAY_AUDIO)) return -ENOSYS; - /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCENTRY\n"); */ + /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCENTRY\n"); */ IOCTL_IN(arg, struct cdrom_tocentry, entry); requested_format = entry.cdte_format; - if (!((requested_format == CDROM_MSF) || + if (!((requested_format == CDROM_MSF) || (requested_format == CDROM_LBA))) return -EINVAL; /* make interface to low-level uniform */ @@ -2526,14 +2526,14 @@ sanitize_format(&entry.cdte_addr, &entry.cdte_format, requested_format); IOCTL_OUT(arg, struct cdrom_tocentry, entry); - /* cdinfo(CD_DO_IOCTL, "CDROMREADTOCENTRY successful\n"); */ + /* cdinfo(CD_DO_IOCTL, "CDROMREADTOCENTRY successful\n"); */ return 0; } case CDROMPLAYMSF: { struct cdrom_msf msf; if (!CDROM_CAN(CDC_PLAY_AUDIO)) return -ENOSYS; - cdinfo(CD_DO_IOCTL, "entering CDROMPLAYMSF\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMPLAYMSF\n"); IOCTL_IN(arg, struct cdrom_msf, msf); return cdo->audio_ioctl(cdi, cmd, &msf); } @@ -2541,7 +2541,7 @@ struct cdrom_ti ti; if (!CDROM_CAN(CDC_PLAY_AUDIO)) return -ENOSYS; - cdinfo(CD_DO_IOCTL, "entering CDROMPLAYTRKIND\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMPLAYTRKIND\n"); IOCTL_IN(arg, struct cdrom_ti, ti); CHECKAUDIO; return cdo->audio_ioctl(cdi, cmd, &ti); @@ -2550,7 +2550,7 @@ struct cdrom_volctrl volume; if (!CDROM_CAN(CDC_PLAY_AUDIO)) return -ENOSYS; - cdinfo(CD_DO_IOCTL, "entering CDROMVOLCTRL\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMVOLCTRL\n"); IOCTL_IN(arg, struct cdrom_volctrl, volume); return cdo->audio_ioctl(cdi, cmd, &volume); } @@ -2558,7 +2558,7 @@ struct cdrom_volctrl volume; if (!CDROM_CAN(CDC_PLAY_AUDIO)) return -ENOSYS; - cdinfo(CD_DO_IOCTL, "entering CDROMVOLREAD\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMVOLREAD\n"); if ((ret=cdo->audio_ioctl(cdi, cmd, &volume))) return ret; IOCTL_OUT(arg, struct cdrom_volctrl, volume); @@ -2570,7 +2570,7 @@ case CDROMRESUME: { if (!CDROM_CAN(CDC_PLAY_AUDIO)) return -ENOSYS; - cdinfo(CD_DO_IOCTL, "doing audio ioctl (start/stop/pause/resume)\n"); + cdinfo(CD_DO_IOCTL, "doing audio ioctl (start/stop/pause/resume)\n"); CHECKAUDIO; return cdo->audio_ioctl(cdi, cmd, NULL); } @@ -2579,7 +2579,7 @@ /* do the device specific ioctls */ if (CDROM_CAN(CDC_IOCTLS)) return cdo->dev_ioctl(cdi, cmd, arg); - + return -ENOSYS; } @@ -2620,7 +2620,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, unsigned long arg) -{ +{ struct cdrom_device_ops *cdo = cdi->ops; struct packet_command cgc; struct request_sense sense; @@ -2637,7 +2637,7 @@ case CDROMREADMODE2: { struct cdrom_msf msf; int blocksize = 0, format = 0, lba; - + switch (cmd) { case CDROMREADRAW: blocksize = CD_FRAMESIZE_RAW; @@ -2717,7 +2717,7 @@ sanitize_format(&q.cdsc_absaddr, &back, requested); sanitize_format(&q.cdsc_reladdr, &q.cdsc_format, requested); IOCTL_OUT(arg, struct cdrom_subchnl, q); - /* cdinfo(CD_DO_IOCTL, "CDROMSUBCHNL successful\n"); */ + /* cdinfo(CD_DO_IOCTL, "CDROMSUBCHNL successful\n"); */ return 0; } case CDROMPLAYMSF: { @@ -2762,7 +2762,7 @@ cgc.buflen = 24; if ((ret = cdrom_mode_sense(cdi, &cgc, GPMODE_AUDIO_CTL_PAGE, 0))) return ret; - + /* originally the code depended on buffer[1] to determine how much data is available for transfer. buffer[1] is unfortunately ambigious and the only reliable way seem @@ -2795,10 +2795,10 @@ IOCTL_OUT(arg, struct cdrom_volctrl, volctrl); return 0; } - + /* get the volume mask */ cgc.buffer = mask; - if ((ret = cdrom_mode_sense(cdi, &cgc, + if ((ret = cdrom_mode_sense(cdi, &cgc, GPMODE_AUDIO_CTL_PAGE, 1))) return ret; @@ -2815,7 +2815,7 @@ case CDROMSTART: case CDROMSTOP: { - cdinfo(CD_DO_IOCTL, "entering CDROMSTART/CDROMSTOP\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMSTART/CDROMSTOP\n"); cgc.cmd[0] = GPCMD_START_STOP_UNIT; cgc.cmd[1] = 1; cgc.cmd[4] = (cmd == CDROMSTART) ? 1 : 0; @@ -2825,7 +2825,7 @@ case CDROMPAUSE: case CDROMRESUME: { - cdinfo(CD_DO_IOCTL, "entering CDROMPAUSE/CDROMRESUME\n"); + cdinfo(CD_DO_IOCTL, "entering CDROMPAUSE/CDROMRESUME\n"); cgc.cmd[0] = GPCMD_PAUSE_RESUME; cgc.cmd[8] = (cmd == CDROMRESUME) ? 1 : 0; cgc.data_direction = CGC_DATA_NONE; @@ -2839,7 +2839,7 @@ return -ENOSYS; if ((s = (dvd_struct *) kmalloc(size, GFP_KERNEL)) == NULL) return -ENOMEM; - cdinfo(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n"); + cdinfo(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n"); if (copy_from_user(s, (dvd_struct __user *)arg, size)) { kfree(s); return -EFAULT; @@ -2858,7 +2858,7 @@ dvd_authinfo ai; if (!CDROM_CAN(CDC_DVD)) return -ENOSYS; - cdinfo(CD_DO_IOCTL, "entering DVD_AUTH\n"); + cdinfo(CD_DO_IOCTL, "entering DVD_AUTH\n"); IOCTL_IN(arg, dvd_authinfo, ai); if ((ret = dvd_do_auth (cdi, &ai))) return ret; @@ -2868,7 +2868,7 @@ case CDROM_NEXT_WRITABLE: { long next = 0; - cdinfo(CD_DO_IOCTL, "entering CDROM_NEXT_WRITABLE\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_NEXT_WRITABLE\n"); if ((ret = cdrom_get_next_writable(cdi, &next))) return ret; IOCTL_OUT(arg, long, next); @@ -2876,7 +2876,7 @@ } case CDROM_LAST_WRITTEN: { long last = 0; - cdinfo(CD_DO_IOCTL, "entering CDROM_LAST_WRITTEN\n"); + cdinfo(CD_DO_IOCTL, "entering CDROM_LAST_WRITTEN\n"); if ((ret = cdrom_get_last_written(cdi, &last))) return ret; IOCTL_OUT(arg, long, last); @@ -2904,7 +2904,7 @@ if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; - + buflen = be16_to_cpu(ti->track_information_length) + sizeof(ti->track_information_length); @@ -3096,14 +3096,14 @@ int pos; struct cdrom_device_info *cdi; char *info = cdrom_sysctl_settings.info; - + if (!*lenp || (*ppos && !write)) { *lenp = 0; return 0; } pos = sprintf(info, "CD-ROM information, " VERSION "\n"); - + pos += sprintf(info+pos, "\ndrive name:\t"); for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next) pos += sprintf(info+pos, "\t%s", cdi->name); @@ -3185,7 +3185,7 @@ pos += sprintf(info+pos, "\t%d", CDROM_CAN(CDC_RAM) != 0); strcpy(info+pos,"\n\n"); - + return proc_dostring(ctl, write, filp, buffer, lenp, ppos); } @@ -3223,11 +3223,11 @@ int *valp = ctl->data; int val = *valp; int ret; - + ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); if (write && *valp != val) { - + /* we only care for 1 or 0. */ if (*valp) *valp = 1; @@ -3275,7 +3275,7 @@ { .ctl_name = DEV_CDROM_INFO, .procname = "info", - .data = &cdrom_sysctl_settings.info, + .data = &cdrom_sysctl_settings.info, .maxlen = CDROM_STR_SIZE, .mode = 0444, .proc_handler = &cdrom_sysctl_info,