From f21ce9d62b011f8b2412d8203c23722dabf3dc7b Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 8 Jul 2012 13:47:36 +0000 Subject: [PATCH] New xorriso command -write_type --- libisoburn/trunk/libisoburn/libisoburn.ver | 3 + libisoburn/trunk/xorriso/base_obj.c | 1 + libisoburn/trunk/xorriso/opts_d_h.c | 2 + libisoburn/trunk/xorriso/opts_p_z.c | 20 +++++ libisoburn/trunk/xorriso/parse_exec.c | 10 ++- libisoburn/trunk/xorriso/text_io.c | 6 ++ libisoburn/trunk/xorriso/write_run.c | 72 ++++++++++++++-- libisoburn/trunk/xorriso/xorriso.1 | 11 ++- libisoburn/trunk/xorriso/xorriso.h | 3 + libisoburn/trunk/xorriso/xorriso.info | 86 +++++++++++--------- libisoburn/trunk/xorriso/xorriso.texi | 13 ++- libisoburn/trunk/xorriso/xorriso_private.h | 4 + libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 13 files changed, 178 insertions(+), 55 deletions(-) diff --git a/libisoburn/trunk/libisoburn/libisoburn.ver b/libisoburn/trunk/libisoburn/libisoburn.ver index 91de3928..5761ee58 100644 --- a/libisoburn/trunk/libisoburn/libisoburn.ver +++ b/libisoburn/trunk/libisoburn/libisoburn.ver @@ -32,6 +32,7 @@ isoburn_igopt_get_effective_lba; isoburn_igopt_get_efi_bootp; isoburn_igopt_get_extensions; isoburn_igopt_get_fifo_size; +isoburn_igopt_get_hfsp_block_size; isoburn_igopt_get_hfsp_serial_number; isoburn_igopt_get_level; isoburn_igopt_get_out_charset; @@ -52,6 +53,7 @@ isoburn_igopt_set_disc_label; isoburn_igopt_set_efi_bootp; isoburn_igopt_set_extensions; isoburn_igopt_set_fifo_size; +isoburn_igopt_set_hfsp_block_size; isoburn_igopt_set_hfsp_serial_number; isoburn_igopt_set_level; isoburn_igopt_set_out_charset; @@ -280,6 +282,7 @@ Xorriso_option_version; Xorriso_option_volid; Xorriso_option_volset_id; Xorriso_option_volume_date; +Xorriso_option_write_type; Xorriso_option_xattr; Xorriso_option_zisofs; Xorriso_prescan_args; diff --git a/libisoburn/trunk/xorriso/base_obj.c b/libisoburn/trunk/xorriso/base_obj.c index 63fe9b17..85c4923c 100644 --- a/libisoburn/trunk/xorriso/base_obj.c +++ b/libisoburn/trunk/xorriso/base_obj.c @@ -178,6 +178,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->do_global_mode= 0; m->global_dir_mode= 0555; m->global_file_mode= 0444; + m->do_tao= 0; m->filters= NULL; m->filter_list_closed= 0; m->zlib_level_default= m->zlib_level= 6; diff --git a/libisoburn/trunk/xorriso/opts_d_h.c b/libisoburn/trunk/xorriso/opts_d_h.c index 3b27e2a9..752cd2de 100644 --- a/libisoburn/trunk/xorriso/opts_d_h.c +++ b/libisoburn/trunk/xorriso/opts_d_h.c @@ -1875,6 +1875,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " -commit_eject \"in\"|\"out\"|\"all\"|\"none\"", " Like -commit but rather eject than load image from outdrive.", " Give up any unejected drive afterwards.", +" -write_type \"auto\"|\"tao\"|\"sao/dao\"", +" Set write type for CD-R[W], DVD-R[W], DVD+R, BD-R.", " -close \"on\"|\"off\"", " If \"on\" then mark the written medium as not appendable.", " -padding number[\"k\"|\"m\"]|\"included\"|\"appended\"", diff --git a/libisoburn/trunk/xorriso/opts_p_z.c b/libisoburn/trunk/xorriso/opts_p_z.c index eacfbb87..91f81e8f 100644 --- a/libisoburn/trunk/xorriso/opts_p_z.c +++ b/libisoburn/trunk/xorriso/opts_p_z.c @@ -1922,6 +1922,26 @@ ex:; } +/* Command -write_type */ +int Xorriso_option_write_type(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "auto") == 0) + xorriso->do_tao = 0; + else if(strcmp(mode, "tao") == 0 || strcmp(mode, "TAO") == 0) + xorriso->do_tao = 1; + else if(strcmp(mode, "sao") == 0 || strcmp(mode, "SAO") == 0 || + strcmp(mode, "dao") == 0 || strcmp(mode, "DAO") == 0 || + strcmp(mode, "sao/dao") == 0 || strcmp(mode, "SAO/DAO") == 0 ) + xorriso->do_tao = -1; + else { + sprintf(xorriso->info_text, "-write_type: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + /* Option -xattr "on"|"off" */ int Xorriso_option_xattr(struct XorrisO *xorriso, char *mode, int flag) { diff --git a/libisoburn/trunk/xorriso/parse_exec.c b/libisoburn/trunk/xorriso/parse_exec.c index de215137..daa50ab9 100644 --- a/libisoburn/trunk/xorriso/parse_exec.c +++ b/libisoburn/trunk/xorriso/parse_exec.c @@ -479,7 +479,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, "speed","split_size","status","status_history_max", "stdio_sync","stream_recording","system_id","temp_mem_limit", "uid","unregister_filter","use_readline","volid","volset_id", - "xattr","zisofs", + "write_type","xattr","zisofs", "" }; static char arg2_commands[][40]= { @@ -660,13 +660,13 @@ int Xorriso_cmd_sorting_rank(struct XorrisO *xorriso, "mount", "* Settings for result writing:", - "joliet", "hfsplus","compliance", "rr_reloc_dir", + "rockridge", "joliet", "hfsplus","compliance", "rr_reloc_dir", "volid", "volset_id", "publisher", "application_id", "system_id", "volume_date", "copyright_file", "abstract_file", "biblio_file", "preparer_id", "out_charset", "read_mkisofsrc", "uid", "gid", "zisofs", "speed", "stream_recording", "dvd_obs", - "stdio_sync", "dummy", "fs", "close", "padding", + "stdio_sync", "dummy", "fs", "close", "padding", "write_type", "grow_blindly", "pacifier", "scdbackup_tag", "* Bootable ISO images:", @@ -1723,6 +1723,10 @@ next_command:; (*idx)+= 2; ret= Xorriso_option_volume_date(xorriso, arg1, arg2, 0); + } else if(strcmp(cmd,"write_type")==0) { + (*idx)++; + ret= Xorriso_option_write_type(xorriso, arg1, 0); + } else if(strcmp(cmd, "x") == 0) { /* only in effect in Xorriso_prescan_args() */; diff --git a/libisoburn/trunk/xorriso/text_io.c b/libisoburn/trunk/xorriso/text_io.c index 150e9591..c2db8df5 100644 --- a/libisoburn/trunk/xorriso/text_io.c +++ b/libisoburn/trunk/xorriso/text_io.c @@ -1692,6 +1692,12 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->do_tao == 0); + sprintf(line,"-write_type %s\n", + xorriso->do_tao == 0 ? "auto" : xorriso->do_tao > 0 ? "tao" : "sao/dao"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= !xorriso->do_dummy; sprintf(line,"-dummy %s\n",(xorriso->do_dummy ? "on" : "off")); if(!(is_default && no_defaults)) diff --git a/libisoburn/trunk/xorriso/write_run.c b/libisoburn/trunk/xorriso/write_run.c index b8c58c1e..41f9d9e2 100644 --- a/libisoburn/trunk/xorriso/write_run.c +++ b/libisoburn/trunk/xorriso/write_run.c @@ -625,13 +625,14 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) IsoImage *image= NULL; IsoNode *root_node; int profile_number; - char *profile_name= NULL; + char *profile_name= NULL, *reasons= NULL; IsoBoot *bootcat_node; uint32_t padding; Xorriso_alloc_meM(sfe, char, 5 * SfileadrL); Xorriso_alloc_meM(xorriso_id, char, 256); Xorriso_alloc_meM(profile_name, char, 80); + Xorriso_alloc_meM(reasons, char, BURN_REASONS_LEN); ret= Xorriso_finish_hl_update(xorriso, 0); if(ret <= 0) @@ -1009,6 +1010,38 @@ fprintf(stderr, "XORRISO_DEBUG: isoburn_igopt_set_tail_blocks(%d)\n", burn_write_opts_set_stream_recording(burn_options, data_lba); } + if(xorriso->do_tao) { + if (xorriso->do_tao > 0) + burn_write_opts_set_write_type(burn_options, + BURN_WRITE_TAO, BURN_BLOCK_MODE1); + else + burn_write_opts_set_write_type(burn_options, + BURN_WRITE_SAO, BURN_BLOCK_SAO); + + ret = burn_precheck_write(burn_options, disc, reasons, 0); + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Cannot set write type %s for this medium.\n", + xorriso->do_tao > 0 ? "TAO" : "SAO"); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + "Reasons given:\n %s", reasons); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto cancel_iso; + } + } else { + if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) == + BURN_WRITE_NONE) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Failed to find a suitable write mode with this media.\n"); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + "Reasons given:\n %s", reasons); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto cancel_iso; + } + } + ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, flag&1); if(ret<=0 || (flag&1)) { Xorriso_process_msg_queues(xorriso,0); @@ -1111,6 +1144,7 @@ ex:; Xorriso_free_meM(sfe); Xorriso_free_meM(xorriso_id); Xorriso_free_meM(profile_name); + Xorriso_free_meM(reasons); return(ret); cancel_iso:; @@ -1923,14 +1957,34 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address, burn_write_opts_set_start_byte(burn_options, ((off_t) nwa) * (off_t) 2048); } - if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) == - BURN_WRITE_NONE) { - sprintf(xorriso->info_text, - "Failed to find a suitable write mode with this media.\n"); - sprintf(xorriso->info_text+strlen(xorriso->info_text), - "Reasons given:\n%s", reasons); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - ret= 0; goto ex; + if(xorriso->do_tao) { + if (xorriso->do_tao > 0) + burn_write_opts_set_write_type(burn_options, + BURN_WRITE_TAO, BURN_BLOCK_MODE1); + else + burn_write_opts_set_write_type(burn_options, + BURN_WRITE_SAO, BURN_BLOCK_SAO); + + ret = burn_precheck_write(burn_options, disc, reasons, 0); + if(ret<=0) { + sprintf(xorriso->info_text, + "Cannot set write type %s for this medium.\n", + xorriso->do_tao > 0 ? "TAO" : "SAO"); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + "Reasons given:\n%s", reasons); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } else { + if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) == + BURN_WRITE_NONE) { + sprintf(xorriso->info_text, + "Failed to find a suitable write mode with this media.\n"); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + "Reasons given:\n%s", reasons); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } } ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, 2); diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index 9e9c3547..94902985 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.2.3, Jul 02, 2012" +.TH XORRISO 1 "Version 1.2.3, Jul 06, 2012" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -2654,6 +2654,13 @@ any more (if possible at all with the given type of target media). This is the contrary of cdrecord, wodim, cdrskin command \-multi, and is one aspect of growisofs option \-dvd\-compat. .TP +\fB\-write_type\fR "auto"|"tao"|"sao/dao" +Set the write type for the next burn run. "auto" will select SAO with blank +CD media, DAO with DVD\-R[W] if \-close is "on", and elsewise CD TAO or the +equivalent write type of the particular DVD/BD media. +Choosing TAO or SAO/DAO explicitely might cause the burn run to fail if the +desired write type is not possible with the given media state. +.TP \fB\-padding\fR number["k"|"m"]|"included"|"appended" Append the given number of extra bytes to the image stream. This is a traditional remedy for a traditional bug in block @@ -4842,7 +4849,7 @@ $ xorriso \\ .br To be used several times on the same medium, whenever an update of the two disk trees to the medium is desired. Begin with a blank medium and -update it until he run fails gracefully due to lack of remaining space on +update it until the run fails gracefully due to lack of remaining space on the old one. .br This makes sense if the full backup leaves substantial remaining capacity diff --git a/libisoburn/trunk/xorriso/xorriso.h b/libisoburn/trunk/xorriso/xorriso.h index 82ff48ae..477df134 100644 --- a/libisoburn/trunk/xorriso/xorriso.h +++ b/libisoburn/trunk/xorriso/xorriso.h @@ -1304,6 +1304,9 @@ int Xorriso_option_volset_id(struct XorrisO *xorriso, char *name, int flag); int Xorriso_option_volume_date(struct XorrisO *xorriso, char *time_type, char *timestring, int flag); +/* Command -write_type */ +int Xorriso_option_write_type(struct XorrisO *xorriso, char *mode, int flag); + /* There is no Xorriso_option_x() because -x has an effect only in Xorriso_prescan_args(). Use the flag bits of Xorriso_interpreter() if you want to impose command sorting on your own. diff --git a/libisoburn/trunk/xorriso/xorriso.info b/libisoburn/trunk/xorriso/xorriso.info index 6b7fe45f..5ca3137b 100644 --- a/libisoburn/trunk/xorriso/xorriso.info +++ b/libisoburn/trunk/xorriso/xorriso.info @@ -2359,6 +2359,14 @@ according to the setting of command -acl. This is the contrary of cdrecord, wodim, cdrskin command -multi, and is one aspect of growisofs option -dvd-compat. +-write_type "auto"|"tao"|"sao/dao" + Set the write type for the next burn run. "auto" will select SAO + with blank CD media, DAO with DVD-R[W] if -close is "on", and + elsewise CD TAO or the equivalent write type of the particular + DVD/BD media. Choosing TAO or SAO/DAO explicitely might cause the + burn run to fail if the desired write type is not possible with + the given media state. + -padding number["k"|"m"]|"included"|"appended" Append the given number of extra bytes to the image stream. This is a traditional remedy for a traditional bug in block device read @@ -4272,7 +4280,7 @@ $ xorriso \ To be used several times on the same medium, whenever an update of the two disk trees to the medium is desired. Begin with a blank medium and -update it until he run fails gracefully due to lack of remaining space +update it until the run fails gracefully due to lack of remaining space on the old one. This makes sense if the full backup leaves substantial remaining capacity on media and if the expected changes are much smaller than the @@ -4644,7 +4652,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -outdev acquires a drive for output: AqDrive. (line 31) * -overwrite enables overwriting in ISO: SetInsert. (line 127) * -pacifier controls pacifier text form: Emulation. (line 158) -* -padding sets amount or mode of image padding: SetWrite. (line 339) +* -padding sets amount or mode of image padding: SetWrite. (line 347) * -page set terminal geometry: DialogCtl. (line 19) * -paste_in copies file into disk file: Restore. (line 121) * -path_list inserts paths from disk file: Insert. (line 78) @@ -4715,6 +4723,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -volid sets volume id: SetWrite. (line 160) * -volset_id sets volume set id: SetWrite. (line 179) * -volume_date sets volume timestamp: SetWrite. (line 206) +* -write_type chooses TAO or SAO/DAO: SetWrite. (line 339) * -x enables automatic execution order of arguments: ArgSort. (line 16) * -xattr controls handling of xattr (EA): Loading. (line 151) @@ -4987,11 +4996,12 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Write, free space, -tell_media_space: Inquiry. (line 89) * Write, log problematic disk files, -errfile_log: Scripting. (line 118) * Write, log written sessions, -session_log: Scripting. (line 138) -* Write, padding image, -padding: SetWrite. (line 339) +* Write, padding image, -padding: SetWrite. (line 347) * Write, pending ISO image, -commit: Writing. (line 29) * Write, predict image size, -print_size: Inquiry. (line 80) * Write, set speed, -speed: SetWrite. (line 282) * Write, simulation, -dummy: SetWrite. (line 322) +* Write, TAO or SAO/DAO, -write_type: SetWrite. (line 339) * xattr, _definition: Extras. (line 65) * xattr, control handling, -xattr: Loading. (line 151) * xattr, set in ISO image, -setfattr: Manip. (line 111) @@ -5023,40 +5033,40 @@ Node: CmdFind73212 Node: Filter87916 Node: Writing92471 Node: SetWrite101435 -Node: Bootable119658 -Node: Jigdo134901 -Node: Charset139147 -Node: Exception141908 -Node: DialogCtl148027 -Node: Inquiry150624 -Node: Navigate155490 -Node: Verify163787 -Node: Restore172753 -Node: Emulation179662 -Node: Scripting189473 -Node: Frontend196633 -Node: Examples197933 -Node: ExDevices199110 -Node: ExCreate199769 -Node: ExDialog201054 -Node: ExGrowing202319 -Node: ExModifying203124 -Node: ExBootable203628 -Node: ExCharset204180 -Node: ExPseudo205001 -Node: ExCdrecord205899 -Node: ExMkisofs206216 -Node: ExGrowisofs207556 -Node: ExException208691 -Node: ExTime209145 -Node: ExIncBackup209604 -Node: ExRestore213595 -Node: ExRecovery214555 -Node: Files215125 -Node: Seealso216424 -Node: Bugreport217147 -Node: Legal217728 -Node: CommandIdx218739 -Node: ConceptIdx234538 +Node: Bootable120068 +Node: Jigdo135311 +Node: Charset139557 +Node: Exception142318 +Node: DialogCtl148437 +Node: Inquiry151034 +Node: Navigate155900 +Node: Verify164197 +Node: Restore173163 +Node: Emulation180072 +Node: Scripting189883 +Node: Frontend197043 +Node: Examples198343 +Node: ExDevices199520 +Node: ExCreate200179 +Node: ExDialog201464 +Node: ExGrowing202729 +Node: ExModifying203534 +Node: ExBootable204038 +Node: ExCharset204590 +Node: ExPseudo205411 +Node: ExCdrecord206309 +Node: ExMkisofs206626 +Node: ExGrowisofs207966 +Node: ExException209101 +Node: ExTime209555 +Node: ExIncBackup210014 +Node: ExRestore214006 +Node: ExRecovery214966 +Node: Files215536 +Node: Seealso216835 +Node: Bugreport217558 +Node: Legal218139 +Node: CommandIdx219150 +Node: ConceptIdx235022  End Tag Table diff --git a/libisoburn/trunk/xorriso/xorriso.texi b/libisoburn/trunk/xorriso/xorriso.texi index 06ed734b..07789f8a 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.2.3, Jul 02, 2012" +@c man .TH XORRISO 1 "Version 1.2.3, Jul 06, 2012" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -3149,6 +3149,15 @@ any more (if possible at all with the given type of target media). This is the contrary of cdrecord, wodim, cdrskin command -multi, and is one aspect of growisofs option -dvd-compat. @c man .TP +@item -write_type "auto"|"tao"|"sao/dao" +@kindex -write_type chooses TAO or SAO/DAO +@cindex Write, TAO or SAO/DAO, -write_type +Set the write type for the next burn run. "auto" will select SAO with blank +CD media, DAO with DVD-R[W] if -close is "on", and elsewise CD TAO or the +equivalent write type of the particular DVD/BD media. +Choosing TAO or SAO/DAO explicitely might cause the burn run to fail if the +desired write type is not possible with the given media state. +@c man .TP @item -padding number["k"|"m"]|"included"|"appended" @kindex -padding sets amount or mode of image padding @cindex Write, padding image, -padding @@ -5758,7 +5767,7 @@ $ xorriso \ @sp 1 To be used several times on the same medium, whenever an update of the two disk trees to the medium is desired. Begin with a blank medium and -update it until he run fails gracefully due to lack of remaining space on +update it until the run fails gracefully due to lack of remaining space on the old one. @* This makes sense if the full backup leaves substantial remaining capacity diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index 48fe29d2..60dead2d 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -189,6 +189,10 @@ struct XorrisO { /* the global context of xorriso */ mode_t global_dir_mode; mode_t global_file_mode; + int do_tao; /* 1= Use TAO resp. Incremental + -1= Use SAO resp. DAO + 0= let libburn choose */ + struct Xorriso_lsT *filters; int filter_list_closed; diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index a40db254..bd09cf0d 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2012.07.08.134305" +#define Xorriso_timestamP "2012.07.08.134840"