formatting, sleep bug fix

This commit is contained in:
rsc 2007-08-14 18:46:29 +00:00
parent f1f8dd91bc
commit 8d0a83565a

8
ide.c
View file

@ -29,6 +29,7 @@ struct ide_request {
void *addr; void *addr;
uint nsecs; uint nsecs;
uint read; uint read;
int done;
}; };
static struct ide_request request[NREQUEST]; static struct ide_request request[NREQUEST];
@ -40,6 +41,7 @@ static int disk_queue;
static int ide_probe_disk1(void); static int ide_probe_disk1(void);
//PAGEBREAK: 10
// Wait for IDE disk to become ready. // Wait for IDE disk to become ready.
static int static int
ide_wait_ready(int check_error) ide_wait_ready(int check_error)
@ -91,6 +93,7 @@ void
ide_intr(void) ide_intr(void)
{ {
acquire(&ide_lock); acquire(&ide_lock);
request[tail].done = 1;
wakeup(&request[tail]); wakeup(&request[tail]);
release(&ide_lock); release(&ide_lock);
} }
@ -119,6 +122,7 @@ ide_start_request (void)
} }
} }
//PAGEBREAK: 30
// Run an entire disk operation. // Run an entire disk operation.
void void
ide_rw(int diskno, uint secno, void *addr, uint nsecs, int read) ide_rw(int diskno, uint secno, void *addr, uint nsecs, int read)
@ -140,13 +144,15 @@ ide_rw(int diskno, uint secno, void *addr, uint nsecs, int read)
r->nsecs = nsecs; r->nsecs = nsecs;
r->diskno = diskno; r->diskno = diskno;
r->read = read; r->read = read;
r->done = 0;
head = (head + 1) % NREQUEST; head = (head + 1) % NREQUEST;
// Start request if necessary. // Start request if necessary.
ide_start_request(); ide_start_request();
// Wait for request to finish. // Wait for request to finish.
sleep(r, &ide_lock); while(!r->done)
sleep(r, &ide_lock);
// Finish request. // Finish request.
if(read){ if(read){