-check_media recognizes relocated 64kB superblock tag and hops over session gaps

This commit is contained in:
Thomas Schmitt 2009-08-17 16:27:37 +00:00
parent ca519124af
commit c2df9387a9
2 changed files with 51 additions and 7 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.08.17.162456"
#define Xorriso_timestamP "2009.08.17.162834"

View File

@ -9217,9 +9217,9 @@ int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist,
struct stat stbuf;
void *ctx= NULL, *cloned_ctx= NULL;
char md5[16], tag_md5[16];
uint32_t pos, range_start, range_size, next_tag= 0, lba, md5_spot_lba;
uint32_t pos, range_start, range_size, next_tag= 0, lba, md5_spot_lba= 0;
int md5_spot_value= Xorriso_read_quality_untesteD, chain_broken= 0;
int tag_type= 0, valid, was_sb_tag= 0;
int tag_type= 0, valid, was_sb_tag= 0, in_track_gap= 0;
char *comparison= "", *sev_text= "DEBUG", *tag_type_name= "";
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
@ -9392,13 +9392,32 @@ abort_check:;
&pos, &range_start, &range_size,
&next_tag, tag_md5, !!chain_broken);
}
valid= (ret == 1 || ret == ISO_MD5_AREA_CORRUPTED);
if(valid && tag_type == 2 && pos == lba && lba < md5_start + 32) {
valid= (ret == 1 || ret == ISO_MD5_AREA_CORRUPTED) && pos == lba;
if(valid && tag_type == 2 && (lba < md5_start + 32 || in_track_gap)) {
tag_type_name= "superblock";
was_sb_tag= 1;
}else if(valid && tag_type == 3 && pos == lba && was_sb_tag) {
if(in_track_gap && range_start != md5_start && range_start < lba &&
lba - range_start <= j) {
/* Looking for next session : start computing in hindsight.
Session start and superblock tag are supposed to be in the
same 64 kB chunk.
*/
iso_md5_end(&ctx, md5);
ret= iso_md5_start(&ctx);
if(ret < 0) {
Xorriso_no_malloc_memory(xorriso, NULL, 0);
ret= -1; goto ex;
}
iso_md5_compute(&ctx, data + (j - (lba - range_start)) * 2048,
(lba - range_start) * 2048);
md5_start= range_start;
in_track_gap= 0;
}
} else if(valid && tag_type == 4 && lba < 32) {
tag_type_name= "relocated 64kB superblock";
}else if(valid && tag_type == 3 && was_sb_tag) {
tag_type_name= "tree";
}else if(valid && tag_type == 1 && pos == lba) {
}else if(valid && tag_type == 1) {
/* >>> ??? allow this without superblock and tree tag ? */
@ -9417,6 +9436,7 @@ abort_check:;
(unsigned int) md5_start, range_start);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE",0);
chain_broken= 1;
valid= 0;
} else {
ret= iso_md5_clone(ctx, &cloned_ctx);
if(ret <= 0) {
@ -9450,6 +9470,30 @@ abort_check:;
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
sev_text, 0);
}
if(valid && (tag_type == 1 ||
(tag_type == 4 && pos == lba && lba < 32))) {
if(md5_spot_value != Xorriso_read_quality_untesteD) {
ret= Spotlist_add_item(spotlist, md5_start,
md5_spot_lba - md5_start, md5_spot_value, 0);
if(ret <= 0)
goto ex;
}
md5_spot_value= Xorriso_read_quality_untesteD;
md5_start = lba + 1;
if (md5_start % 32)
md5_start= md5_start + (32 - (md5_start % 32));
next_tag= 0;
iso_md5_end(&ctx, md5);
ret= iso_md5_start(&ctx);
if(ret < 0) {
Xorriso_no_malloc_memory(xorriso, NULL, 0);
ret= -1; goto ex;
}
if(tag_type == 1)
in_track_gap= 1;
continue;
}
}
iso_md5_compute(ctx, data + j * 2048, 2048);
}