Made Xorriso__start_end_lbas() ready for long block adresses

This commit is contained in:
Thomas Schmitt 2024-03-21 17:52:51 +01:00
parent ec7ab520ba
commit 698bee2621
5 changed files with 27 additions and 29 deletions

View File

@ -3055,9 +3055,8 @@ return:
3 = immediate decision : does match
*/
{
int value=0, ret, start_lba, bless_idx, size_mode;
off_t range_lba, end_lba;
int lba_count, *file_end_lbas= NULL, *file_start_lbas= NULL, i, mask;
int value=0, ret, start_lba, bless_idx, size_mode, lba_count, i, mask;
off_t range_lba, end_lba, *file_end_lbas= NULL, *file_start_lbas= NULL;
void *arg1, *arg2;
char ft, *decision, md5[16], bless_code[17];
regmatch_t name_match;

View File

@ -2232,8 +2232,8 @@ int Xorriso__get_file_size(IsoNode *node, off_t *size, int flag)
}
int Xorriso__start_end_lbas(IsoNode *node,
int *lba_count, int **start_lbas, int **end_lbas,
int Xorriso__start_end_lbas(IsoNode *node, int *lba_count,
off_t **start_lbas, off_t **end_lbas,
off_t **section_sizes, off_t *size, int flag)
{
int section_count= 0, ret, i;
@ -2252,8 +2252,8 @@ int Xorriso__start_end_lbas(IsoNode *node,
{ret= -1; goto ex;}
if(ret != 1 || section_count <= 0)
{ret= 0; goto ex;}
*start_lbas= calloc(section_count, sizeof(int));
*end_lbas= calloc(section_count, sizeof(int));
*start_lbas= calloc(section_count, sizeof(off_t));
*end_lbas= calloc(section_count, sizeof(off_t));
*section_sizes= calloc(section_count, sizeof(off_t));
if(*start_lbas == NULL || *end_lbas == NULL || *section_sizes == NULL)
{ret= -1; goto ex;}
@ -2284,8 +2284,8 @@ ex:;
int Xorriso__file_start_lba(IsoNode *node,
int *lba, int flag)
{
int *start_lbas= NULL, *end_lbas= NULL, lba_count= 0, i, ret;
off_t size, *section_sizes= NULL;
int lba_count= 0, i, ret;
off_t size, *section_sizes= NULL, *start_lbas= NULL, *end_lbas= NULL;
*lba= -1;
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
@ -2503,9 +2503,8 @@ int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
off_t *damage_start, off_t *damage_end,
int flag)
{
int *start_lbas= NULL, *end_lbas= NULL, lba_count= 0, sect;
int ret;
off_t i, sectors, sector_size;
int lba_count= 0, sect, ret;
off_t i, sectors, sector_size, *start_lbas= NULL, *end_lbas= NULL;
off_t sect_base= 0, size= 0, byte, *section_sizes= NULL;
struct SectorbitmaP *map;
@ -2532,8 +2531,7 @@ int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
*damage_end= byte + (off_t) 2048;
}
}
sect_base+= ((off_t) 2048) *
((off_t) (end_lbas[sect] - start_lbas[sect] + 1));
sect_base+= ((off_t) 2048) * (end_lbas[sect] - start_lbas[sect] + 1);
}
if(*damage_end > size)
*damage_end= size;
@ -2555,8 +2553,8 @@ int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path,
IsoNode *node, uint32_t *last_block, int flag)
{
int ret, *start_lbas= NULL, *end_lbas= NULL, lba_count, i;
off_t size, *section_sizes= NULL;
int ret, lba_count, i;
off_t size, *section_sizes= NULL, *start_lbas= NULL, *end_lbas= NULL;
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
&section_sizes, &size, 0);
@ -2570,12 +2568,13 @@ int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path,
if(flag & 1)
size= section_sizes[i];
if(flag & 2) {
if(end_lbas[i] > 0 && (uint32_t) end_lbas[i] > *last_block)
if(end_lbas[i] > 0 && end_lbas[i] > (off_t) *last_block)
*last_block= end_lbas[i];
} else {
sprintf(xorriso->result_line,
"File data lba: %2d , %8d , %8d , %8.f , ",
i, start_lbas[i], end_lbas[i] + 1 - start_lbas[i], (double) size);
"File data lba: %2d , %8.f , %8.f , %8.f , ",
i, (double) start_lbas[i],
(double) (end_lbas[i] + 1 - start_lbas[i]), (double) size);
Text_shellsafe(show_path, xorriso->result_line, 1);
strcat(xorriso->result_line, "\n");
Xorriso_result(xorriso, 0);

View File

@ -73,8 +73,8 @@ int Xorriso_obtain_pattern_files_i(
int Xorriso__get_file_size(IsoNode *node, off_t *size, int flag);
int Xorriso__start_end_lbas(IsoNode *node,
int *lba_count, int **start_lbas, int **end_lbas,
int Xorriso__start_end_lbas(IsoNode *node, int *lba_count,
off_t **start_lbas, off_t **end_lbas,
off_t **section_sizes, off_t *size, int flag);
int Xorriso__file_start_lba(IsoNode *node,

View File

@ -2417,9 +2417,9 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node,
off_t img_offset, off_t disk_offset,
off_t bytes, int flag)
{
int ret, i, lba_count= 0, *start_lbas= NULL, *end_lbas= NULL, read_chunk= 16;
int ret, i, lba_count= 0, read_chunk= 16;
int quality, bad_extract= 0;
off_t lba, count, blocks, spot;
off_t lba, count, blocks, spot, *start_lbas= NULL, *end_lbas= NULL;
int data_to_skip= 0;
off_t indev_blocks;
off_t size= 0, file_base_bytes= 0, file_processed_bytes= 0, img_adr;
@ -2433,16 +2433,16 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node,
if(flag & 1) {
lba_count= 1;
Xorriso_alloc_meM(start_lbas, int, 1);
Xorriso_alloc_meM(end_lbas, int, 1);
Xorriso_alloc_meM(start_lbas, off_t, 1);
Xorriso_alloc_meM(end_lbas, off_t, 1);
Xorriso_alloc_meM(section_sizes, off_t, 1);
start_lbas[0]= 0;
ret= Xorriso_obtain_indev_readsize(xorriso, &indev_blocks, 0);
if(ret > 0 && indev_blocks <= 0x7ffffffe)
if(ret > 0)
end_lbas[0]= indev_blocks - 1;
else
end_lbas[0]= 0x7ffffffe;
size= ((off_t) end_lbas[0]) * 2048;
end_lbas[0]= 0x7ffffffffffffffe;
size= end_lbas[0] * (off_t) 2048;
section_sizes[0]= size;
} else {
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,

View File

@ -1 +1 @@
#define Xorriso_timestamP "2024.03.21.150655"
#define Xorriso_timestamP "2024.03.21.165234"