From c91a9601af734b6463429308efa4908280f62cf4 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 17 Jul 2008 18:29:50 +0000 Subject: [PATCH] Recognizing growisofs follow-up sessions on xorriso overwriteables --- libisoburn/trunk/libisoburn/burn_wrap.c | 28 ++++++++++++++++++-- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/libisoburn/trunk/libisoburn/burn_wrap.c b/libisoburn/trunk/libisoburn/burn_wrap.c index 7a780596..54832292 100644 --- a/libisoburn/trunk/libisoburn/burn_wrap.c +++ b/libisoburn/trunk/libisoburn/burn_wrap.c @@ -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 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_toc_entry *item; char msg[160], size_text[80], *sev; @@ -1073,7 +1073,23 @@ int isoburn_emulate_toc(struct burn_drive *d, int flag) } read_flag= 0; 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); if(ret<=0) { if(session_count>0) { @@ -1112,9 +1128,17 @@ int isoburn_emulate_toc(struct burn_drive *d, int flag) item->start_lba= lba; item->track_blocks= 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) lba+= Libisoburn_nwa_alignemenT - (lba % Libisoburn_nwa_alignemenT); scan_start= lba; + if(lba - growisofs_nwa == 16) + probe_minus_16= 1; } if(last_pacifier != start_time) sev= "UPDATE"; diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 47ddd4bf..38ac11bb 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.07.17.111411" +#define Xorriso_timestamP "2008.07.17.183024"