From 2987704406e9b24e4b805a9813dae0bdb56d41e2 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 14 Apr 2009 09:23:06 +0000 Subject: [PATCH] New -zisofs option by_magic=on --- libisoburn/trunk/xorriso/xorriso.1 | 10 +++-- libisoburn/trunk/xorriso/xorriso.c | 25 ++++++++++-- libisoburn/trunk/xorriso/xorriso_private.h | 1 + libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 40 +++++++++++++++++--- 5 files changed, 65 insertions(+), 13 deletions(-) diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index 41a3b9bf..99b98a6d 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -2,7 +2,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 "Apr 11, 2009" +.TH XORRISO 1 "Apr 13, 2009" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -1808,7 +1808,11 @@ Parameters are: .br "block_size="32k|64k|128k size of compression blocks .br - "default" same as "level=6:block_size=32k" + "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. +.br + "default" same as "level=6:block_size=32k:by_magic=off" .TP \fB\-speed\fR number[k|m|c|d|b] Set the burn speed. Default is 0 = maximum speed. @@ -2692,7 +2696,7 @@ Personality "\fBmkisofs\fR" accepts the options listed with: -as mkisofs -help -- .br Among them: -R (always on), -J, -o, -M, -C, -path-list, -m, -exclude-list, --f, -print-size, -pad, -no-pad, -V, -v, -version, -graft-points, +-f, -print-size, -pad, -no-pad, -V, -v, -version, -graft-points, -z, -no-emul-boot, -b, -c, -boot-info-table, -boot-load-size, -input-charset, -output-charset, pathspecs as with xorriso -add. A lot of options are not supported and lead to failure of the mkisofs diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index 0a2407ad..cd4e0bea 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -4124,6 +4124,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->filter_list_closed= 0; m->zlib_level_default= m->zlib_level= 6; m->zisofs_block_size= m->zisofs_block_size_default= (1 << 15); + m->zisofs_by_magic= 0; m->do_overwrite= 2; m->do_reassure= 0; m->drive_blacklist= NULL; @@ -9946,6 +9947,8 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, " -no-emul-boot Boot image is 'no emulation' image", " -boot-info-table Patch boot image with info table", " isolinux_mbr=on|auto|off Control eventual isohybrid MBR generation", +" -z, -transparent-compression", +" Enable transparent compression of files", " -v, -verbose Verbose", " -version Print the current version", "@End_of_helptexT@" @@ -10094,6 +10097,9 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, Xorriso_option_acl(xorriso, "on", 0); } else if(strcmp(argv[i], "--xattr")==0) { Xorriso_option_xattr(xorriso, "on", 0); + } else if(strcmp(argv[i], "-z")==0 || + strcmp(argv[i], "-transparent-compression")==0) { + Xorriso_option_zisofs(xorriso, "by_magic=on", 0); } else was_other_option= 1; @@ -10302,6 +10308,9 @@ not_enough_args:; /* was already handled in first argument scan */; } else if(strcmp(argv[i], "--xattr")==0) { /* was already handled in first argument scan */; + } else if(strcmp(argv[i], "-z")==0 || + strcmp(argv[i], "-transparent-compression")==0) { + /* was already handled in first argument scan */; } else if(argv[i][0]=='-' && argv[i][1]!=0) { sprintf(xorriso->info_text, "-as %s: Unknown option %s", whom, Text_shellsafe(argv[i], sfe, 0)); @@ -14321,7 +14330,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) "compressed content is detected with a file in the ISO image.", " -zisofs option[:options]", " Set global zisofs parameters:", -" level=0|...|9 , block_size=32k|64k|128k", +" level=0|...|9 , block_size=32k|64k|128k , by_magic=on|off", "", "Write-to-media options:", " -rollback Discard the manipulated ISO image and reload it.", @@ -14464,13 +14473,14 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) "", "Compatibility emulation (argument list may be ended by list delimiter --):", " -as mkisofs [-help|-version|-o|-R|-J|-V|-P|-f|-m|-exclude-list|-no-pad|", -" -M|-C|-graft-points|-path-list|pathspecs|", +" -M|-C|-graft-points|-path-list|pathspecs|-z|", " -no-emul-boot|-b|-c|-boot-info-table|-boot-load-size]", " Perform some mkisofs gestures, understand pathspecs as mkisofs", " does. Commit happens outside emulation at usual occasions.", -" -as cdrecord [-help|-v|dev=|speed=|blank=|fs=|-eject|-atip|padsize=|path|-]", +" -as cdrecord [-help|-v|dev=|speed=|blank=|fs=|-eject|-atip|padsize=|-multi]", +" path|-", " Perform some cdrecord gestures, eventually write at most one", -" data track to blank or overwriteable media.", +" data track to blank, appendable or overwriteable media.", " -pacifier \"xorriso\"|\"cdrecord\"|\"mkisofs\"", " Choose format of UPDATE pacifier during write operations.", "", @@ -17094,9 +17104,16 @@ int Xorriso_option_zisofs(struct XorrisO *xorriso, char *mode, int flag) } xorriso->zisofs_block_size= num; + } else if(strncmp(cpt, "by_magic=", 8)==0) { + if(strncmp(cpt + 9, "on", l - 9) == 0) + xorriso->zisofs_by_magic= 1; + else + xorriso->zisofs_by_magic= 0; + } else if(strncmp(cpt, "default", l)==0) { xorriso->zlib_level= xorriso->zlib_level_default; xorriso->zisofs_block_size= xorriso->zisofs_block_size_default; + xorriso->zisofs_by_magic= 0; } else { unknown_mode:; diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index edcd4978..39a270f8 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -134,6 +134,7 @@ struct XorrisO { /* the global context of xorriso */ int zlib_level_default; int zisofs_block_size; int zisofs_block_size_default; + int zisofs_by_magic; int do_overwrite; /* 0=off, 1=on, 2=nondir */ int do_reassure; /* 0=off, 1=on, 2=tree */ diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index f987b9f9..c3bc5c21 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.04.11.172644" +#define Xorriso_timestamP "2009.04.14.092306" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index 25d43204..67a13f8e 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -1140,7 +1140,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) struct burn_track **tracks; enum burn_disc_status s; IsoImage *image= NULL; - IsoNode *node; + IsoNode *node, *root_node; ElToritoBootImage *bootimg; enum eltorito_boot_media_type emul_type= ELTORITO_NO_EMUL; int profile_number; @@ -1403,11 +1403,36 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) if(ret<0) {ret= 0; goto ex;} + if(xorriso->zisofs_by_magic) { + sprintf(xorriso->info_text, + "Checking disk file content for zisofs compression headers."); + 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); + if(ret<0) { + Xorriso_report_iso_error(xorriso, "", ret, + "Error when examining file content for zisofs headers", + 0, "FAILURE", 1); + } + ret= Xorriso_eval_problem_status(xorriso, 1, 0); + if(ret<0) + {ret= 0; goto ex;} + sprintf(xorriso->info_text, + "Check for zisofs compression headers done."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + } + /* >>> omit iso_image_update_sizes if the image was filled up very quickly */; ret= iso_image_update_sizes(image); if(ret < 0) { Xorriso_process_msg_queues(xorriso, 0); + if(ret<0) { + Xorriso_report_iso_error(xorriso, "", ret, + "Error when updating file sizes", + 0, "FAILURE", 1); + } ret= Xorriso_eval_problem_status(xorriso, 1, 0); if(ret<0) {ret= 0; goto ex;} @@ -10364,6 +10389,7 @@ int Xorriso_set_zisofs_params(struct XorrisO *xorriso, int flag) int Xorriso_status_zisofs(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) /* + bit0= do only report non-default settings bit1= do only report to fp */ { @@ -10372,12 +10398,16 @@ int Xorriso_status_zisofs(struct XorrisO *xorriso, char *filter, FILE *fp, iso_zisofs_get_refcounts(&ziso_count, &osiz_count, 0); if((flag & 1) && xorriso->zlib_level == xorriso->zlib_level_default && xorriso->zisofs_block_size == xorriso->zisofs_block_size_default && - ziso_count == 0 && osiz_count == 0) + xorriso->zisofs_by_magic == 0 && + ziso_count == 0 && osiz_count == 0 && + filter[0] == 0) return 2; sprintf(xorriso->result_line, - "-zisofs level=%d:block_size=%dk:ziso_used=%.f:osiz_used=%.f\n", - xorriso->zlib_level, xorriso->zisofs_block_size / 1024, - (double) ziso_count, (double) osiz_count); + "-zisofs level=%d:block_size=%dk:by_magic=%s:ziso_used=%.f:osiz_used=%.f\n", + xorriso->zlib_level, xorriso->zisofs_block_size / 1024, + xorriso->zisofs_by_magic ? "on" : "off", + (double) ziso_count, (double) osiz_count); + Xorriso_status_result(xorriso, filter, fp, flag&2); return(1); }