From 6821bbce5f04723595ccbf68bf46252e6c252a4b Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sun, 18 Jun 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-06-18 --- alphapc/random.c | 4 ++-- alphapc/sd.h | 8 +++----- alphapc/sdscsi.c | 19 ++++++++++++++----- carrera/random.c | 4 ++-- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/alphapc/random.c b/alphapc/random.c index cf9eb1d054608a5a63c47eb48ed459b739b8a6d3..4954367f8ad4a996b0d9ee49e775103f92beb9b8 100644 --- a/alphapc/random.c +++ b/alphapc/random.c @@ -81,7 +81,7 @@ randomclock(void) wakeup(&rb.consumer); } -static void +void randominit(void) { addclock0link(randomclock); @@ -93,7 +93,7 @@ randominit(void) /* * consume random bytes from a circular buffer */ -static ulong +ulong randomread(void *xp, ulong n) { uchar *e, *p; diff --git a/alphapc/sd.h b/alphapc/sd.h index f756adcdd0fa5747d56976988709f7fcdeb3f1b0..9093a20cbfcf3d7ec945ebedfa14bd3ad6f310f1 100644 --- a/alphapc/sd.h +++ b/alphapc/sd.h @@ -14,7 +14,7 @@ typedef struct SDpart { char user[NAMELEN]; ulong perm; int valid; - int nopen; /* of this partition */ + ulong vers; } SDpart; typedef struct SDunit { @@ -27,10 +27,8 @@ typedef struct SDunit { QLock ctl; ulong sectors; ulong secsize; - SDpart* part; - int npart; /* of valid partitions */ - int nopen; /* of partitions on this unit */ - int changed; + SDpart* part; /* either nil or points at array of size SDnpart */ + ulong vers; Lock rawinuse; /* really just a test-and-set */ int state; diff --git a/alphapc/sdscsi.c b/alphapc/sdscsi.c index 1f95bb10660257e347a7f19c4a58383295290843..1a08c5428aef938d0ab297b703d5396d923d5863 100644 --- a/alphapc/sdscsi.c +++ b/alphapc/sdscsi.c @@ -217,6 +217,14 @@ scsionline(SDunit* unit) */ unit->sectors++; unit->secsize = (p[4]<<24)|(p[5]<<16)|(p[6]<<8)|p[7]; + + /* + * Some ATAPI CD readers lie about the block size. + * Since we don't read audio via this interface + * it's okay to always fudge this. + */ + if((unit->inquiry[0] & 0x1F) == 0x05 && unit->secsize == 2352) + unit->secsize = 2048; ok = 1; break; case 1: @@ -230,7 +238,10 @@ scsionline(SDunit* unit) free(p); free(r); - return ok; + if(ok) + return ok+retries; + else + return 0; } int @@ -331,15 +342,13 @@ again: case 0x06: /* check condition */ /* * Check for a removeable media change. - * If so, mark it and zap the geometry info + * If so, mark it by zapping the geometry info * to force an online request. */ if(r->sense[12] != 0x28 || r->sense[13] != 0) break; - if(unit->inquiry[1] & 0x80){ - unit->changed = 1; + if(unit->inquiry[1] & 0x80) unit->sectors = 0; - } break; case 0x02: /* not ready */ /* diff --git a/carrera/random.c b/carrera/random.c index cf9eb1d054608a5a63c47eb48ed459b739b8a6d3..4954367f8ad4a996b0d9ee49e775103f92beb9b8 100644 --- a/carrera/random.c +++ b/carrera/random.c @@ -81,7 +81,7 @@ randomclock(void) wakeup(&rb.consumer); } -static void +void randominit(void) { addclock0link(randomclock); @@ -93,7 +93,7 @@ randominit(void) /* * consume random bytes from a circular buffer */ -static ulong +ulong randomread(void *xp, ulong n) { uchar *e, *p;