Taking synchronous read/write into respect with abort handling

This commit is contained in:
Thomas Schmitt 2007-08-22 17:33:53 +00:00
parent f37e109aa1
commit c6bc4a5e97
5 changed files with 18 additions and 5 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.08.22.134731" #define Cdrskin_timestamP "2007.08.22.173459"

View File

@ -110,6 +110,7 @@ int burn_drive_is_released(struct burn_drive *d)
-1 = drive is closed (i.e. released explicitely) -1 = drive is closed (i.e. released explicitely)
0 = drive is open, not grabbed (after scan, before 1st grab) 0 = drive is open, not grabbed (after scan, before 1st grab)
1 = drive is grabbed but BURN_DRIVE_IDLE 1 = drive is grabbed but BURN_DRIVE_IDLE
2 = drive is grabbed, synchronous read/write interrupted
10 = drive is grabbing (BURN_DRIVE_GRABBING) 10 = drive is grabbing (BURN_DRIVE_GRABBING)
100 = drive is busy in cancelable state 100 = drive is busy in cancelable state
1000 = drive is in non-cancelable state 1000 = drive is in non-cancelable state
@ -127,6 +128,9 @@ int burn_drive_is_occupied(struct burn_drive *d)
return 0; return 0;
if(d->busy == BURN_DRIVE_IDLE) if(d->busy == BURN_DRIVE_IDLE)
return 1; return 1;
if(d->busy == BURN_DRIVE_READING_SYNC ||
d->busy == BURN_DRIVE_WRITING_SYNC)
return 2;
if(d->busy == BURN_DRIVE_READING || d->busy == BURN_DRIVE_WRITING) if(d->busy == BURN_DRIVE_READING || d->busy == BURN_DRIVE_WRITING)
return 50; return 50;
return 1000; return 1000;

View File

@ -251,8 +251,16 @@ enum burn_drive_status
/* ts A61223 */ /* ts A61223 */
/** The drive is formatting media */ /** The drive is formatting media */
BURN_DRIVE_FORMATTING BURN_DRIVE_FORMATTING,
/* ts A70822 */
/** The drive is busy in synchronous read (if you see this then it
has been interrupted) */
BURN_DRIVE_READING_SYNC,
/** The drive is busy in synchronous write (if you see this then it
has been interrupted) */
BURN_DRIVE_WRITING_SYNC
}; };

View File

@ -322,7 +322,7 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
"Drive is busy on attempt to read data", 0, 0); "Drive is busy on attempt to read data", 0, 0);
return 0; return 0;
} }
d->busy = BURN_DRIVE_READING; d->busy = BURN_DRIVE_READING_SYNC;
d->buffer = &buf; d->buffer = &buf;
start = byte_address / 2048; start = byte_address / 2048;
@ -348,6 +348,7 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
wpt += 2048; wpt += 2048;
*data_count += 2048; *data_count += 2048;
} }
d->buffer = NULL;
d->busy = BURN_DRIVE_IDLE; d->busy = BURN_DRIVE_IDLE;
return 0; return 0;
} }

View File

@ -2027,7 +2027,7 @@ int burn_random_access_write(struct burn_drive *d, off_t byte_address,
"Drive is busy on attempt to write random access",0,0); "Drive is busy on attempt to write random access",0,0);
return 0; return 0;
} }
d->busy = BURN_DRIVE_WRITING; d->busy = BURN_DRIVE_WRITING_SYNC;
d->buffer = &buf; d->buffer = &buf;
start = byte_address / 2048; start = byte_address / 2048;
@ -2053,6 +2053,6 @@ int burn_random_access_write(struct burn_drive *d, off_t byte_address,
d->sync_cache(d); d->sync_cache(d);
d->buffer = NULL; d->buffer = NULL;
d->busy = BURN_DRIVE_IDLE; d->busy = BURN_DRIVE_IDLE;
return(1); return 1;
} }