Skip to content

Commit

Permalink
formatting, sleep bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rsc committed Aug 14, 2007
1 parent f1f8dd9 commit 8d0a835
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct ide_request {
void *addr;
uint nsecs;
uint read;
int done;
};

static struct ide_request request[NREQUEST];
Expand All @@ -40,6 +41,7 @@ static int disk_queue;

static int ide_probe_disk1(void);

//PAGEBREAK: 10
// Wait for IDE disk to become ready.
static int
ide_wait_ready(int check_error)
Expand Down Expand Up @@ -91,6 +93,7 @@ void
ide_intr(void)
{
acquire(&ide_lock);
request[tail].done = 1;
wakeup(&request[tail]);
release(&ide_lock);
}
Expand Down Expand Up @@ -119,6 +122,7 @@ ide_start_request (void)
}
}

//PAGEBREAK: 30
// Run an entire disk operation.
void
ide_rw(int diskno, uint secno, void *addr, uint nsecs, int read)
Expand All @@ -140,13 +144,15 @@ ide_rw(int diskno, uint secno, void *addr, uint nsecs, int read)
r->nsecs = nsecs;
r->diskno = diskno;
r->read = read;
r->done = 0;
head = (head + 1) % NREQUEST;

// Start request if necessary.
ide_start_request();

// Wait for request to finish.
sleep(r, &ide_lock);
while(!r->done)
sleep(r, &ide_lock);

// Finish request.
if(read){
Expand Down

0 comments on commit 8d0a835

Please sign in to comment.