ae270c9eb5
set it *after* scsi_build, so that the actual intented timeout value is used, avoiding timeouts, bus resets and people putting the blame on controllers/drivers.
78 lines
2 KiB
Text
78 lines
2 KiB
Text
$NetBSD: patch-ab,v 1.6 2000/11/19 12:34:23 fvdl Exp $
|
|
|
|
--- tosha.c.orig Wed May 21 02:11:49 1997
|
|
+++ tosha.c Sun Nov 19 13:01:03 2000
|
|
@@ -49,7 +49,8 @@
|
|
#include <sys/uio.h>
|
|
#include <sys/scsiio.h>
|
|
#include <unistd.h>
|
|
-#include <scsi.h>
|
|
+#include <util.h>
|
|
+#include "scsi.h"
|
|
extern int errno;
|
|
|
|
/*
|
|
@@ -93,7 +94,7 @@
|
|
#include "getlopt.h"
|
|
|
|
typedef unsigned char byte;
|
|
-typedef unsigned long ulong;
|
|
+/*typedef unsigned long ulong;*/
|
|
|
|
struct scsireq *sreq; /* SCSI device request structure */
|
|
int scsifd; /* SCSI device file descriptor */
|
|
@@ -127,8 +128,8 @@
|
|
int result;
|
|
|
|
scsireq_reset (sreq);
|
|
- sreq->timeout = 10000;
|
|
scsireq_build (sreq, size, (char *) buf, flags, cmd);
|
|
+ sreq->timeout = 10000;
|
|
result = scsireq_enter (scsifd, sreq);
|
|
#ifndef DEBUG
|
|
if (SCSIREQ_ERROR (sreq))
|
|
@@ -182,7 +183,8 @@
|
|
|
|
char *tracklstr = "1-100";
|
|
char *outname = "track%02d.pcm";
|
|
-char *device = "/dev/cd0c";
|
|
+char device_store[256];
|
|
+char *device = device_store;
|
|
int indexonly = FALSE;
|
|
int quiet = FALSE;
|
|
int verbose = FALSE;
|
|
@@ -387,7 +389,6 @@
|
|
if ((secread = framesperbuf) > endpp - sec)
|
|
secread = endpp - sec;
|
|
scsireq_reset (sreq);
|
|
- sreq->timeout = 10000;
|
|
if (readcmd == 0xd8)
|
|
scsireq_build (sreq, FRAMESIZE * secread,
|
|
(char *) buf, SCCMD_READ,
|
|
@@ -398,6 +399,7 @@
|
|
(char *) buf, SCCMD_READ,
|
|
"v 0 0 v:i3 0 0 v 0", readcmd,
|
|
sec, secread);
|
|
+ sreq->timeout = 10000;
|
|
result = scsireq_enter (scsifd, sreq);
|
|
#ifndef DEBUG
|
|
if (SCSIREQ_ERROR (sreq))
|
|
@@ -464,6 +466,8 @@
|
|
int singlefile = FALSE;
|
|
int modechange = TRUE, denschange = 0;
|
|
|
|
+ (void) snprintf(device, 256, "/dev/rcd0%c", getrawpartition() + 'a');
|
|
+
|
|
utils_init (argv[0]);
|
|
#ifdef DEBUG
|
|
fprintf (stderr, "%s: DEBUG mode is ON.\n", me);
|
|
@@ -647,7 +651,8 @@
|
|
fprintf (stderr, " Reading ...\r");
|
|
}
|
|
else {
|
|
- asprintf (&ofname, outname, i+1);
|
|
+ ofname = malloc(1000); /* XXX */
|
|
+ sprintf (ofname, outname, i+1);
|
|
if (!quiet)
|
|
fprintf (stderr, verbose ?
|
|
" (output file: %s)\n" :
|