New -find action report_sections

This commit is contained in:
Thomas Schmitt 2014-06-13 09:03:28 +00:00
parent be012f8d45
commit f9ac68c207
10 changed files with 104 additions and 69 deletions

View File

@ -171,6 +171,7 @@ struct FindjoB {
48= get_hfs_bless 48= get_hfs_bless
49= internal: update creator, type, and blessings from persistent isofs.* 49= internal: update creator, type, and blessings from persistent isofs.*
50= print_outname namespace 50= print_outname namespace
51= report_sections
*/ */
int action; int action;
int prune; int prune;

View File

@ -2762,11 +2762,14 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
} }
ret= 1; ret= 1;
} else if(action == 50) { } else if(action == 50) { /* print_outname */
ret= Xorriso_test_outchar(xorriso, (void *) node, type, 1); ret= Xorriso_test_outchar(xorriso, (void *) node, type, 1);
if(ret <= 0) if(ret <= 0)
return(ret); return(ret);
} else if(action == 51) { /* report_sections */
ret= Xorriso_report_lba(xorriso, show_path, node, 1);
} else { /* includes : 15 in_iso */ } else { /* includes : 15 in_iso */
Xorriso_esc_filepath(xorriso, show_path, xorriso->result_line, 0); Xorriso_esc_filepath(xorriso, show_path, xorriso->result_line, 0);
strcat(xorriso->result_line, "\n"); strcat(xorriso->result_line, "\n");
@ -2841,7 +2844,7 @@ return:
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;
off_t damage_start, damage_end, size; off_t damage_start, damage_end, size, *section_sizes= NULL;
void *xinfo_dummy; void *xinfo_dummy;
IsoNode *node; IsoNode *node;
IsoStream *stream; IsoStream *stream;
@ -2928,8 +2931,8 @@ return:
value= !(start_lba >= 0); value= !(start_lba >= 0);
goto ex; goto ex;
} }
ret= Xorriso__start_end_lbas(node, &lba_count, ret= Xorriso__start_end_lbas(node, &lba_count, &file_start_lbas,
&file_start_lbas, &file_end_lbas, &size, 0); &file_end_lbas, &section_sizes, &size, 0);
if(ret <= 0) { if(ret <= 0) {
if(ret < 0) if(ret < 0)
Xorriso_process_msg_queues(xorriso, 0); Xorriso_process_msg_queues(xorriso, 0);
@ -3095,6 +3098,8 @@ ex:;
free((char *) file_start_lbas); free((char *) file_start_lbas);
if(file_end_lbas != NULL) if(file_end_lbas != NULL)
free((char *) file_end_lbas); free((char *) file_end_lbas);
if(section_sizes != NULL)
free((char *) section_sizes);
return(value); return(value);
} }
@ -3125,10 +3130,11 @@ int Xorriso_findi_headline(struct XorrisO *xorriso, struct FindjoB *job,
sprintf(xorriso->result_line, "Report layout: %8s , %8s , %8s , %s\n", sprintf(xorriso->result_line, "Report layout: %8s , %8s , %8s , %s\n",
"at byte", "Range", "Filesize", "ISO image path"); "at byte", "Range", "Filesize", "ISO image path");
Xorriso_result(xorriso, 0); Xorriso_result(xorriso, 0);
} else if(action == 22) { /* report_lba */ } else if(action == 22 || action == 51) { /* report_lba, report_sections */
sprintf(xorriso->result_line, sprintf(xorriso->result_line,
"Report layout: %2s , %8s , %8s , %8s , %s\n", "Report layout: %2s , %8s , %8s , %8s , %s\n",
"xt", "Startlba", "Blocks", "Filesize", "ISO image path"); "xt", "Startlba", "Blocks", action == 22 ? "Filesize" : "Sectsize",
"ISO image path");
Xorriso_result(xorriso, 0); Xorriso_result(xorriso, 0);
} }
return(1); return(1);

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* 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. Provided under GPL version 2 or later.
@ -133,7 +133,7 @@ bonked_root:;
} }
dir= iso_node_get_parent(node); 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) { if(flag & 4) {
@ -156,7 +156,6 @@ bonked_root:;
goto bonked_root; goto bonked_root;
*cpt= 0; *cpt= 0;
is_dir= 1; is_dir= 1;
continue; continue;
} }
is_dir= 0; is_dir= 0;
@ -2041,13 +2040,14 @@ ex:;
int Xorriso__start_end_lbas(IsoNode *node, int Xorriso__start_end_lbas(IsoNode *node,
int *lba_count, int **start_lbas, int **end_lbas, 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; int section_count= 0, ret, i;
struct iso_file_section *sections= NULL; struct iso_file_section *sections= NULL;
*lba_count= 0; *lba_count= 0;
*start_lbas= *end_lbas= NULL; *start_lbas= *end_lbas= NULL;
*section_sizes= NULL;
*size= 0; *size= 0;
if(!LIBISO_ISREG(node)) if(!LIBISO_ISREG(node))
return(0); return(0);
@ -2060,13 +2060,15 @@ int Xorriso__start_end_lbas(IsoNode *node,
{ret= 0; goto ex;} {ret= 0; goto ex;}
*start_lbas= calloc(section_count, sizeof(int)); *start_lbas= calloc(section_count, sizeof(int));
*end_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;} {ret= -1; goto ex;}
for(i= 0; i < section_count; i++) { for(i= 0; i < section_count; i++) {
(*start_lbas)[i]= sections[i].block; (*start_lbas)[i]= sections[i].block;
(*end_lbas)[i]= sections[i].block + sections[i].size / 2048 - 1; (*end_lbas)[i]= sections[i].block + sections[i].size / 2048 - 1;
if(sections[i].size % 2048) if(sections[i].size % 2048)
(*end_lbas)[i]++; (*end_lbas)[i]++;
(*section_sizes)[i]= sections[i].size;
} }
*lba_count= section_count; *lba_count= section_count;
ret= 1; ret= 1;
@ -2089,11 +2091,11 @@ 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 *start_lbas= NULL, *end_lbas= NULL, lba_count= 0, i, ret;
off_t size; off_t size, *section_sizes= 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,
&size, 0); &section_sizes, &size, 0);
if(ret <= 0) if(ret <= 0)
return(ret); return(ret);
for(i= 0; i < lba_count; i++) { for(i= 0; i < lba_count; i++) {
@ -2104,6 +2106,8 @@ int Xorriso__file_start_lba(IsoNode *node,
free((char *) start_lbas); free((char *) start_lbas);
if(end_lbas != NULL) if(end_lbas != NULL)
free((char *) end_lbas); free((char *) end_lbas);
if(section_sizes != NULL)
free((char *) section_sizes);
if(*lba < 0) if(*lba < 0)
return(0); return(0);
return(1); 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 *start_lbas= NULL, *end_lbas= NULL, lba_count= 0, sect;
int i, sectors, sector_size, ret; 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; struct SectorbitmaP *map;
*damage_start= *damage_end= -1; *damage_start= *damage_end= -1;
@ -2302,7 +2306,7 @@ int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
sector_size/= 2048; sector_size/= 2048;
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas, ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
&size, 0); &section_sizes, &size, 0);
if(ret <= 0) { if(ret <= 0) {
Xorriso_process_msg_queues(xorriso, 0); Xorriso_process_msg_queues(xorriso, 0);
return(ret); return(ret);
@ -2326,20 +2330,24 @@ int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
free((char *) start_lbas); free((char *) start_lbas);
if(end_lbas != NULL) if(end_lbas != NULL)
free((char *) end_lbas); free((char *) end_lbas);
if(section_sizes != NULL)
free((char *) section_sizes);
if(*damage_start < 0) if(*damage_start < 0)
return(0); return(0);
return(1); return(1);
} }
/* @param flag bit0= report_sections : section size rather than total size
*/
int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path, int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path,
IsoNode *node, int flag) IsoNode *node, int flag)
{ {
int ret, *start_lbas= NULL, *end_lbas= NULL, lba_count, i; 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, ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
&size, 0); &section_sizes, &size, 0);
if(ret < 0) { if(ret < 0) {
Xorriso_process_msg_queues(xorriso, 0); Xorriso_process_msg_queues(xorriso, 0);
{ret= -1; goto ex;} {ret= -1; goto ex;}
@ -2347,6 +2355,8 @@ int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path,
if(ret == 0) if(ret == 0)
{ret= 1; goto ex;} /* it is ok to ignore other types */ {ret= 1; goto ex;} /* it is ok to ignore other types */
for(i= 0; i < lba_count; i++) { for(i= 0; i < lba_count; i++) {
if(flag & 1)
size= section_sizes[i];
sprintf(xorriso->result_line, sprintf(xorriso->result_line,
"File data lba: %2d , %8d , %8d , %8.f , ", "File data lba: %2d , %8d , %8d , %8.f , ",
i, start_lbas[i], end_lbas[i] + 1 - start_lbas[i], (double) size); i, start_lbas[i], end_lbas[i] + 1 - start_lbas[i], (double) size);
@ -2360,6 +2370,8 @@ ex:;
free((char *) start_lbas); free((char *) start_lbas);
if(end_lbas != NULL) if(end_lbas != NULL)
free((char *) end_lbas); free((char *) end_lbas);
if(section_sizes != NULL)
free((char *) section_sizes);
return(ret); return(ret);
} }

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2014 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
@ -73,7 +73,7 @@ int Xorriso_obtain_pattern_files_i(
int Xorriso__start_end_lbas(IsoNode *node, int Xorriso__start_end_lbas(IsoNode *node,
int *lba_count, int **start_lbas, int **end_lbas, int *lba_count, int **start_lbas, int **end_lbas,
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,
int *lba, int flag); int *lba, int flag);

View File

@ -1217,7 +1217,8 @@ not_enough_exec_arguments:;
ret= 0; goto sorry_ex; ret= 0; goto sorry_ex;
} }
Findjob_set_action_type(job, 50, name_space, 0); Findjob_set_action_type(job, 50, name_space, 0);
} else if(strcmp(cpt, "report_sections")==0) {
Findjob_set_action_target(job, 51, NULL, 0);
} else { } else {
sprintf(xorriso->info_text, "-find -exec: unknown action "); sprintf(xorriso->info_text, "-find -exec: unknown action ");
Text_shellsafe(argv[i], xorriso->info_text, 1); Text_shellsafe(argv[i], xorriso->info_text, 1);

View File

@ -1939,6 +1939,7 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node,
int lba, count, blocks, quality, spot, bad_extract= 0; int lba, count, blocks, quality, spot, bad_extract= 0;
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;
off_t new_file_base_bytes, upto_file_bytes, start_byte= 0; off_t new_file_base_bytes, upto_file_bytes, start_byte= 0;
off_t *section_sizes = NULL;
struct SpotlisT *spotlist= NULL; struct SpotlisT *spotlist= NULL;
struct CheckmediajoB *job= NULL; struct CheckmediajoB *job= NULL;
@ -1952,8 +1953,8 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node,
ret= 0; goto ex; ret= 0; goto ex;
} }
ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas, &size, ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas,
0); &section_sizes, &size, 0);
if(ret <= 0) { if(ret <= 0) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, "File object "); sprintf(xorriso->info_text, "File object ");
@ -2058,6 +2059,8 @@ ex:;
free((char *) start_lbas); free((char *) start_lbas);
if(end_lbas != NULL) if(end_lbas != NULL)
free((char *) end_lbas); free((char *) end_lbas);
if(section_sizes != NULL)
free((char *) section_sizes);
Spotlist_destroy(&spotlist, 0); Spotlist_destroy(&spotlist, 0);
Checkmediajob_destroy(&job, 0); Checkmediajob_destroy(&job, 0);
return(ret); return(ret);

