From 1ddb67615908eaeb1d1d4ad6e4088825be6085a6 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 27 Oct 2020 12:38:52 +0100 Subject: [PATCH] Enabled recognition of zisofs by magic without zlib support. New by_magic=v2 --- xorriso/emulators.c | 9 +-- xorriso/filters.c | 3 +- xorriso/opts_p_z.c | 33 ++++++---- xorriso/write_run.c | 3 +- xorriso/xorriso.1 | 11 ++-- xorriso/xorriso.info | 122 ++++++++++++++++++------------------ xorriso/xorriso.texi | 11 ++-- xorriso/xorriso_timestamp.h | 2 +- 8 files changed, 100 insertions(+), 94 deletions(-) diff --git a/xorriso/emulators.c b/xorriso/emulators.c index 1be1efa4..53a81a70 100644 --- a/xorriso/emulators.c +++ b/xorriso/emulators.c @@ -1601,16 +1601,9 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, Xorriso_option_md5(xorriso, "on", 0); } else if(strcmp(argpt, "-z")==0 || strcmp(argpt, "-transparent-compression")==0) { - ret= Xorriso_genisofs_fused_options(xorriso, whom, "z", - &option_d, &iso_level, &lower_r, ra_text, 2); - if(ret <= 0) - goto problem_handler_1; Xorriso_option_zisofs(xorriso, "by_magic=on", 0); } else if(strcmp(argpt, "--zisofs-version-2") == 0) { - ret= Xorriso_option_zisofs(xorriso, "version_2=as_needed", 0); - if(ret <= 0) - goto problem_handler_1; - Xorriso_option_zisofs(xorriso, "by_magic=on", 0); + Xorriso_option_zisofs(xorriso, "by_magic=v2", 0); } else if(strcmp(argpt, "--stdio_sync")==0) { if(i+1>=argc) goto not_enough_args; diff --git a/xorriso/filters.c b/xorriso/filters.c index c43b545c..b9c0d052 100644 --- a/xorriso/filters.c +++ b/xorriso/filters.c @@ -762,7 +762,8 @@ int Xorriso_status_zisofs(struct XorrisO *xorriso, char *filter, FILE *fp, sprintf(xorriso->result_line, "-zisofs level=%d:block_size=%dk:by_magic=%s\n", xorriso->zlib_level, xorriso->zisofs_block_size / 1024, - xorriso->zisofs_by_magic ? "on" : "off"); + xorriso->zisofs_by_magic == 1 ? "on" : + xorriso->zisofs_by_magic == 2 ? "v2" : "off"); Xorriso_status_result(xorriso, filter, fp, flag & 2); } if(always || !( diff --git a/xorriso/opts_p_z.c b/xorriso/opts_p_z.c index ef0e946c..043160e5 100644 --- a/xorriso/opts_p_z.c +++ b/xorriso/opts_p_z.c @@ -2263,9 +2263,9 @@ int Xorriso_option_zisofs(struct XorrisO *xorriso, char *mode, int flag) { int was_level, was_blocksize, was_v2_enabled, was_blocksize_v2; uint64_t was_max_total_blocks, was_max_file_blocks, was_block_number_target; - int ret, l, i, sticky; + int ret, l, i, sticky, set_isofs_params= 0; double num, was_bpt_discard_free_ratio; - char *cpt, *npt, text[16]; + char *cpt, *npt; was_level= xorriso->zlib_level; was_blocksize= xorriso->zisofs_block_size; @@ -2304,12 +2304,7 @@ int Xorriso_option_zisofs(struct XorrisO *xorriso, char *mode, int flag) /* (ignored info from -status) */; } else if(strncmp(cpt, "block_size=", 11)==0) { - num= 0.0; - if(l > 11 && l < 27) { - strncpy(text, cpt + 11, l - 11); - text[l - 11]= 0; - num= Scanf_io_size(text, 0); - } + parse_zisofs_param(cpt, 11, l, &num); if (num != (1 << 15) && num != (1 << 16) && num != (1 << 17)) { sprintf(xorriso->info_text, "-zisofs: Unsupported block size (allowed 32k, 64k, 128k)"); @@ -2318,17 +2313,24 @@ int Xorriso_option_zisofs(struct XorrisO *xorriso, char *mode, int flag) xorriso->zisofs_block_size= num; } else if(strncmp(cpt, "by_magic=", 9)==0) { - if(strncmp(cpt + 9, "on", l - 9) == 0) + if(strncmp(cpt + 9, "on", l - 9) == 0) { xorriso->zisofs_by_magic= 1; - else + } else if(strncmp(cpt + 9, "v2", l - 9) == 0) { + xorriso->zisofs_by_magic= 2; + } else if(strncmp(cpt + 9, "off", l - 9) == 0) { xorriso->zisofs_by_magic= 0; + } else { + sprintf(xorriso->info_text, + "-zisofs: Unrecognized by_magic mode (allowed: on, off, v2)"); + goto sorry_ex; + } } else if(strncmp(cpt, "version_2=", 10) == 0) { if(strncmp(cpt + 10, "off", l - 10) == 0) { xorriso->zisofs_v2_enabled= 0; - } else if(strncmp(cpt + 10, "as_needed", l - 11) == 0) { + } else if(strncmp(cpt + 10, "as_needed", l - 10) == 0) { xorriso->zisofs_v2_enabled= 1; - } else if(strncmp(cpt + 10, "on", l - 11) == 0) { + } else if(strncmp(cpt + 10, "on", l - 10) == 0) { xorriso->zisofs_v2_enabled= 2; } else { sprintf(xorriso->info_text, @@ -2420,8 +2422,13 @@ sorry_ex: xorriso->zisofs_bpt_discard_free_ratio= was_bpt_discard_free_ratio; return(0); } + + if(strncmp(cpt, "by_magic=", 9) != 0) + set_isofs_params= 1; } - ret= Xorriso_set_zisofs_params(xorriso, 0); + ret= 1; + if(set_isofs_params) + ret= Xorriso_set_zisofs_params(xorriso, 0); return(ret); } diff --git a/xorriso/write_run.c b/xorriso/write_run.c index 7a791cbd..1e41f2eb 100644 --- a/xorriso/write_run.c +++ b/xorriso/write_run.c @@ -1017,7 +1017,8 @@ fprintf(stderr, "XORRISO_DEBUG: isoburn_igopt_set_tail_blocks(%d)\n", Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); root_node= (IsoNode *) iso_image_get_root(image); ret= iso_node_zf_by_magic(root_node, - (xorriso->out_drive_handle == xorriso->in_drive_handle) | 2 | 16); + (xorriso->out_drive_handle == xorriso->in_drive_handle) | + 2 | 16 | (xorriso->zisofs_by_magic << 8)); if(ret<0) { Xorriso_report_iso_error(xorriso, "", ret, "Error when examining file content for zisofs headers", diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index 60491c91..9487c4d7 100644 --- a/xorriso/xorriso.1 +++ b/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.5.3, Oct 25, 2020" +.TH XORRISO 1 "Version 1.5.3, Oct 27, 2020" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -3108,11 +3108,12 @@ Parameters are: .br "by_magic=on" enables an expensive test at image generation time which checks files from disk whether they already are zisofs compressed, e.g. by program -mkzftree. +mkzftree. "by_magic=v2" enables processing of already zisofs2 compressed files +additionally to those of zisofs version 1. "by_magic=off" disables both. .br - "version_2="off|as_needed|on enables the use of experimental version zisofs2 -which can encode files of size 4 GiB or larger. The Linux kernel (as of 5.9) -does not yet know this format and will complain like + "version_2="off|as_needed|on enables compression by experimental version +zisofs2 which can encode files of size 4 GiB or larger. The Linux kernel +(as of 5.9) does not yet know this format and will complain like .br isofs: Unknown ZF compression algorithm: PZ .br diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index 6b631fd8..6fb81c42 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -2644,8 +2644,10 @@ according to the setting of command -acl. blocks. "by_magic=on" enables an expensive test at image generation time which checks files from disk whether they already are zisofs - compressed, e.g. by program mkzftree. - "version_2="off|as_needed|on enables the use of experimental + compressed, e.g. by program mkzftree. "by_magic=v2" enables + processing of already zisofs2 compressed files additionally to + those of zisofs version 1. "by_magic=off" disables both. + "version_2="off|as_needed|on enables compression by experimental version zisofs2 which can encode files of size 4 GiB or larger. The Linux kernel (as of 5.9) does not yet know this format and will complain like @@ -5505,7 +5507,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -chown sets ownership in ISO image: Manip. (line 43) * -chown_r sets ownership in ISO image: Manip. (line 47) * -clone copies ISO directory tree: Insert. (line 185) -* -close controls media closing: SetWrite. (line 466) +* -close controls media closing: SetWrite. (line 468) * -close_damaged closes damaged track and session: Writing. (line 205) * -close_filter_list bans filter registration: Filter. (line 50) * -commit writes pending ISO image: Writing. (line 27) @@ -5535,11 +5537,11 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -drive_access control device file locking: AqDrive. (line 72) * -drive_class controls drive accessability: AqDrive. (line 43) * -du show directory size in ISO image: Navigate. (line 78) -* -dummy controls write simulation: SetWrite. (line 458) +* -dummy controls write simulation: SetWrite. (line 460) * -dus show directory size in ISO image: Navigate. (line 81) * -dusx show directory size on disk: Navigate. (line 88) * -dux show directory size on disk: Navigate. (line 84) -* -dvd_obs set write block size: SetWrite. (line 395) +* -dvd_obs set write block size: SetWrite. (line 397) * -early_stdio_test classifies stdio drives: Loading. (line 341) * -ecma119_map names w/o Rock Ridge, Joliet: Loading. (line 229) * -eject ejects drive tray: Writing. (line 50) @@ -5559,7 +5561,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -follow softlinks and mount points: SetInsert. (line 69) * -format formats media: Writing. (line 87) * -for_backup -acl,-xattr,-hardlinks,-md5: Loading. (line 215) -* -fs sets size of fifo: SetWrite. (line 461) +* -fs sets size of fifo: SetWrite. (line 463) * -getfacl shows ACL in ISO image: Navigate. (line 60) * -getfacl_r shows ACL in ISO image: Navigate. (line 66) * -getfattr shows xattr in ISO image: Navigate. (line 69) @@ -5604,7 +5606,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -mark sets synchronizing message: Frontend. (line 23) * -md5 controls handling of MD5 sums: Loading. (line 184) * -mkdir creates ISO directory: Insert. (line 177) -* -modesty_on_drive keep drive buffer hungry: SetWrite. (line 401) +* -modesty_on_drive keep drive buffer hungry: SetWrite. (line 403) * -mount issues mount command for ISO session: Restore. (line 153) * -mount_cmd composes mount command line: Inquiry. (line 49) * -mount_cmd controls mount command: Inquiry. (line 65) @@ -5623,7 +5625,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -out_charset sets output character set: SetWrite. (line 285) * -overwrite enables overwriting in ISO: SetInsert. (line 131) * -pacifier controls pacifier text form: Emulation. (line 166) -* -padding sets amount or mode of image padding: SetWrite. (line 489) +* -padding sets amount or mode of image padding: SetWrite. (line 491) * -page set terminal geometry: DialogCtl. (line 18) * -paste_in copies file into disk file: Restore. (line 121) * -pathspecs sets meaning of = with -add: SetInsert. (line 115) @@ -5681,12 +5683,12 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -signal_handling controls handling of system signals: Exception. (line 66) * -sleep waits for a given time span: Scripting. (line 113) -* -speed set write speed: SetWrite. (line 366) +* -speed set write speed: SetWrite. (line 368) * -split_size enables large file splitting: SetInsert. (line 145) * -status shows current settings: Scripting. (line 44) * -status_history_max curbs -status history: Scripting. (line 52) -* -stdio_sync controls stdio buffer: SetWrite. (line 451) -* -stream_recording controls defect management: SetWrite. (line 384) +* -stdio_sync controls stdio buffer: SetWrite. (line 453) +* -stream_recording controls defect management: SetWrite. (line 386) * -system_id sets system id: SetWrite. (line 205) * -tell_media_space reports free space: Inquiry. (line 98) * -temp_mem_limit curbs memory consumption: Scripting. (line 96) @@ -5699,13 +5701,13 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -update_l inserts paths if different <1>: Insert. (line 128) * -update_li inserts paths if different: Insert. (line 124) * -update_r inserts paths if different: Insert. (line 110) -* -use_immed_bit controls use of Immed bit: SetWrite. (line 439) +* -use_immed_bit controls use of Immed bit: SetWrite. (line 441) * -use_readline enables readline for dialog: DialogCtl. (line 26) * -version prints help text: Scripting. (line 22) * -volid sets volume id: SetWrite. (line 168) * -volset_id sets volume set id: SetWrite. (line 188) * -volume_date sets volume timestamp: SetWrite. (line 211) -* -write_type chooses TAO or SAO/DAO: SetWrite. (line 482) +* -write_type chooses TAO or SAO/DAO: SetWrite. (line 484) * -x enables automatic execution order of arguments: ArgSort. (line 16) * -xattr controls handling of xattr (EA): Loading. (line 172) * -zisofs controls zisofs production: SetWrite. (line 296) @@ -5738,7 +5740,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Backup, enable features, -for_backup: Loading. (line 215) * Backup, scdbackup checksum tag, -scdbackup: Emulation. (line 179) * Blank media, _definition: Media. (line 29) -* Blank, format, Immed bit, -use_immed_bit: SetWrite. (line 439) +* Blank, format, Immed bit, -use_immed_bit: SetWrite. (line 441) * Blind growing, _definition: Methods. (line 41) * Bootability, control, -boot_image: Bootable. (line 75) * Bugs, reporting: Bugreport. (line 6) @@ -6001,26 +6003,26 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Verify, file checksum, -check_md5: Verify. (line 184) * Verify, file tree checksums, -check_md5_r: Verify. (line 198) * Verify, preset -check_media, -check_media_defaults: Verify. (line 40) -* Write, block size, -dvd_obs: SetWrite. (line 395) +* Write, block size, -dvd_obs: SetWrite. (line 397) * Write, bootability, -boot_image: Bootable. (line 75) -* Write, buffer syncing, -stdio_sync: SetWrite. (line 451) -* Write, close media, -close: SetWrite. (line 466) +* Write, buffer syncing, -stdio_sync: SetWrite. (line 453) +* Write, close media, -close: SetWrite. (line 468) * Write, compliance to specs, -compliance: SetWrite. (line 62) -* Write, defect management, -stream_recording: SetWrite. (line 384) +* Write, defect management, -stream_recording: SetWrite. (line 386) * Write, disable Rock Ridge, -rockridge: SetWrite. (line 57) -* Write, drive buffer, -modesty_on_drive: SetWrite. (line 401) +* Write, drive buffer, -modesty_on_drive: SetWrite. (line 403) * Write, enable HFS+, -hfsplus: SetWrite. (line 14) * Write, enable Joliet, -joliet: SetWrite. (line 10) -* Write, fifo size, -fs: SetWrite. (line 461) +* Write, fifo size, -fs: SetWrite. (line 463) * Write, free space, -tell_media_space: Inquiry. (line 98) * Write, log problematic disk files, -errfile_log: Scripting. (line 116) * Write, log written sessions, -session_log: Scripting. (line 134) -* Write, padding image, -padding: SetWrite. (line 489) +* Write, padding image, -padding: SetWrite. (line 491) * Write, pending ISO image, -commit: Writing. (line 27) * Write, predict image size, -print_size: Inquiry. (line 86) -* Write, set speed, -speed: SetWrite. (line 366) -* Write, simulation, -dummy: SetWrite. (line 458) -* Write, TAO or SAO/DAO, -write_type: SetWrite. (line 482) +* Write, set speed, -speed: SetWrite. (line 368) +* Write, simulation, -dummy: SetWrite. (line 460) +* Write, TAO or SAO/DAO, -write_type: SetWrite. (line 484) * xattr, control handling, -xattr: Loading. (line 172) * xattr, set in ISO image, -setfattr: Manip. (line 103) * xattr, set in ISO image, -setfattr_list: Manip. (line 120) @@ -6052,41 +6054,41 @@ Node: CmdFind88338 Node: Filter107267 Node: Writing111889 Node: SetWrite124144 -Node: Bootable152784 -Node: Jigdo179869 -Node: Charset184872 -Node: Exception188201 -Node: DialogCtl194330 -Node: Inquiry196932 -Node: Navigate205814 -Node: Verify214521 -Node: Restore225670 -Node: Emulation234836 -Node: Scripting245292 -Node: Frontend253075 -Node: Examples262701 -Node: ExDevices263879 -Node: ExCreate264540 -Node: ExDialog265840 -Node: ExGrowing267111 -Node: ExModifying267920 -Node: ExBootable268430 -Node: ExCharset268985 -Node: ExPseudo269881 -Node: ExCdrecord270808 -Node: ExMkisofs271128 -Node: ExGrowisofs273025 -Node: ExException274178 -Node: ExTime274636 -Node: ExIncBackup275094 -Node: ExRestore279120 -Node: ExRecovery280066 -Node: Files280638 -Node: Environ281972 -Node: Seealso282720 -Node: Bugreport283437 -Node: Legal284028 -Node: CommandIdx285040 -Node: ConceptIdx302656 +Node: Bootable152942 +Node: Jigdo180027 +Node: Charset185030 +Node: Exception188359 +Node: DialogCtl194488 +Node: Inquiry197090 +Node: Navigate205972 +Node: Verify214679 +Node: Restore225828 +Node: Emulation234994 +Node: Scripting245450 +Node: Frontend253233 +Node: Examples262859 +Node: ExDevices264037 +Node: ExCreate264698 +Node: ExDialog265998 +Node: ExGrowing267269 +Node: ExModifying268078 +Node: ExBootable268588 +Node: ExCharset269143 +Node: ExPseudo270039 +Node: ExCdrecord270966 +Node: ExMkisofs271286 +Node: ExGrowisofs273183 +Node: ExException274336 +Node: ExTime274794 +Node: ExIncBackup275252 +Node: ExRestore279278 +Node: ExRecovery280224 +Node: Files280796 +Node: Environ282130 +Node: Seealso282878 +Node: Bugreport283595 +Node: Legal284186 +Node: CommandIdx285198 +Node: ConceptIdx302814  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index f4965974..06b6cc54 100644 --- a/xorriso/xorriso.texi +++ b/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.5.3, Oct 25, 2020" +@c man .TH XORRISO 1 "Version 1.5.3, Oct 27, 2020" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -3621,11 +3621,12 @@ Parameters are: @* "by_magic=on" enables an expensive test at image generation time which checks files from disk whether they already are zisofs compressed, e.g. by program -mkzftree. +mkzftree. "by_magic=v2" enables processing of already zisofs2 compressed files +additionally to those of zisofs version 1. "by_magic=off" disables both. @* - "version_2="off|as_needed|on enables the use of experimental version zisofs2 -which can encode files of size 4 GiB or larger. The Linux kernel (as of 5.9) -does not yet know this format and will complain like + "version_2="off|as_needed|on enables compression by experimental version +zisofs2 which can encode files of size 4 GiB or larger. The Linux kernel +(as of 5.9) does not yet know this format and will complain like @* isofs: Unknown ZF compression algorithm: PZ @* diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 3fb3313d..479ee7a4 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2020.10.25.160005" +#define Xorriso_timestamP "2020.10.27.113831"