Re: [PATCH] make ide-cd handle non-2kB sector sizes

Bartlomiej Zolnierkiewicz
2004-01-23T15:11:20Z

Hi Pascal!

> --- linux-2.6.2-rc1/drivers/ide/ide-cd.h.orig Thu Jan 22 18:05:04 2004
> +++ linux-2.6.2-rc1/drivers/ide/ide-cd.h Thu Jan 22 18:07:14 2004
> @@ -109,6 +109,7 @@ struct ide_cd_state_flags {
> __u8 door_locked : 1; /* We think that the drive door is locked. */
> __u8 writing : 1; /* the drive is currently writing */
> __u8 reserved : 4;
> + byte sectors_per_frame; /* Current sectors per hw frame */
> byte current_speed; /* Current speed of the drive */
> };

Please don't use 'byte' type in your patch, use 'u8' instead.

> @@ -1346,13 +1332,14 @@ static ide_startstop_t cdrom_seek_intr (
> static ide_startstop_t cdrom_start_seek_continuation (ide_drive_t *drive)
> {
> struct request *rq = HWGROUP(drive)->rq;
> + byte sectors_per_frame = CDROM_STATE_FLAGS(drive)->sectors_per_frame;
> int sector, frame, nskip;
>
> sector = rq->sector;
> - nskip = (sector % SECTORS_PER_FRAME);
> + nskip = (sector % sectors_per_frame);
> if (nskip > 0)
> sector -= nskip;
> - frame = sector / SECTORS_PER_FRAME;
> + frame = sector / sectors_per_frame;
>
> memset(rq->cmd, 0, sizeof(rq->cmd));
> rq->cmd[0] = GPCMD_SEEK;

You can as well clean this up while at it.
We don't need 'nskip' for calculating 'frame',

frame = rq->sector / sectors_per_frame;

should be enough.

--bart