View File

@ -9,7 +9,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Version 1.3.7, May 18, 2014" .TH XORRISO 1 "Version 1.3.7, Jun 13, 2014"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -1956,8 +1956,12 @@ path of the file.
prints files which are associated to image data blocks. prints files which are associated to image data blocks.
It tells the logical block address, the block number, the byte size, It tells the logical block address, the block number, the byte size,
and the path of each file. There may be reported more than one and the path of each file. There may be reported more than one
line per file if the file is very large. In this case each line has a line per file if the file has more than one section.
different extent number in column "xt". In this case each line has a different extent number in column "xt".
.br
\fBreport_sections\fR
like report_lba but telling the byte sizes of the particular sections rather
than the overall byte size of the file.
.br .br
\fBgetfacl\fR \fBgetfacl\fR
prints access permissions in ACL text form to the result channel. prints access permissions in ACL text form to the result channel.

View File

@ -1746,8 +1746,12 @@ File: xorriso.info, Node: CmdFind, Next: Filter, Prev: Manip, Up: Commands
prints files which are associated to image data blocks. It prints files which are associated to image data blocks. It
tells the logical block address, the block number, the byte tells the logical block address, the block number, the byte
size, and the path of each file. There may be reported more size, and the path of each file. There may be reported more
than one line per file if the file is very large. In this than one line per file if the file has more than one section.
case each line has a different extent number in column "xt". In this case each line has a different extent number in
column "xt".
report_sections
like report_lba but telling the byte sizes of the particular
sections rather than the overall byte size of the file.
getfacl getfacl
prints access permissions in ACL text form to the result prints access permissions in ACL text form to the result
channel. channel.
@ -5545,43 +5549,43 @@ Node: Insert47999
Node: SetInsert58213 Node: SetInsert58213
Node: Manip67033 Node: Manip67033
Node: CmdFind76813 Node: CmdFind76813
Node: Filter94084 Node: Filter94263
Node: Writing98706 Node: Writing98885
Node: SetWrite108837 Node: SetWrite109016
Node: Bootable129543 Node: Bootable129722
Node: Jigdo146910 Node: Jigdo147089
Node: Charset151157 Node: Charset151336
Node: Exception154472 Node: Exception154651
Node: DialogCtl160592 Node: DialogCtl160771
Node: Inquiry163190 Node: Inquiry163369
Node: Navigate170621 Node: Navigate170800
Node: Verify178919 Node: Verify179098
Node: Restore188746 Node: Restore188925
Node: Emulation197350 Node: Emulation197529
Node: Scripting207738 Node: Scripting207917
Node: Frontend215509 Node: Frontend215688
Node: Examples225116 Node: Examples225295
Node: ExDevices226294 Node: ExDevices226473
Node: ExCreate226960 Node: ExCreate227139
Node: ExDialog228245 Node: ExDialog228424
Node: ExGrowing229510 Node: ExGrowing229689
Node: ExModifying230315 Node: ExModifying230494
Node: ExBootable230819 Node: ExBootable230998
Node: ExCharset231371 Node: ExCharset231550
Node: ExPseudo232263 Node: ExPseudo232442
Node: ExCdrecord233161 Node: ExCdrecord233340
Node: ExMkisofs233478 Node: ExMkisofs233657
Node: ExGrowisofs234818 Node: ExGrowisofs234997
Node: ExException235953 Node: ExException236132
Node: ExTime236407 Node: ExTime236586
Node: ExIncBackup236866 Node: ExIncBackup237045
Node: ExRestore240856 Node: ExRestore241035
Node: ExRecovery241789 Node: ExRecovery241968
Node: Files242359 Node: Files242538
Node: Seealso243658 Node: Seealso243837
Node: Bugreport244381 Node: Bugreport244560
Node: Legal244962 Node: Legal245141
Node: CommandIdx245973 Node: CommandIdx246152
Node: ConceptIdx262854 Node: ConceptIdx263033
 
