Made Xorriso_check_media() ready for long block adresses

This commit is contained in:
Thomas Schmitt 2024-03-18 18:38:53 +01:00
parent 969ee9d6f5
commit 19e1ceec26
4 changed files with 43 additions and 38 deletions

View File

@ -2569,7 +2569,7 @@ struct xorriso_md5_state {
int Xorriso__add_spot(struct xorriso_md5_state *state,
int start_lba, int blocks, int quality, int flag)
off_t start_lba, off_t blocks, int quality, int flag)
{
int ret, uret;
@ -2578,7 +2578,8 @@ int Xorriso__add_spot(struct xorriso_md5_state *state,
if(ret != 0)
return(0);
}
ret= Spotlist_add_item(state->spotlist, (off_t) start_lba, (off_t) blocks, quality, 0);
ret= Spotlist_add_item(state->spotlist, start_lba, blocks, quality, 0);
if(state->chunk != NULL) {
uret= pthread_mutex_unlock(&(state->spot_mutex));
if(uret != 0 && ret > 0)
@ -2689,8 +2690,9 @@ int Xorriso_chunk_md5(struct XorrisO *xorriso, char *data, int to_read,
}
if(valid && (tag_type == 1 || (tag_type == 4 && pos == lba && lba < 32))){
if(state->md5_spot_value != Xorriso_read_quality_untesteD) {
ret= Xorriso__add_spot(state, state->md5_start,
state->md5_spot_lba - state->md5_start, state->md5_spot_value, 0);
ret= Xorriso__add_spot(state, (off_t) state->md5_start,
(off_t) state->md5_spot_lba - state->md5_start,
state->md5_spot_value, 0);
if(ret <= 0)
goto ex;
}
@ -2847,16 +2849,15 @@ int Xorriso__end_slave_md5(struct xorriso_md5_state *state,
*/
int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist,
struct CheckmediajoB *job,
int from_lba, int block_count, int read_chunk,
int md5_start, int flag)
off_t from_lba, off_t block_count, off_t read_chunk,
off_t md5_start, int flag)
{
int i, j, ret, total_count= 0, skip_reading;
int ret, skip_reading, first_value, fret, suspect_tao_end= 0;
off_t i, j, total_count= 0, start_sec, end_sec, start_lba= 0;
off_t sectors= -1, sector_size= -1;
int prev_quality= -1, quality= -1, retry= 0, profile_no, is_cd= 0;
int eccb_size= 16, us_corr = 0, data_skip;
int start_sec, end_sec, first_value, fret, suspect_tao_end= 0;
char profile_name[80];
int start_lba= 0;
struct burn_drive *drive;
struct burn_drive_info *dinfo;
char *data= NULL, *data_pt;
@ -3039,16 +3040,16 @@ abort_check:;
if(sector_size == read_chunk && from_lba % read_chunk == 0
&& !skip_reading) {
if(Sectorbitmap_is_set(job->sector_map, (off_t) ((i + from_lba) / sector_size), 0)){
if(Sectorbitmap_is_set(job->sector_map, (i + from_lba) / sector_size, 0)){
quality= Xorriso_read_quality_valiD;
skip_reading= 1;
}
} else if(sector_size > 0 && !skip_reading) {
start_sec= (i + from_lba) / sector_size;
end_sec= (i + to_read + from_lba) / sector_size;
first_value= Sectorbitmap_is_set(job->sector_map, (off_t) start_sec, 0);
first_value= Sectorbitmap_is_set(job->sector_map, start_sec, 0);
for(j= start_sec; j < end_sec; j++)
if(Sectorbitmap_is_set(job->sector_map, (off_t) j, 0) != first_value)
if(Sectorbitmap_is_set(job->sector_map, j, 0) != first_value)
break;
to_read= j * sector_size - i - from_lba;
skip_reading= !!first_value;
@ -3069,7 +3070,7 @@ abort_check:;
goto ex;
data_pt= state.chunk[state.chunk_w_idx];
}
ret= burn_read_data(drive, ((off_t) (i + from_lba)) * (off_t) 2048,
ret= burn_read_data(drive, (i + from_lba) * (off_t) 2048,
data_pt, to_read * (off_t) 2048, &data_count,
(4 * !retry) | (16 * !!suspect_tao_end));
post_read_time= Sfile_microtime(0);
@ -3086,7 +3087,8 @@ abort_check:;
if(ret <= 0)
goto ex;
}
ret= Xorriso__add_spot(&state, i + from_lba, data_count / 2048,
ret= Xorriso__add_spot(&state, i + from_lba,
data_count / (off_t) 2048,
Xorriso_read_quality_partiaL, 0);
if(ret <= 0)
goto ex;
@ -3150,7 +3152,7 @@ abort_check:;
}
if(write_amount > 0) {
if(job->data_to_fd >= 0) {
seek_adr= ((off_t) (i + from_lba)) * (off_t) 2048 +
seek_adr= (i + from_lba) * (off_t) 2048 +
job->data_to_skip + job->data_to_offset;
if(strcmp(job->data_to_path, "-") != 0) {
ret= lseek(job->data_to_fd, seek_adr, SEEK_SET);
@ -3199,8 +3201,9 @@ failed_to_write:;
/* <<< for calibration of quality */
if(total_count > 0) {
sprintf(xorriso->info_text, "Xorriso_check_interval: %.1f s / %d = %f",
total_time_diff, total_count, total_time_diff / total_count);
sprintf(xorriso->info_text, "Xorriso_check_interval: %.1f s / %.f = %f",
total_time_diff, (double) total_count,
(double) total_time_diff / total_count);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
}
@ -3222,8 +3225,9 @@ failed_to_write:;
state.md5_spot_lba= state.next_tag;
}
if(state.md5_spot_value != Xorriso_read_quality_untesteD) {
ret= Xorriso__add_spot(&state, state.md5_start,
state.md5_spot_lba - state.md5_start, state.md5_spot_value, 0);
ret= Xorriso__add_spot(&state, (off_t) state.md5_start,
(off_t) (state.md5_spot_lba - state.md5_start),
state.md5_spot_value, 0);
if(ret <= 0)
goto ex;
}
@ -3233,8 +3237,8 @@ ex:;
if(async_md5) {
Xorriso__end_slave_md5(&state, 10000, 0);
sprintf(xorriso->info_text,
"async_chunks=%d , chunk_size=%ds , w_sleeps: %.f , r_sleeps: %.f",
state.num_chunks, read_chunk, (double) state.w_sleeps,
"async_chunks=%d , chunk_size=%.fs , w_sleeps: %.f , r_sleeps: %.f",
state.num_chunks, (double) read_chunk, (double) state.w_sleeps,
(double) state.r_sleeps);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
if(state.chunk != NULL)
@ -3255,12 +3259,13 @@ ex:;
int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist,
struct CheckmediajoB *job, int flag)
{
int media_blocks= 0, read_chunk= 32, ret, mode;
int num_sessions, num_tracks, declare_untested= 0, md5_start;
int os_errno, j, track_blocks;
int read_capacity= -1, end_lba, hret, quality, profile_no;
int ret, mode, os_errno, j;
int num_sessions, num_tracks, declare_untested= 0;
int hret, quality, profile_no;
off_t i, blocks, last_track_end= -1, count, track_lba, start_lba= 0;
int track_bad_claim= 0;
off_t media_blocks= 0, read_chunk= 32, md5_start, track_blocks;
off_t read_capacity= -1, end_lba;
off_t track_bad_claim= 0;
char *toc_info= NULL, profile_name[80], msg[160];
struct burn_drive *drive;
struct burn_drive_info *dinfo;
@ -3338,7 +3343,7 @@ no_readable_medium:;
}
}
ret= burn_get_read_capacity(drive, &read_capacity, 0);
ret= burn_get_read_capacity_v2(drive, &read_capacity, 0);
if(ret <= 0)
read_capacity= -1;
if(s == BURN_DISC_BLANK && read_capacity <= 0)
@ -3435,7 +3440,7 @@ no_tracks_found:;
if(track_blocks <= 0)
continue;
if(declare_untested) {
ret= Spotlist_add_item(*spotlist, track_lba, (off_t) track_blocks,
ret= Spotlist_add_item(*spotlist, track_lba, track_blocks,
Xorriso_read_quality_untesteD, 0);
if(ret <= 0)
goto ex;
@ -3460,8 +3465,8 @@ no_tracks_found:;
quality= Xorriso_read_quality_tao_enD;
else
quality= Xorriso_read_quality_unreadablE;
ret= Spotlist_add_item(*spotlist, (off_t) read_capacity,
(off_t) (track_bad_claim - read_capacity), quality, 0);
ret= Spotlist_add_item(*spotlist, read_capacity,
(track_bad_claim - read_capacity), quality, 0);
if(ret <= 0)
goto ex;
}
@ -3480,7 +3485,7 @@ no_tracks_found:;
*/
track_lba= isoburn_get_attached_start_lba(drive);
if(track_lba >= 0) {
ret= isoburn_read_iso_head(drive, (int) track_lba, &track_blocks, NULL, 0);
ret= isoburn_read_iso_head_v2(drive, track_lba, &track_blocks, NULL, 0);
if(ret > 0) {
blocks= media_blocks= track_lba + track_blocks;
}
@ -3532,7 +3537,7 @@ ex:;
end_lba= start_lba + blocks;
}
if(read_capacity > end_lba) {
hret= Spotlist_add_item(*spotlist, (off_t) end_lba, (off_t) (read_capacity - end_lba),
hret= Spotlist_add_item(*spotlist, end_lba, (read_capacity - end_lba),
Xorriso_read_quality_untesteD, 0);
if(hret < ret)
ret= hret;
@ -3540,11 +3545,11 @@ ex:;
}
if(ret > 0)
ret= Xorriso_update_in_sector_map(xorriso, *spotlist, (off_t) read_chunk,
ret= Xorriso_update_in_sector_map(xorriso, *spotlist, read_chunk,
job, 0);
if(ret > 0) {
ret= Xorriso_spotlist_to_sectormap(xorriso, *spotlist, (off_t) read_chunk,
ret= Xorriso_spotlist_to_sectormap(xorriso, *spotlist, read_chunk,
&(job->sector_map), 2);
if(ret > 0 && job->sector_map_path[0]) {
ret= Sectorbitmap_to_file(job->sector_map, job->sector_map_path, toc_info,

View File

@ -25,8 +25,8 @@ int Xorriso_check_md5_range(struct XorrisO *xorriso, off_t start_lba,
int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist,
struct CheckmediajoB *job,
int from_lba, int block_count, int read_chunk,
int md5_start, int flag);
off_t from_lba, off_t block_count, off_t read_chunk,
off_t md5_start, int flag);
int Xorriso_get_drive_handles(struct XorrisO *xorriso,
struct burn_drive_info **dinfo,

View File

@ -2507,7 +2507,7 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node,
job->data_to_skip= data_to_skip;
data_to_skip= 0;
file_processed_bytes+= count * (off_t) 2048;
ret= Xorriso_check_interval(xorriso, spotlist, job, (int) lba, (int) count, read_chunk,
ret= Xorriso_check_interval(xorriso, spotlist, job, lba, count, read_chunk,
0, (flag & 2));
if(ret <= 0)
goto ex;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2024.03.18.084408"
#define Xorriso_timestamP "2024.03.18.173836"