From 4c1b8c0a037f860d9ad6aadf70652560c0d6b9ca Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 1 Jun 2011 16:52:29 +0000 Subject: [PATCH] New option -close_damaged --- libisoburn/trunk/libisoburn/libisoburn.ver | 1 + libisoburn/trunk/xorriso/opts_a_c.c | 28 ++++++ libisoburn/trunk/xorriso/opts_d_h.c | 2 + libisoburn/trunk/xorriso/parse_exec.c | 6 +- libisoburn/trunk/xorriso/write_run.c | 37 ++++++++ libisoburn/trunk/xorriso/xorriso.1 | 18 +++- libisoburn/trunk/xorriso/xorriso.h | 5 ++ libisoburn/trunk/xorriso/xorriso.info | 92 ++++++++++++-------- libisoburn/trunk/xorriso/xorriso.texi | 20 ++++- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.h | 3 + 11 files changed, 172 insertions(+), 42 deletions(-) diff --git a/libisoburn/trunk/libisoburn/libisoburn.ver b/libisoburn/trunk/libisoburn/libisoburn.ver index b6aaf6e6..325e4d7f 100644 --- a/libisoburn/trunk/libisoburn/libisoburn.ver +++ b/libisoburn/trunk/libisoburn/libisoburn.ver @@ -143,6 +143,7 @@ Xorriso_option_chmodi; Xorriso_option_chowni; Xorriso_option_clone; Xorriso_option_close; +Xorriso_option_close_damaged; Xorriso_option_close_filter_list; Xorriso_option_commit; Xorriso_option_commit_eject; diff --git a/libisoburn/trunk/xorriso/opts_a_c.c b/libisoburn/trunk/xorriso/opts_a_c.c index 45a84e43..1820dc83 100644 --- a/libisoburn/trunk/xorriso/opts_a_c.c +++ b/libisoburn/trunk/xorriso/opts_a_c.c @@ -1745,6 +1745,34 @@ int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag) } +/* Option -close_damaged */ +int Xorriso_option_close_damaged(struct XorrisO *xorriso, char *mode, int flag) +{ + int ret, force= 0; + + if(strcmp(mode, "as_needed") == 0 || strcmp(mode, "") == 0) + force= 0; + else if(strcmp(mode, "force") == 0) + force= 1; + else { + sprintf(xorriso->info_text, "-close_damaged: unknown mode "); + Text_shellsafe(mode, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= Xorriso_reassure(xorriso, "-close_damaged", + "Close damaged track and session", 0); + if(ret <= 0) + {ret= 2; goto ex;} + ret= Xorriso_close_damaged(xorriso, force); + if(ret <= 0) + goto ex; + ret= 1; +ex:; + return(ret); +} + + /* Option -close_filter_list */ int Xorriso_option_close_filter_list(struct XorrisO *xorriso, int flag) { diff --git a/libisoburn/trunk/xorriso/opts_d_h.c b/libisoburn/trunk/xorriso/opts_d_h.c index c945bea6..5a0960cb 100644 --- a/libisoburn/trunk/xorriso/opts_d_h.c +++ b/libisoburn/trunk/xorriso/opts_d_h.c @@ -1449,6 +1449,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " Classify stdio drives by effective access permissions.", " -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"", " Blank media resp. invalidate ISO image on media.", +" -close_damaged \"as_needed\"|\"force\"", +" Close track and session of damaged media.", " -format \"as_needed\"|\"full\"|\"fast\"|\"by_index_#\"|\"by_size_#\"", " Format BD-RE, BD-R, DVD-RAM, DVD-RW, DVD+RW.", " -volid volume_id", diff --git a/libisoburn/trunk/xorriso/parse_exec.c b/libisoburn/trunk/xorriso/parse_exec.c index 1728643e..c8e85aa4 100644 --- a/libisoburn/trunk/xorriso/parse_exec.c +++ b/libisoburn/trunk/xorriso/parse_exec.c @@ -458,7 +458,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, "abort_on","acl","add_plainly","application_id","auto_charset", "abstract_file", "backslash_codes","blank","biblio_file", - "calm_drive","cd","cdi","cdx","charset","close", + "calm_drive","cd","cdi","cdx","charset","close","close_damaged", "commit_eject","compliance","copyright_file", "dev","dialog","disk_dev_ino","disk_pattern","displacement", "dummy","dvd_obs","early_stdio_test", "eject", @@ -766,6 +766,10 @@ next_command:; (*idx)++; ret= Xorriso_option_close(xorriso, arg1, 0); + } else if(strcmp(cmd,"close_damaged")==0) { + (*idx)++; + ret= Xorriso_option_close_damaged(xorriso, arg1, 0); + } else if(strcmp(cmd,"close_filter_list")==0) { ret= Xorriso_option_close_filter_list(xorriso, 0); diff --git a/libisoburn/trunk/xorriso/write_run.c b/libisoburn/trunk/xorriso/write_run.c index 17cf4f21..c0b84307 100644 --- a/libisoburn/trunk/xorriso/write_run.c +++ b/libisoburn/trunk/xorriso/write_run.c @@ -2513,3 +2513,40 @@ ex: return(ret); } + +/* @param flag bit0=force burn_disc_close_damaged() +*/ +int Xorriso_close_damaged(struct XorrisO *xorriso, int flag) +{ + int ret; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + struct burn_write_opts *burn_options= NULL; + + if(xorriso->volset_change_pending) { + sprintf(xorriso->info_text, + "Image changes pending. -commit or -rollback first"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to closed damaged session", 2); + if(ret<=0) + goto ex; + ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); + if(ret <= 0) + goto ex; + ret= burn_disc_close_damaged(burn_options, flag & 1); + Xorriso_process_msg_queues(xorriso, 0); + Xorriso_option_dev(xorriso, "", 3 | 4); /* Give up drives */ + if(ret <= 0) + goto ex; + + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso, 0); + if(burn_options != NULL) + burn_write_opts_free(burn_options); + return(ret); +} + diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index b5d6d453..dfbcf166 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.0.9, May 29, 2011" +.TH XORRISO 1 "Version 1.0.9, Jun 01, 2011" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -2049,6 +2049,22 @@ MMC format codes are manifold. Most important are: .br Smaller format size with DVD\-RAM, BD\-RE, or BD\-R means more reserve space. .TP +\fB\-close_damaged\fR "as_needed"|"force" +Try to close the upcomming track and session if the drive reported the media +as damaged. This may apply to CD\-R, CD\-RW, DVD\-R, DVD\-RW, DVD+R, DVD+R DL, +or BD\-R media. It is indicated by warning messages when the drive gets +aquired, and by a remark "but next track is damaged" with the line +"Media status :" of command \-toc. +.br +The setting of option \-close determines whether the media stays appendable. +.br +Mode "as_needed" gracefully refuses on media which are not reported as +damaged. Mode "force" attempts the close operation even with media which +appear undamaged. +.br +No image changes are allowed to be pending before this command is performed. +After closing was attempted, both drives are given up. +.TP \fB\-list_profiles\fR "in"|"out"|"all" Put out a list of media types supported by \-indev, resp. \-outdev, resp. both. The currently recognized type is marked by text "(current)". diff --git a/libisoburn/trunk/xorriso/xorriso.h b/libisoburn/trunk/xorriso/xorriso.h index 0f07f3ad..ab635e41 100644 --- a/libisoburn/trunk/xorriso/xorriso.h +++ b/libisoburn/trunk/xorriso/xorriso.h @@ -724,6 +724,11 @@ int Xorriso_option_clone(struct XorrisO *xorriso, char *origin, char *dest, /* Option -close "on"|"off" */ int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag); +/* Option -close_damaged */ +/* @since 1.1.0 */ +int Xorriso_option_close_damaged(struct XorrisO *xorriso, char *mode, + int flag); + /* Option -close_filter_list */ int Xorriso_option_close_filter_list(struct XorrisO *xorriso, int flag); diff --git a/libisoburn/trunk/xorriso/xorriso.info b/libisoburn/trunk/xorriso/xorriso.info index 8c683b0b..259abf60 100644 --- a/libisoburn/trunk/xorriso/xorriso.info +++ b/libisoburn/trunk/xorriso/xorriso.info @@ -1828,6 +1828,20 @@ File: xorriso.info, Node: Writing, Next: SetWrite, Prev: Filter, Up: Options Smaller format size with DVD-RAM, BD-RE, or BD-R means more reserve space. +-close_damaged "as_needed"|"force" + Try to close the upcomming track and session if the drive reported + the media as damaged. This may apply to CD-R, CD-RW, DVD-R, + DVD-RW, DVD+R, DVD+R DL, or BD-R media. It is indicated by warning + messages when the drive gets aquired, and by a remark "but next + track is damaged" with the line "Media status :" of command -toc. + The setting of option -close determines whether the media stays + appendable. + Mode "as_needed" gracefully refuses on media which are not + reported as damaged. Mode "force" attempts the close operation + even with media which appear undamaged. + No image changes are allowed to be pending before this command is + performed. After closing was attempted, both drives are given up. + -list_profiles "in"|"out"|"all" Put out a list of media types supported by -indev, resp. -outdev, resp. both. The currently recognized type is marked by text @@ -4192,6 +4206,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -chown_r sets ownership in ISO image: Manip. (line 47) * -clone copies ISO directory tree: Insert. (line 171) * -close controls media closing: SetWrite. (line 262) +* -close_damaged closes damaged track and session: Writing. (line 122) * -close_filter_list bans filter registration: Filter. (line 52) * -commit writes pending ISO image: Writing. (line 13) * -commit_eject writes and ejects: Writing. (line 40) @@ -4255,7 +4270,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -joliet enables production of Joliet tree: SetWrite. (line 10) * -list_delimiter replaces '--': Scripting. (line 42) * -list_formats lists available formats: Writing. (line 110) -* -list_profiles lists supported media: Writing. (line 122) +* -list_profiles lists supported media: Writing. (line 136) * -load addresses a particular session as input: Loading. (line 11) * -local_charset sets terminal character set: Charset. (line 47) * -logfile logs output channels to file: Frontend. (line 20) @@ -4396,6 +4411,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Create, new ISO image, _definiton: Methods. (line 6) * Cylinder alignment, _definiton: Bootable. (line 169) * Cylinder size, _definiton: Bootable. (line 158) +* Damaged track and session, close, -close_damaged: Writing. (line 122) * Delete, from ISO image, -rm: Manip. (line 21) * Delete, from ISO image, -rm_r: Manip. (line 28) * Delete, ISO directory, -rmdir: Manip. (line 32) @@ -4418,7 +4434,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Drive, for input, -indev: AqDrive. (line 22) * Drive, for output, -outdev: AqDrive. (line 29) * Drive, get drive list, -devices: Inquiry. (line 7) -* Drive, list supported media, -list_profiles: Writing. (line 122) +* Drive, list supported media, -list_profiles: Writing. (line 136) * Drive, reduce activity, -calm_drive: Loading. (line 235) * Drive, report SCSI commands, -scsi_log: Scripting. (line 125) * Drive, write and eject, -commit_eject: Writing. (line 40) @@ -4634,41 +4650,41 @@ Node: Manip60375 Node: CmdFind69060 Node: Filter80363 Node: Writing84720 -Node: SetWrite91164 -Node: Bootable105210 -Node: Jigdo118530 -Node: Charset122794 -Node: Exception125553 -Node: DialogCtl131693 -Node: Inquiry134280 -Node: Navigate138663 -Node: Verify146603 -Node: Restore155198 -Node: Emulation161858 -Node: Scripting171731 -Node: Frontend177881 -Node: Examples179180 -Node: ExDevices180351 -Node: ExCreate180989 -Node: ExDialog182263 -Node: ExGrowing183525 -Node: ExModifying184327 -Node: ExBootable184828 -Node: ExCharset185377 -Node: ExPseudo186205 -Node: ExCdrecord187103 -Node: ExMkisofs187418 -Node: ExGrowisofs188756 -Node: ExException189891 -Node: ExTime190345 -Node: ExIncBackup190804 -Node: ExRestore194728 -Node: ExRecovery195697 -Node: Files196263 -Node: Seealso197561 -Node: Bugreport198149 -Node: Legal198730 -Node: CommandIdx199660 -Node: ConceptIdx214328 +Node: SetWrite91955 +Node: Bootable106001 +Node: Jigdo119321 +Node: Charset123585 +Node: Exception126344 +Node: DialogCtl132484 +Node: Inquiry135071 +Node: Navigate139454 +Node: Verify147394 +Node: Restore155989 +Node: Emulation162649 +Node: Scripting172522 +Node: Frontend178672 +Node: Examples179971 +Node: ExDevices181142 +Node: ExCreate181780 +Node: ExDialog183054 +Node: ExGrowing184316 +Node: ExModifying185118 +Node: ExBootable185619 +Node: ExCharset186168 +Node: ExPseudo186996 +Node: ExCdrecord187894 +Node: ExMkisofs188209 +Node: ExGrowisofs189547 +Node: ExException190682 +Node: ExTime191136 +Node: ExIncBackup191595 +Node: ExRestore195519 +Node: ExRecovery196488 +Node: Files197054 +Node: Seealso198352 +Node: Bugreport198940 +Node: Legal199521 +Node: CommandIdx200451 +Node: ConceptIdx215192  End Tag Table diff --git a/libisoburn/trunk/xorriso/xorriso.texi b/libisoburn/trunk/xorriso/xorriso.texi index cd0322b5..cb6952a1 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.0.9, May 29, 2011" +@c man .TH XORRISO 1 "Version 1.0.9, Jun 01, 2011" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -2459,6 +2459,24 @@ MMC format codes are manifold. Most important are: @* Smaller format size with DVD-RAM, BD-RE, or BD-R means more reserve space. @c man .TP +@item -close_damaged "as_needed"|"force" +@kindex -close_damaged closes damaged track and session +@cindex Damaged track and session, close, -close_damaged +Try to close the upcomming track and session if the drive reported the media +as damaged. This may apply to CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, DVD+R DL, +or BD-R media. It is indicated by warning messages when the drive gets +aquired, and by a remark "but next track is damaged" with the line +"Media status :" of command -toc. +@* +The setting of option -close determines whether the media stays appendable. +@* +Mode "as_needed" gracefully refuses on media which are not reported as +damaged. Mode "force" attempts the close operation even with media which +appear undamaged. +@* +No image changes are allowed to be pending before this command is performed. +After closing was attempted, both drives are given up. +@c man .TP @item -list_profiles "in"|"out"|"all" @kindex -list_profiles lists supported media @cindex Drive, list supported media, -list_profiles diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 2922efed..8ff0b896 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2011.05.31.092902" +#define Xorriso_timestamP "2011.06.01.165129" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.h b/libisoburn/trunk/xorriso/xorrisoburn.h index 25f3829d..03f5f164 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.h +++ b/libisoburn/trunk/xorriso/xorrisoburn.h @@ -574,6 +574,9 @@ int Xorriso_mark_update_merge(struct XorrisO *xorriso, char *path, */ int Xorriso_set_signal_handling(struct XorrisO *xorriso, int flag); +/* @param flag bit0=force burn_disc_close_damaged() +*/ +int Xorriso_close_damaged(struct XorrisO *xorriso, int flag); #endif /* Xorrisoburn_includeD */