diff options
author | njl <njl@FreeBSD.org> | 2002-10-18 22:03:39 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2002-10-18 22:03:39 +0000 |
commit | 181311508173b9c70205bd14450f104550fe7bac (patch) | |
tree | 540c29f87f9954dc980102ee2621565072883c36 /usr.sbin | |
parent | 1bac0e0b4c757dd560b18b70ad1a3a28028cf233 (diff) | |
download | FreeBSD-src-181311508173b9c70205bd14450f104550fe7bac.zip FreeBSD-src-181311508173b9c70205bd14450f104550fe7bac.tar.gz |
* Add CDRIOC{READ,WRITE}SPEED ioctls to cd(4). Units are in KB/sec.
* Change atapi-cd ioctls to use the same units.
* Change burncd, cdcontrol to convert CDROM speed to KB/sec before
calling the ioctl. Add a "max" speed option for their command lines.
This change does not break ABI but does change the units passed through
the ioctl so 3rd party software that uses cdrio.h will have to convert
(most likely by multiplying CDROM speed by 177 to get KB/s).
PR: kern/36845
Submitted by: Philipp Mergenthaler <p@i609a.hadiko.de> (CAM ioctls)
Reviewed by: sos, ken
MFC after: 1 month
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/burncd/burncd.8 | 1 | ||||
-rw-r--r-- | usr.sbin/burncd/burncd.c | 5 | ||||
-rw-r--r-- | usr.sbin/cdcontrol/cdcontrol.1 | 6 | ||||
-rw-r--r-- | usr.sbin/cdcontrol/cdcontrol.c | 9 |
4 files changed, 13 insertions, 8 deletions
diff --git a/usr.sbin/burncd/burncd.8 b/usr.sbin/burncd/burncd.8 index 47dc84f..520ed9a 100644 --- a/usr.sbin/burncd/burncd.8 +++ b/usr.sbin/burncd/burncd.8 @@ -69,6 +69,7 @@ quiet, do not print progress messages. .It Fl s Ar speed set the speed of the burner device. Defaults to 1. +Specify "max" to use the drive's fastest speed. .It Fl t test write, do not actually write on the media. .It Fl v diff --git a/usr.sbin/burncd/burncd.c b/usr.sbin/burncd/burncd.c index 1d3d2fd..9f3738e 100644 --- a/usr.sbin/burncd/burncd.c +++ b/usr.sbin/burncd/burncd.c @@ -116,7 +116,10 @@ main(int argc, char **argv) break; case 's': - speed = atoi(optarg); + if (strcasecmp("max", optarg) == 0) + speed = CDR_MAX_SPEED; + else + speed = atoi(optarg); if (speed <= 0) errx(EX_USAGE, "Invalid speed: %s", optarg); break; diff --git a/usr.sbin/cdcontrol/cdcontrol.1 b/usr.sbin/cdcontrol/cdcontrol.1 index 3f986fe..94214f9 100644 --- a/usr.sbin/cdcontrol/cdcontrol.1 +++ b/usr.sbin/cdcontrol/cdcontrol.1 @@ -164,9 +164,9 @@ Set minute-second-frame ioctl mode (default). .It Ic set Cm lba Set LBA ioctl mode. .It Ic speed Ar s -Set the highest speed that the drive should use. -The speed is a multiple of the single speed. -This command is currently only supported on ATAPI drives. +Set the highest speed that the drive should use for reading data. +The units are multiples of a single speed CDROM (150 KB/s). +Specify "max" to use the drive's fastest speed. .It Ic quit Quit the program. .El diff --git a/usr.sbin/cdcontrol/cdcontrol.c b/usr.sbin/cdcontrol/cdcontrol.c index f497c52..5dd0585 100644 --- a/usr.sbin/cdcontrol/cdcontrol.c +++ b/usr.sbin/cdcontrol/cdcontrol.c @@ -282,7 +282,6 @@ int run (int cmd, char *arg) { long speed; int l, r, rc; - char *ep; switch (cmd) { @@ -435,9 +434,11 @@ int run (int cmd, char *arg) return (0); errno = 0; - speed = strtol(arg, &ep, 10); - if (*ep || ep == arg || speed <= 0 || speed > INT_MAX || - errno != 0) { + if (strcasecmp("max", arg) == 0) + speed = CDR_MAX_SPEED; + else + speed = strtol(arg, NULL, 10) * 177; + if (speed <= 0 || speed > INT_MAX) { warnx("invalid command arguments %s", arg); return (0); } |