Made Xorriso__start_end_lbas() ready for long block adresses
This commit is contained in:
parent
ec7ab520ba
commit
698bee2621
@ -3055,9 +3055,8 @@ return:
|
|||||||
3 = immediate decision : does match
|
3 = immediate decision : does match
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int value=0, ret, start_lba, bless_idx, size_mode;
|
int value=0, ret, start_lba, bless_idx, size_mode, lba_count, i, mask;
|
||||||
off_t range_lba, end_lba;
|
off_t range_lba, end_lba, *file_end_lbas= NULL, *file_start_lbas= NULL;
|
||||||
int lba_count, *file_end_lbas= NULL, *file_start_lbas= NULL, i, mask;
|
|
||||||
void *arg1, *arg2;
|
void *arg1, *arg2;
|
||||||
char ft, *decision, md5[16], bless_code[17];
|
char ft, *decision, md5[16], bless_code[17];
|
||||||
regmatch_t name_match;
|
regmatch_t name_match;
|
||||||
|
@ -2232,8 +2232,8 @@ int Xorriso__get_file_size(IsoNode *node, off_t *size, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Xorriso__start_end_lbas(IsoNode *node,
|
int Xorriso__start_end_lbas(IsoNode *node, int *lba_count,
|
||||||
int *lba_count, int **start_lbas, int **end_lbas,
|
off_t **start_lbas, off_t **end_lbas,
|
||||||
off_t **section_sizes, off_t *size, int flag)
|
off_t **section_sizes, off_t *size, int flag)
|
||||||
{
|
{
|
||||||
int section_count= 0, ret, i;
|
int section_count= 0, ret, i;
|
||||||
@ -2252,8 +2252,8 @@ int Xorriso__start_end_lbas(IsoNode *node,
|
|||||||
{ret= -1; goto ex;}
|
{ret= -1; goto ex;}
|
||||||
if(ret != 1 || section_count <= 0)
|
if(ret != 1 || section_count <= 0)
|
||||||
{ret= 0; goto ex;}
|
{ret= 0; goto ex;}
|
||||||
*start_lbas= calloc(section_count, sizeof(int));
|
*start_lbas= calloc(section_count, sizeof(off_t));
|
||||||
*end_lbas= calloc(section_count, sizeof(int));
|
*end_lbas= calloc(section_count, sizeof(off_t));
|
||||||
*section_sizes= calloc(section_count, sizeof(off_t));
|
*section_sizes= calloc(section_count, sizeof(off_t));
|
||||||
if(*start_lbas == NULL || *end_lbas == NULL || *section_sizes == NULL)
|
if(*start_lbas == NULL || *end_lbas == NULL || *section_sizes == NULL)
|
||||||
{ret= -1; goto ex;}
|
{ret= -1; goto ex;}
|
||||||
@ -2284,8 +2284,8 @@ ex:;
|
|||||||
int Xorriso__file_start_lba(IsoNode *node,
|
int Xorriso__file_start_lba(IsoNode *node,
|
||||||
int *lba, int flag)
|
int *lba, int flag)
|
||||||
{
|
{
|
||||||
int *start_lbas= NULL, *end_lbas= NULL, lba_count= 0, i, ret;
|
int lba_count= 0, i, ret;
|
||||||
off_t size, *section_sizes= NULL;
|
off_t size, *section_sizes= NULL, *start_lbas= NULL, *end_lbas= NULL;
|
||||||
|
|
||||||
*lba= -1;
|
*lba= -1;
|
||||||
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
|
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,
|
off_t *damage_start, off_t *damage_end,
|
||||||
int flag)
|
int flag)
|
||||||
{
|
{
|
||||||
int *start_lbas= NULL, *end_lbas= NULL, lba_count= 0, sect;
|
int lba_count= 0, sect, ret;
|
||||||
int ret;
|
off_t i, sectors, sector_size, *start_lbas= NULL, *end_lbas= NULL;
|
||||||
off_t i, sectors, sector_size;
|
|
||||||
off_t sect_base= 0, size= 0, byte, *section_sizes= NULL;
|
off_t sect_base= 0, size= 0, byte, *section_sizes= NULL;
|
||||||
struct SectorbitmaP *map;
|
struct SectorbitmaP *map;
|
||||||
|
|
||||||
@ -2532,8 +2531,7 @@ int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
|
|||||||
*damage_end= byte + (off_t) 2048;
|
*damage_end= byte + (off_t) 2048;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sect_base+= ((off_t) 2048) *
|
sect_base+= ((off_t) 2048) * (end_lbas[sect] - start_lbas[sect] + 1);
|
||||||
((off_t) (end_lbas[sect] - start_lbas[sect] + 1));
|
|
||||||
}
|
}
|
||||||
if(*damage_end > size)
|
if(*damage_end > size)
|
||||||
*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,
|
int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path,
|
||||||
IsoNode *node, uint32_t *last_block, int flag)
|
IsoNode *node, uint32_t *last_block, int flag)
|
||||||
{
|
{
|
||||||
int ret, *start_lbas= NULL, *end_lbas= NULL, lba_count, i;
|
int ret, lba_count, i;
|
||||||
off_t size, *section_sizes= NULL;
|
off_t size, *section_sizes= NULL, *start_lbas= NULL, *end_lbas= NULL;
|
||||||
|
|
||||||
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
|
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
|
||||||
§ion_sizes, &size, 0);
|
§ion_sizes, &size, 0);
|
||||||
@ -2570,12 +2568,13 @@ int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path,
|
|||||||
if(flag & 1)
|
if(flag & 1)
|
||||||
size= section_sizes[i];
|
size= section_sizes[i];
|
||||||
if(flag & 2) {
|
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];
|
*last_block= end_lbas[i];
|
||||||
} else {
|
} else {
|
||||||
sprintf(xorriso->result_line,
|
sprintf(xorriso->result_line,
|
||||||
"File data lba: %2d , %8d , %8d , %8.f , ",
|
"File data lba: %2d , %8.f , %8.f , %8.f , ",
|
||||||
i, start_lbas[i], end_lbas[i] + 1 - start_lbas[i], (double) size);
|
i, (double) start_lbas[i],
|
||||||
|
(double) (end_lbas[i] + 1 - start_lbas[i]), (double) size);
|
||||||
Text_shellsafe(show_path, xorriso->result_line, 1);
|
Text_shellsafe(show_path, xorriso->result_line, 1);
|
||||||
strcat(xorriso->result_line, "\n");
|
strcat(xorriso->result_line, "\n");
|
||||||
Xorriso_result(xorriso, 0);
|
Xorriso_result(xorriso, 0);
|
||||||
|
@ -73,8 +73,8 @@ int Xorriso_obtain_pattern_files_i(
|
|||||||
|
|
||||||
int Xorriso__get_file_size(IsoNode *node, off_t *size, int flag);
|
int Xorriso__get_file_size(IsoNode *node, off_t *size, int flag);
|
||||||
|
|
||||||
int Xorriso__start_end_lbas(IsoNode *node,
|
int Xorriso__start_end_lbas(IsoNode *node, int *lba_count,
|
||||||
int *lba_count, int **start_lbas, int **end_lbas,
|
off_t **start_lbas, off_t **end_lbas,
|
||||||
off_t **section_sizes, off_t *size, int flag);
|
off_t **section_sizes, off_t *size, int flag);
|
||||||
|
|
||||||
int Xorriso__file_start_lba(IsoNode *node,
|
int Xorriso__file_start_lba(IsoNode *node,
|
||||||
|
@ -2417,9 +2417,9 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node,
|
|||||||
off_t img_offset, off_t disk_offset,
|
off_t img_offset, off_t disk_offset,
|
||||||
off_t bytes, int flag)
|
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;
|
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;
|
int data_to_skip= 0;
|
||||||
off_t indev_blocks;
|
off_t indev_blocks;
|
||||||
off_t size= 0, file_base_bytes= 0, file_processed_bytes= 0, img_adr;
|
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) {
|
if(flag & 1) {
|
||||||
lba_count= 1;
|
lba_count= 1;
|
||||||
Xorriso_alloc_meM(start_lbas, int, 1);
|
Xorriso_alloc_meM(start_lbas, off_t, 1);
|
||||||
Xorriso_alloc_meM(end_lbas, int, 1);
|
Xorriso_alloc_meM(end_lbas, off_t, 1);
|
||||||
Xorriso_alloc_meM(section_sizes, off_t, 1);
|
Xorriso_alloc_meM(section_sizes, off_t, 1);
|
||||||
start_lbas[0]= 0;
|
start_lbas[0]= 0;
|
||||||
ret= Xorriso_obtain_indev_readsize(xorriso, &indev_blocks, 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;
|
end_lbas[0]= indev_blocks - 1;
|
||||||
else
|
else
|
||||||
end_lbas[0]= 0x7ffffffe;
|
end_lbas[0]= 0x7ffffffffffffffe;
|
||||||
size= ((off_t) end_lbas[0]) * 2048;
|
size= end_lbas[0] * (off_t) 2048;
|
||||||
section_sizes[0]= size;
|
section_sizes[0]= size;
|
||||||
} else {
|
} else {
|
||||||
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
|
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2024.03.21.150655"
|
#define Xorriso_timestamP "2024.03.21.165234"
|
||||||
|
Loading…
Reference in New Issue
Block a user