End Tag Table End Tag Table

View File

@ -50,7 +50,7 @@
@c man .\" First parameter, NAME, should be all caps @c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection @c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
@c man .\" other parameters are allowed: see man(7), man(1) @c man .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISO 1 "Version 1.3.7, May 18, 2014" @c man .TH XORRISO 1 "Version 1.3.7, Jun 13, 2014"
@c man .\" Please adjust this date whenever revising the manpage. @c man .\" Please adjust this date whenever revising the manpage.
@c man .\" @c man .\"
@c man .\" Some roff macros, for reference: @c man .\" Some roff macros, for reference:
@ -2355,8 +2355,12 @@ path of the file.
prints files which are associated to image data blocks. prints files which are associated to image data blocks.
It tells the logical block address, the block number, the byte size, It tells the logical block address, the block number, the byte size,
and the path of each file. There may be reported more than one and the path of each file. There may be reported more than one
line per file if the file is very large. In this case each line has a line per file if the file has more than one section.
different extent number in column "xt". In this case each line has a different extent number in column "xt".
@*
@item report_sections
like report_lba but telling the byte sizes of the particular sections rather
than the overall byte size of the file.
@* @*
@item getfacl @item getfacl
prints access permissions in ACL text form to the result channel. prints access permissions in ACL text form to the result channel.

View File

@ -1 +1 @@
#define Xorriso_timestamP "2014.06.13.084712" #define Xorriso_timestamP "2014.06.13.090244"