Ensured synchronize cache before release

This commit is contained in:
Thomas Schmitt 2007-10-03 11:24:41 +00:00
parent a5b0be3885
commit 055e0caeab
5 changed files with 29 additions and 3 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.10.03.084206"
#define Cdrskin_timestamP "2007.10.03.112547"

View File

@ -463,6 +463,8 @@ int burn_drive_release_fl(struct burn_drive *d, int flag)
}
if (d->drive_role == 1) {
if (d->needs_sync_cache)
d->sync_cache(d);
if ((flag & 7) != 2)
d->unlock(d);
if ((flag & 7) == 1)
@ -470,6 +472,7 @@ int burn_drive_release_fl(struct burn_drive *d, int flag)
d->release(d);
}
d->needs_sync_cache = 0; /* just to be sure */
d->released = 1;
/* ts A61125 : outsourced model aspects */
@ -1670,6 +1673,12 @@ int burn_abort(int patience,
current_time = start_time = pacifier_time = time(0);
end_time = start_time + patience;
/* >>> ts A71002 : are there any threads at work ?
If not, then one can force abort because the drives will not
change status on their own.
*/
while(current_time-end_time < patience) {
still_not_done = 0;
@ -2406,12 +2415,19 @@ int burn_drive_find_by_thread_pid(struct burn_drive **d, pid_t pid)
{
int i;
for (i = 0; i < drivetop + 1; i++)
for (i = 0; i < drivetop + 1; i++) {
/*
if (drive_array[i].thread_pid_valid)
fprintf(stderr, "libburn_EXPERIMENTAL : drive %d , thread_pid %d\n", i, drive_array[i].thread_pid);
*/
if (drive_array[i].thread_pid_valid &&
drive_array[i].thread_pid == pid) {
*d = &(drive_array[i]);
return 1;
}
}
return 0;
}

View File

@ -2308,6 +2308,8 @@ void mmc_sync_cache(struct burn_drive *d)
}
if (spc_wait_unit_attention(d, 3600, "SYNCHRONIZE CACHE", 0) <= 0)
d->cancel = 1;
else
d->needs_sync_cache = 0;
}
@ -2949,6 +2951,7 @@ int mmc_setup_drive(struct burn_drive *d)
d->current_feat21h_link_size = -1;
d->current_feat2fh_byte4 = -1;
d->needs_close_session = 0;
d->needs_sync_cache = 0;
d->bg_format_status = -1;
d->num_format_descr = 0;
d->complete_sessions = 0;

View File

@ -180,9 +180,12 @@ struct burn_drive
*/
int current_feat2fh_byte4;
/* ts A70114 : wether a DVD-RW media holds an incomplete session
/* ts A70114 : whether a DVD-RW media holds an incomplete session
(which could need closing after write) */
int needs_close_session;
/* ts A71003 : whether a random write operation was done and no
synchronize chache has happened yet */
int needs_sync_cache;
/* ts A61218 from 51h READ DISC INFORMATION */
int bg_format_status; /* 0=needs format start, 1=needs format restart*/

View File

@ -1793,6 +1793,7 @@ int burn_stdio_sync_cache(int fd, struct burn_drive *d, int flag)
d->cancel = 1;
return 0;
}
d->needs_sync_cache = 0;
if (!(flag & 1))
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
@ -2322,11 +2323,14 @@ int burn_random_access_write(struct burn_drive *d, off_t byte_address,
}
}
if(d->drive_role == 1)
d->needs_sync_cache = 1;
if(flag & 1) {
if(d->drive_role == 1)
d->sync_cache(d);
else
burn_stdio_sync_cache(fd, d, 0);
d->needs_sync_cache = 0;
}
if(fd >= 0)