Allow acd(4) and cd(4) to support old behavior for CDRIOC*SPEED ioctls.
If the value from the user is less than 177, assume it is a multiple of a single speed CDROM and convert to KB/sec. No complaints from: sos Reviewed by: ken Approved by: re MFC after: 1 day
This commit is contained in:
parent
a65fb8c3de
commit
d3c6d000f7
@ -2976,6 +2976,12 @@ cdsetspeed(struct cam_periph *periph, u_int32_t rdspeed, u_int32_t wrspeed)
|
||||
ccb = cdgetccb(periph, /* priority */ 1);
|
||||
csio = &ccb->csio;
|
||||
|
||||
/* Preserve old behavior: units in multiples of CDROM speed */
|
||||
if (rdspeed < 177)
|
||||
rdspeed *= 177;
|
||||
if (wrspeed < 177)
|
||||
wrspeed *= 177;
|
||||
|
||||
cam_fill_csio(csio,
|
||||
/* retries */ 1,
|
||||
/* cbfcnp */ cddone,
|
||||
|
@ -1021,11 +1021,24 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
|
||||
break;
|
||||
|
||||
case CDRIOCREADSPEED:
|
||||
error = acd_set_speed(cdp, *(int *)addr, CDR_MAX_SPEED);
|
||||
{
|
||||
int speed = *(int *)addr;
|
||||
|
||||
/* Preserve old behavior: units in multiples of CDROM speed */
|
||||
if (speed < 177)
|
||||
speed *= 177;
|
||||
error = acd_set_speed(cdp, speed, CDR_MAX_SPEED);
|
||||
}
|
||||
break;
|
||||
|
||||
case CDRIOCWRITESPEED:
|
||||
error = acd_set_speed(cdp, CDR_MAX_SPEED, *(int *)addr);
|
||||
{
|
||||
int speed = *(int *)addr;
|
||||
|
||||
if (speed < 177)
|
||||
speed *= 177;
|
||||
error = acd_set_speed(cdp, CDR_MAX_SPEED, speed);
|
||||
}
|
||||
break;
|
||||
|
||||
case CDRIOCGETBLOCKSIZE:
|
||||
|
Loading…
Reference in New Issue
Block a user