Recognizing growisofs follow-up sessions on xorriso overwriteables

This commit is contained in:
Thomas Schmitt 2008-07-17 18:29:50 +00:00
parent 31809252e8
commit a745366913
2 changed files with 27 additions and 3 deletions

View File

@ -1036,7 +1036,7 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba,
int isoburn_emulate_toc(struct burn_drive *d, int flag) int isoburn_emulate_toc(struct burn_drive *d, int flag)
{ {
int ret, image_size= 0, lba, track_blocks, session_count= 0, read_flag= 0; int ret, image_size= 0, lba, track_blocks, session_count= 0, read_flag= 0;
int scan_start= 0, scan_count= 0; int scan_start= 0, scan_count= 0, probe_minus_16= 0, growisofs_nwa;
struct isoburn *o; struct isoburn *o;
struct isoburn_toc_entry *item; struct isoburn_toc_entry *item;
char msg[160], size_text[80], *sev; char msg[160], size_text[80], *sev;
@ -1073,7 +1073,23 @@ int isoburn_emulate_toc(struct burn_drive *d, int flag)
} }
read_flag= 0; read_flag= 0;
if(flag&2) if(flag&2)
read_flag= (1<<15)|((session_count>0)<<14); read_flag|= (1<<15)|((session_count>0)<<14);
else {
/* MULTI :
growisofs aligns to 16 rather than 32. Overwriteable TOC emulation
relies on not accidentially seeing inter-session trash data.
But one can safely access 16 blocks earlier because a xorriso header
would have overwritten with the unused 16 blocks at its start.
If libisoburn alignment would increase, then this would not be
possible any more.
*/
if(probe_minus_16)
read_flag|= (1<<14);
probe_minus_16= 0;
}
ret= isoburn_read_iso_head(d, lba, &track_blocks, NULL, read_flag); ret= isoburn_read_iso_head(d, lba, &track_blocks, NULL, read_flag);
if(ret<=0) { if(ret<=0) {
if(session_count>0) { if(session_count>0) {
@ -1112,9 +1128,17 @@ int isoburn_emulate_toc(struct burn_drive *d, int flag)
item->start_lba= lba; item->start_lba= lba;
item->track_blocks= track_blocks; item->track_blocks= track_blocks;
lba+= track_blocks; lba+= track_blocks;
/* MULTI : growisofs aligns to 16 rather than 32 */;
growisofs_nwa= lba;
if(growisofs_nwa % 16)
growisofs_nwa+= 16 - (growisofs_nwa % 16);
if(lba % Libisoburn_nwa_alignemenT) if(lba % Libisoburn_nwa_alignemenT)
lba+= Libisoburn_nwa_alignemenT - (lba % Libisoburn_nwa_alignemenT); lba+= Libisoburn_nwa_alignemenT - (lba % Libisoburn_nwa_alignemenT);
scan_start= lba; scan_start= lba;
if(lba - growisofs_nwa == 16)
probe_minus_16= 1;
} }
if(last_pacifier != start_time) if(last_pacifier != start_time)
sev= "UPDATE"; sev= "UPDATE";

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.07.17.111411" #define Xorriso_timestamP "2008.07.17.183024"