New -find action report_sections
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
|
||||
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
||||
|
||||
Copyright 2007-2012 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2007-2014 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
|
||||
@ -133,7 +133,7 @@ bonked_root:;
|
||||
}
|
||||
dir= iso_node_get_parent(node);
|
||||
|
||||
/* >>> Get absolute path of dir as eff_path, to avoid link problems */;
|
||||
/* >>> Get absolute path of node as eff_path, to avoid link problems */;
|
||||
|
||||
}
|
||||
if(flag & 4) {
|
||||
@ -156,7 +156,6 @@ bonked_root:;
|
||||
goto bonked_root;
|
||||
*cpt= 0;
|
||||
is_dir= 1;
|
||||
|
||||
continue;
|
||||
}
|
||||
is_dir= 0;
|
||||
@ -2041,13 +2040,14 @@ ex:;
|
||||
|
||||
int Xorriso__start_end_lbas(IsoNode *node,
|
||||
int *lba_count, int **start_lbas, int **end_lbas,
|
||||
off_t *size, int flag)
|
||||
off_t **section_sizes, off_t *size, int flag)
|
||||
{
|
||||
int section_count= 0, ret, i;
|
||||
struct iso_file_section *sections= NULL;
|
||||
|
||||
*lba_count= 0;
|
||||
*start_lbas= *end_lbas= NULL;
|
||||
*section_sizes= NULL;
|
||||
*size= 0;
|
||||
if(!LIBISO_ISREG(node))
|
||||
return(0);
|
||||
@ -2060,13 +2060,15 @@ int Xorriso__start_end_lbas(IsoNode *node,
|
||||
{ret= 0; goto ex;}
|
||||
*start_lbas= calloc(section_count, sizeof(int));
|
||||
*end_lbas= calloc(section_count, sizeof(int));
|
||||
if(*start_lbas == NULL || *end_lbas == NULL)
|
||||
*section_sizes= calloc(section_count, sizeof(off_t));
|
||||
if(*start_lbas == NULL || *end_lbas == NULL || *section_sizes == NULL)
|
||||
{ret= -1; goto ex;}
|
||||
for(i= 0; i < section_count; i++) {
|
||||
(*start_lbas)[i]= sections[i].block;
|
||||
(*end_lbas)[i]= sections[i].block + sections[i].size / 2048 - 1;
|
||||
if(sections[i].size % 2048)
|
||||
(*end_lbas)[i]++;
|
||||
(*section_sizes)[i]= sections[i].size;
|
||||
}
|
||||
*lba_count= section_count;
|
||||
ret= 1;
|
||||
@ -2089,11 +2091,11 @@ 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;
|
||||
off_t size, *section_sizes= NULL;
|
||||
|
||||
*lba= -1;
|
||||
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
|
||||
&size, 0);
|
||||
§ion_sizes, &size, 0);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
for(i= 0; i < lba_count; i++) {
|
||||
@ -2104,6 +2106,8 @@ int Xorriso__file_start_lba(IsoNode *node,
|
||||
free((char *) start_lbas);
|
||||
if(end_lbas != NULL)
|
||||
free((char *) end_lbas);
|
||||
if(section_sizes != NULL)
|
||||
free((char *) section_sizes);
|
||||
if(*lba < 0)
|
||||
return(0);
|
||||
return(1);
|
||||
@ -2291,7 +2295,7 @@ int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
|
||||
{
|
||||
int *start_lbas= NULL, *end_lbas= NULL, lba_count= 0, sect;
|
||||
int i, sectors, sector_size, ret;
|
||||
off_t sect_base= 0, size= 0, byte;
|
||||
off_t sect_base= 0, size= 0, byte, *section_sizes= NULL;
|
||||
struct SectorbitmaP *map;
|
||||
|
||||
*damage_start= *damage_end= -1;
|
||||
@ -2302,7 +2306,7 @@ int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
|
||||
sector_size/= 2048;
|
||||
|
||||
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
|
||||
&size, 0);
|
||||
§ion_sizes, &size, 0);
|
||||
if(ret <= 0) {
|
||||
Xorriso_process_msg_queues(xorriso, 0);
|
||||
return(ret);
|
||||
@ -2326,20 +2330,24 @@ int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
|
||||
free((char *) start_lbas);
|
||||
if(end_lbas != NULL)
|
||||
free((char *) end_lbas);
|
||||
if(section_sizes != NULL)
|
||||
free((char *) section_sizes);
|
||||
if(*damage_start < 0)
|
||||
return(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= report_sections : section size rather than total size
|
||||
*/
|
||||
int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path,
|
||||
IsoNode *node, int flag)
|
||||
{
|
||||
int ret, *start_lbas= NULL, *end_lbas= NULL, lba_count, i;
|
||||
off_t size;
|
||||
off_t size, *section_sizes= NULL;
|
||||
|
||||
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
|
||||
&size, 0);
|
||||
§ion_sizes, &size, 0);
|
||||
if(ret < 0) {
|
||||
Xorriso_process_msg_queues(xorriso, 0);
|
||||
{ret= -1; goto ex;}
|
||||
@ -2347,6 +2355,8 @@ int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path,
|
||||
if(ret == 0)
|
||||
{ret= 1; goto ex;} /* it is ok to ignore other types */
|
||||
for(i= 0; i < lba_count; i++) {
|
||||
if(flag & 1)
|
||||
size= section_sizes[i];
|
||||
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);
|
||||
@ -2360,6 +2370,8 @@ ex:;
|
||||
free((char *) start_lbas);
|
||||
if(end_lbas != NULL)
|
||||
free((char *) end_lbas);
|
||||
if(section_sizes != NULL)
|
||||
free((char *) section_sizes);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user