From 551823d96f50119309e8c952423e3080b3aca921 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 12 Apr 2014 13:02:23 +0000 Subject: [PATCH] New -report_system_area form "gpt_crc_of:" --- libisoburn/trunk/xorriso/iso_img.c | 36 +++++++++++ libisoburn/trunk/xorriso/xorriso.1 | 9 ++- libisoburn/trunk/xorriso/xorriso.info | 65 +++++++++++--------- libisoburn/trunk/xorriso/xorriso.texi | 9 ++- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 86 insertions(+), 35 deletions(-) diff --git a/libisoburn/trunk/xorriso/iso_img.c b/libisoburn/trunk/xorriso/iso_img.c index 9e004c94..59a211ea 100644 --- a/libisoburn/trunk/xorriso/iso_img.c +++ b/libisoburn/trunk/xorriso/iso_img.c @@ -1391,6 +1391,38 @@ hint_revoke:; } +int Xorriso_gpt_crc(struct XorrisO *xorriso, char *path, int flag) +{ + int ret; + char *buf = NULL; + FILE *fp = NULL; + uint32_t crc; + + Xorriso_alloc_meM(buf, char, 32 * 1024); + + ret= Xorriso_afile_fopen(xorriso, path, "rb", &fp, 0); + if(ret <= 0) + goto ex; + ret= fread(buf, 1, 32 * 1024, fp); + if(ret == 0) { + strcpy(xorriso->info_text, + "No bytes readable for GPT CRC from "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + ret= 0; goto ex; + } + crc= iso_crc32_gpt((unsigned char *) buf, ret, 0); + sprintf(xorriso->result_line, "0x%8.8x\n", (unsigned int) crc); + Xorriso_result(xorriso, 0); + ret= 1; +ex:; + if(fp != NULL && fp != stdin) + fclose(fp); + Xorriso_free_meM(buf); + return(ret); +} + + int Xorriso_report_system_area(struct XorrisO *xorriso, char *form, int flag) { int ret; @@ -1404,6 +1436,9 @@ int Xorriso_report_system_area(struct XorrisO *xorriso, char *form, int flag) if(ret <= 0) goto ex; ret= iso_image_report_system_area(image, &text, 0); + } else if(strncmp(form, "gpt_crc_of:", 11) == 0) { + ret = Xorriso_gpt_crc(xorriso, form + 11, 0); + goto ex; } else { strcpy(xorriso->info_text, "-report_system_area form parameter not recognized: "); @@ -1440,3 +1475,4 @@ ex:; free(text); return(ret); } + diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index dad10b73..dbc15b73 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -9,7 +9,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH XORRISO 1 "Version 1.3.7, Apr 11, 2014" +.TH XORRISO 1 "Version 1.3.7, Apr 12, 2014" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -3741,7 +3741,7 @@ The timestamps get not automatically propagated from loaded image to newly written image. The ones for new images may be set by command \-volume_date. See there for the meaning of the particular timestamps. .TP -\fB\-report_system_area\fR "plain"|"help" +\fB\-report_system_area\fR "plain"|"help"|"gpt_crc_of:"disk_path With parameter "plain" print a report about the information found in the System Area of the loaded ISO image. The report consists of zero to many lines with a header text, a colon, and information text. @@ -3749,6 +3749,11 @@ many lines with a header text, a colon, and information text. With parameter "help" print a text which explains the meaning of the lines. You probably will have to look for more documentation which explains the technical properties of the mentioned boot facilities. +.br +With parameter "gpt_crc_of:"disk_path read up to 32 KiB from the disk file +with the path given after the colon. Compute the GPT compliant CRC number +and print it to the result channel. The number is shown like "0x690fd979". +The special disk_path "\-" causes reading from standard input. .TP .B Navigation in ISO image and disk filesystem: .TP diff --git a/libisoburn/trunk/xorriso/xorriso.info b/libisoburn/trunk/xorriso/xorriso.info index 0fd3015a..c42dcfad 100644 --- a/libisoburn/trunk/xorriso/xorriso.info +++ b/libisoburn/trunk/xorriso/xorriso.info @@ -3265,7 +3265,7 @@ File: xorriso.info, Node: Inquiry, Next: Navigate, Prev: DialogCtl, Up: Comm The ones for new images may be set by command -volume_date. See there for the meaning of the particular timestamps. --report_system_area "plain"|"help" +-report_system_area "plain"|"help"|"gpt_crc_of:"disk_path With parameter "plain" print a report about the information found in the System Area of the loaded ISO image. The report consists of zero to many lines with a header text, a colon, and information @@ -3274,6 +3274,11 @@ File: xorriso.info, Node: Inquiry, Next: Navigate, Prev: DialogCtl, Up: Comm the lines. You probably will have to look for more documentation which explains the technical properties of the mentioned boot facilities. + With parameter "gpt_crc_of:"disk_path read up to 32 KiB from the + disk file with the path given after the colon. Compute the GPT + compliant CRC number and print it to the result channel. The + number is shown like "0x690fd979". The special disk_path "-" + causes reading from standard input.  File: xorriso.info, Node: Navigate, Next: Verify, Prev: Inquiry, Up: Commands @@ -5485,34 +5490,34 @@ Node: Charset150178 Node: Exception153493 Node: DialogCtl159613 Node: Inquiry162211 -Node: Navigate169011 -Node: Verify177309 -Node: Restore186573 -Node: Emulation193660 -Node: Scripting204048 -Node: Frontend211819 -Node: Examples221426 -Node: ExDevices222604 -Node: ExCreate223270 -Node: ExDialog224555 -Node: ExGrowing225820 -Node: ExModifying226625 -Node: ExBootable227129 -Node: ExCharset227681 -Node: ExPseudo228573 -Node: ExCdrecord229471 -Node: ExMkisofs229788 -Node: ExGrowisofs231128 -Node: ExException232263 -Node: ExTime232717 -Node: ExIncBackup233176 -Node: ExRestore237156 -Node: ExRecovery238089 -Node: Files238659 -Node: Seealso239958 -Node: Bugreport240681 -Node: Legal241262 -Node: CommandIdx242273 -Node: ConceptIdx259008 +Node: Navigate169346 +Node: Verify177644 +Node: Restore186908 +Node: Emulation193995 +Node: Scripting204383 +Node: Frontend212154 +Node: Examples221761 +Node: ExDevices222939 +Node: ExCreate223605 +Node: ExDialog224890 +Node: ExGrowing226155 +Node: ExModifying226960 +Node: ExBootable227464 +Node: ExCharset228016 +Node: ExPseudo228908 +Node: ExCdrecord229806 +Node: ExMkisofs230123 +Node: ExGrowisofs231463 +Node: ExException232598 +Node: ExTime233052 +Node: ExIncBackup233511 +Node: ExRestore237491 +Node: ExRecovery238424 +Node: Files238994 +Node: Seealso240293 +Node: Bugreport241016 +Node: Legal241597 +Node: CommandIdx242608 +Node: ConceptIdx259343  End Tag Table diff --git a/libisoburn/trunk/xorriso/xorriso.texi b/libisoburn/trunk/xorriso/xorriso.texi index 0fe1b0ec..31252f3f 100644 --- a/libisoburn/trunk/xorriso/xorriso.texi +++ b/libisoburn/trunk/xorriso/xorriso.texi @@ -50,7 +50,7 @@ @c man .\" First parameter, NAME, should be all caps @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 .TH XORRISO 1 "Version 1.3.7, Apr 11, 2014" +@c man .TH XORRISO 1 "Version 1.3.7, Apr 12, 2014" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -4354,7 +4354,7 @@ The timestamps get not automatically propagated from loaded image to newly written image. The ones for new images may be set by command -volume_date. See there for the meaning of the particular timestamps. @c man .TP -@item -report_system_area "plain"|"help" +@item -report_system_area "plain"|"help"|"gpt_crc_of:"disk_path @kindex -report_system_area show MBR, GPT, and alike @cindex Image, show MBR, GPT, and alike, -pvd_info With parameter "plain" print a report about the information found in @@ -4364,6 +4364,11 @@ many lines with a header text, a colon, and information text. With parameter "help" print a text which explains the meaning of the lines. You probably will have to look for more documentation which explains the technical properties of the mentioned boot facilities. +@* +With parameter "gpt_crc_of:"disk_path read up to 32 KiB from the disk file +with the path given after the colon. Compute the GPT compliant CRC number +and print it to the result channel. The number is shown like "0x690fd979". +The special disk_path "-" causes reading from standard input. @end table @c man .TP @c man .B Navigation in ISO image and disk filesystem: diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 06a83e4b..171bf8d2 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2014.04.11.161139" +#define Xorriso_timestamP "2014.04.12.130150"