Made Xorriso_adjust_session_size() ready for long block adresses

This commit is contained in:
Thomas Schmitt 2024-03-23 19:42:37 +01:00
parent 41a91dfe86
commit 2d8678a11b
2 changed files with 14 additions and 9 deletions

View File

@ -3495,8 +3495,9 @@ ex:;
int Xorriso_adjust_session_size(struct XorrisO *xorriso, int Xorriso_adjust_session_size(struct XorrisO *xorriso,
struct burn_drive *drive, struct burn_drive *drive,
char *head_buffer, char *head_buffer,
int iso_lba, int iso_size, off_t iso_lba, off_t iso_size,
int checksum_block, int session_size, int flag) int checksum_block, off_t session_size,
int flag)
{ {
int i, ret, tag_type; int i, ret, tag_type;
uint32_t pos, range_start, range_size, next_tag; uint32_t pos, range_start, range_size, next_tag;
@ -3540,6 +3541,11 @@ no_ctx:;
/* Update session PVD at iso_lba+16 to iso_size */ /* Update session PVD at iso_lba+16 to iso_size */
headpt= head_buffer + 32 * 1024; headpt= head_buffer + 32 * 1024;
if(iso_size > (off_t) 0xffffffff) {
sprintf(xorriso->info_text, "The total ISO filesystem size exceeds 8 TiB");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
}
for(i= 0; i < 4; i++) for(i= 0; i < 4; i++)
headpt[87 - i]= headpt[80 + i]= (iso_size >> (8 * i)) & 0xff; headpt[87 - i]= headpt[80 + i]= (iso_size >> (8 * i)) & 0xff;
@ -3548,7 +3554,7 @@ no_ctx:;
ret= iso_md5_compute(ctx_chng, head_buffer + 32768, 2048); ret= iso_md5_compute(ctx_chng, head_buffer + 32768, 2048);
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
ret= Xorriso_migrate_checksum_tag(xorriso, head_buffer, iso_lba, 17, ret= Xorriso_migrate_checksum_tag(xorriso, head_buffer, (int) iso_lba, 17,
checksum_block, md5_rec, checksum_block, md5_rec,
ctx_unch, ctx_chng, 0); ctx_unch, ctx_chng, 0);
if(ret == -2) if(ret == -2)
@ -3563,15 +3569,14 @@ no_ctx:;
} }
} }
ret= Xorriso_overwrite_iso_head(xorriso, drive, head_buffer, (off_t) iso_lba, ret= Xorriso_overwrite_iso_head(xorriso, drive, head_buffer, iso_lba, 0);
0);
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
if(checksum_block > 0) { if(checksum_block > 0) {
/* Verify and re-compute existing checksum tree and session tag */ /* Verify and re-compute existing checksum tree and session tag */
ret= Xorriso_refresh_ts_tags(xorriso, drive, ctx_unch, ctx_chng, ret= Xorriso_refresh_ts_tags(xorriso, drive, ctx_unch, ctx_chng,
(off_t) iso_lba, (off_t) session_size, checksum_block, 0); iso_lba, session_size, checksum_block, 0);
if(ret == -2) if(ret == -2)
goto no_ctx; goto no_ctx;
if(ret <= 0) if(ret <= 0)
@ -3793,8 +3798,8 @@ wrong_adjust:;
if(iso_size != new_size) { if(iso_size != new_size) {
ret=Xorriso_adjust_session_size(xorriso, drive, head_buffer, ret=Xorriso_adjust_session_size(xorriso, drive, head_buffer,
(int) iso_lba, (int) iso_size, iso_lba, iso_size,
checksum_block, (int) new_size, 0); checksum_block, new_size, 0);
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
} }

View File

@ -1 +1 @@
#define Xorriso_timestamP "2024.03.23.174931" #define Xorriso_timestamP "2024.03.23.183351"