New -close mode "as_needed"

This commit is contained in:
Thomas Schmitt 2013-10-20 12:56:01 +00:00
parent 64e2dd244b
commit 491f0713b8
12 changed files with 137 additions and 77 deletions

View File

@ -3,7 +3,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2012 Thomas Schmitt, <scdbackup@gmx.net>
Copyright 2007-2013 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
@ -227,6 +227,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->ban_stdio_write= 0;
m->do_dummy= 0;
m->do_close= 0;
m->auto_close= 0;
m->write_speed= 0; /* max */
m->read_speed= -2; /* do not set */
m->fs= 4*512; /* 4 MiB */

View File

@ -108,7 +108,7 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
int do_atip= 0, do_checkdrive= 0, do_eject= 0, do_scanbus= 0;
int do_toc= 0, do_verbous= 0, do_version= 0, do_help= 0, do_waiti= 0;
int do_multi= 0, do_msinfo= 0, do_grow= 0, do_isosize= 0, do_xa1= 0;
double write_start_address= -1.0, tsize= -1.0;
double write_start_address= -1.0, tsize= -1.0, mem_auto_close;
char *track_source= NULL, *dev_adr= NULL, *cpt;
char mem_report_about_text[80], *report_about= "SORRY", blank_mode[80];
char speed[80], *argpt;
@ -165,6 +165,7 @@ static char blank_help[][80]= {
};
mem_do_close= xorriso->do_close;
mem_auto_close= xorriso->auto_close;
Xorriso_alloc_meM(track_source, char, SfileadrL);
Xorriso_alloc_meM(dev_adr, char, SfileadrL);
@ -510,6 +511,7 @@ no_volunteer:;
}
if(track_source[0]) {
xorriso->do_close= !do_multi;
xorriso->auto_close= 0;
ret= Xorriso_burn_track(xorriso, (off_t) write_start_address,
track_source, (off_t) tsize,
(!!do_grow) | ((!!do_isosize) << 1) | ((do_xa1 == 1) << 2));
@ -534,6 +536,7 @@ ex:;
}
Xorriso_option_report_about(xorriso, mem_report_about_text, 0);
xorriso->do_close= mem_do_close;
xorriso->auto_close= mem_auto_close;
Xorriso_free_meM(dev_adr);
Xorriso_free_meM(track_source);
return(ret);

View File

@ -1913,10 +1913,19 @@ int Xorriso_option_clone(struct XorrisO *xorriso, char *origin, char *dest,
}
/* Option -close "on"|"off" */
/* Option -close "on"|"off"|"as_needed" */
int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag)
{
xorriso->do_close= !!strcmp(mode, "off");
if(strcmp(mode, "off") == 0) {
xorriso->do_close= 0;
xorriso->auto_close= 0;
} else if(strcmp(mode, "as_needed") == 0) {
xorriso->do_close= 0;
xorriso->auto_close= 1;
} else {
xorriso->do_close= 1;
xorriso->auto_close= 0;
}
return(1);
}

View File

@ -1900,7 +1900,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" 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\"",
" -close \"on\"|\"off\"|\"as_needed\"",
" If \"on\" then mark the written medium as not appendable.",
" -padding number[\"k\"|\"m\"]|\"included\"|\"appended\"",
" Append extra bytes to image stream. (Default is 300k)",

View File

@ -3045,8 +3045,14 @@ 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_close;
sprintf(line,"-close %s\n",(xorriso->do_close ? "on" : "off"));
is_default= (xorriso->read_speed == -2);
sprintf(line,"-read_speed %s\n", Xorriso__speedname(xorriso->read_speed));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= !(xorriso->auto_close || xorriso->do_close);
sprintf(line,"-close %s\n",xorriso->auto_close ? "as_needed" :
xorriso->do_close ? "on" : "off");
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
@ -3379,11 +3385,6 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
}
}
is_default= (xorriso->read_speed == -2);
sprintf(line,"-read_speed %s\n", Xorriso__speedname(xorriso->read_speed));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
do_single= 0;
dev_filter= filter;
if(dev_filter != NULL) {

View File

@ -67,6 +67,8 @@ int Xorriso_check_multi(struct XorrisO *xorriso, struct burn_drive *drive,
struct burn_multi_caps *caps= NULL;
char profile_name[80];
if(xorriso->auto_close)
xorriso->do_close= 0;
if(!xorriso->do_close) {
burn_disc_get_profile(drive, &profile_no, profile_name);
if(profile_no == 0x14) { /* DVD-RW sequential */
@ -74,7 +76,12 @@ int Xorriso_check_multi(struct XorrisO *xorriso, struct burn_drive *drive,
if(caps != NULL)
burn_disc_free_multi_caps(&caps);
if(ret == 0) {
if(flag & 1) {
if(xorriso->auto_close) {
sprintf(xorriso->info_text,
"-close \"as_needed\" triggered -close \"on\"");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
xorriso->do_close= 1;
} else if(flag & 1) {
sprintf(xorriso->info_text,
"This DVD-RW media can only be written without option -multi");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
@ -84,6 +91,7 @@ int Xorriso_check_multi(struct XorrisO *xorriso, struct burn_drive *drive,
sprintf(xorriso->info_text,
"After writing a session without -multi, apply blank=all");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
return(0);
} else {
sprintf(xorriso->info_text,
"This DVD-RW media can only be written with -close \"on\"");
@ -94,18 +102,26 @@ int Xorriso_check_multi(struct XorrisO *xorriso, struct burn_drive *drive,
sprintf(xorriso->info_text,
"After writing a session with -close \"on\", apply -blank \"all\"");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
return(0);
}
return(0);
}
} else if(profile_no == 0x15) { /* DVD-RW DL */
if(flag & 1)
if(xorriso->auto_close) {
sprintf(xorriso->info_text,
"-close \"as_needed\" triggered -close \"on\"");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
xorriso->do_close= 1;
} else if(flag & 1) {
sprintf(xorriso->info_text,
"DVD-R DL media can only be written without option -multi");
else
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
} else {
sprintf(xorriso->info_text,
"DVD-R DL media can only be written with -close \"on\"");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
}
}
return(1);
@ -2728,9 +2744,12 @@ int Xorriso_close_damaged(struct XorrisO *xorriso, int flag)
ret= 0; goto ex;
}
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to closed damaged session", 2);
"on attempt to close damaged session", 2);
if(ret<=0)
goto ex;
ret= Xorriso_check_multi(xorriso, drive, 0);
if(ret<=0)
goto ex;
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
if(ret <= 0)
goto ex;

View File

@ -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.3, Oct 08, 2013"
.TH XORRISO 1 "Version 1.3.3, Oct 14, 2013"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -2769,12 +2769,21 @@ is 4 MiB, minimum 64 kiB, maximum 1 GiB.
The number may be followed by letter "k" or "m"
which means unit is kiB (= 1024) or MiB (= 1024 kiB).
.TP
\fB\-close\fR "on"|"off"
If "on" then mark the written medium as not appendable
any more (if possible at all with the given type of target media).
.br
This is the contrary of cdrecord, wodim, cdrskin command \-multi,
\fB\-close\fR "on"|"off"|"as_needed"
If \-close is set to "on" then mark the written medium as not appendable
any more. This will have no effect on overwritable media types.
Setting "on" is the contrary of cdrecord option \-multi,
and is one aspect of growisofs option \-dvd\-compat.
.br
If set to "off" then keep the medium writable for an appended session.
.br
If set to "as_needed" then use "on" only if "off" is predicted to
fail with the given medium and its state. But not all drives correctly
recognize fast\-blanked DVD\-RW which need "on".
.br
Note that emulation command \-as "cdrecord" temporarily overrides
the current setting of \-close by its own default \-close "on" if
its option \-multi is missing.
.TP
\fB\-write_type\fR "auto"|"tao"|"sao/dao"
Set the write type for the next burn run. "auto" will select SAO with blank

View File

@ -1353,7 +1353,7 @@ int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid,
int Xorriso_option_clone(struct XorrisO *xorriso, char *origin, char *dest,
int flag);
/* Command -close "on"|"off" */
/* Command -close "on"|"off"| @since 1.3.4 "as_needed" */
int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag);
/* Command -close_damaged */

View File

@ -2446,11 +2446,19 @@ according to the setting of command -acl.
letter "k" or "m" which means unit is kiB (= 1024) or MiB (= 1024
kiB).
-close "on"|"off"
If "on" then mark the written medium as not appendable 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.
-close "on"|"off"|"as_needed"
If -close is set to "on" then mark the written medium as not
appendable any more. This will have no effect on overwritable
media types. Setting "on" is the contrary of cdrecord option
-multi, and is one aspect of growisofs option -dvd-compat.
If set to "off" then keep the medium writable for an appended
session.
If set to "as_needed" then use "on" only if "off" is predicted to
fail with the given medium and its state. But not all drives
correctly recognize fast-blanked DVD-RW which need "on".
Note that emulation command -as "cdrecord" temporarily overrides
the current setting of -close by its own default -close "on" if
its option -multi is missing.
-write_type "auto"|"tao"|"sao/dao"
Set the write type for the next burn run. "auto" will select SAO
@ -4968,7 +4976,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 163)
* -padding sets amount or mode of image padding: SetWrite. (line 367)
* -padding sets amount or mode of image padding: SetWrite. (line 375)
* -page set terminal geometry: DialogCtl. (line 19)
* -paste_in copies file into disk file: Restore. (line 124)
* -path_list inserts paths from disk file: Insert. (line 79)
@ -5043,7 +5051,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 181)
* -volume_date sets volume timestamp: SetWrite. (line 208)
* -write_type chooses TAO or SAO/DAO: SetWrite. (line 359)
* -write_type chooses TAO or SAO/DAO: SetWrite. (line 367)
* -x enables automatic execution order of arguments: ArgSort.
(line 16)
* -xattr controls handling of xattr (EA): Loading. (line 176)
@ -5327,12 +5335,12 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Write, free space, -tell_media_space: Inquiry. (line 104)
* Write, log problematic disk files, -errfile_log: Scripting. (line 129)
* Write, log written sessions, -session_log: Scripting. (line 149)
* Write, padding image, -padding: SetWrite. (line 367)
* Write, padding image, -padding: SetWrite. (line 375)
* Write, pending ISO image, -commit: Writing. (line 29)
* Write, predict image size, -print_size: Inquiry. (line 91)
* Write, set speed, -speed: SetWrite. (line 298)
* Write, simulation, -dummy: SetWrite. (line 342)
* Write, TAO or SAO/DAO, -write_type: SetWrite. (line 359)
* Write, TAO or SAO/DAO, -write_type: SetWrite. (line 367)
* xattr, _definition: Extras. (line 65)
* xattr, control handling, -xattr: Loading. (line 176)
* xattr, set in ISO image, -setfattr: Manip. (line 118)
@ -5364,40 +5372,40 @@ Node: CmdFind75955
Node: Filter90997
Node: Writing95553
Node: SetWrite105545
Node: Bootable125256
Node: Jigdo141646
Node: Charset145893
Node: Exception148655
Node: DialogCtl154775
Node: Inquiry157373
Node: Navigate163690
Node: Verify171988
Node: Restore181020
Node: Emulation188107
Node: Scripting198409
Node: Frontend206180
Node: Examples215787
Node: ExDevices216965
Node: ExCreate217624
Node: ExDialog218909
Node: ExGrowing220174
Node: ExModifying220979
Node: ExBootable221483
Node: ExCharset222035
Node: ExPseudo222856
Node: ExCdrecord223754
Node: ExMkisofs224071
Node: ExGrowisofs225411
Node: ExException226546
Node: ExTime227000
Node: ExIncBackup227459
Node: ExRestore231439
Node: ExRecovery232372
Node: Files232942
Node: Seealso234241
Node: Bugreport234964
Node: Legal235545
Node: CommandIdx236556
Node: ConceptIdx253218
Node: Bootable125728
Node: Jigdo142118
Node: Charset146365
Node: Exception149127
Node: DialogCtl155247
Node: Inquiry157845
Node: Navigate164162
Node: Verify172460
Node: Restore181492
Node: Emulation188579
Node: Scripting198881
Node: Frontend206652
Node: Examples216259
Node: ExDevices217437
Node: ExCreate218096
Node: ExDialog219381
Node: ExGrowing220646
Node: ExModifying221451
Node: ExBootable221955
Node: ExCharset222507
Node: ExPseudo223328
Node: ExCdrecord224226
Node: ExMkisofs224543
Node: ExGrowisofs225883
Node: ExException227018
Node: ExTime227472
Node: ExIncBackup227931
Node: ExRestore231911
Node: ExRecovery232844
Node: Files233414
Node: Seealso234713
Node: Bugreport235436
Node: Legal236017
Node: CommandIdx237028
Node: ConceptIdx253690

End Tag Table

View File

@ -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.3, Oct 08, 2013"
@c man .TH XORRISO 1 "Version 1.3.3, Oct 14, 2013"
@c man .\" Please adjust this date whenever revising the manpage.
@c man .\"
@c man .\" Some roff macros, for reference:
@ -3271,14 +3271,23 @@ is 4 MiB, minimum 64 kiB, maximum 1 GiB.
The number may be followed by letter "k" or "m"
which means unit is kiB (= 1024) or MiB (= 1024 kiB).
@c man .TP
@item -close "on"|"off"
@item -close "on"|"off"|"as_needed"
@kindex -close controls media closing
@cindex Write, close media, -close
If "on" then mark the written medium as not appendable
any more (if possible at all with the given type of target media).
@*
This is the contrary of cdrecord, wodim, cdrskin command -multi,
If -close is set to "on" then mark the written medium as not appendable
any more. This will have no effect on overwritable media types.
Setting "on" is the contrary of cdrecord option -multi,
and is one aspect of growisofs option -dvd-compat.
@*
If set to "off" then keep the medium writable for an appended session.
@*
If set to "as_needed" then use "on" only if "off" is predicted to
fail with the given medium and its state. But not all drives correctly
recognize fast-blanked DVD-RW which need "on".
@*
Note that emulation command -as "cdrecord" temporarily overrides
the current setting of -close by its own default -close "on" if
its option -multi is missing.
@c man .TP
@item -write_type "auto"|"tao"|"sao/dao"
@kindex -write_type chooses TAO or SAO/DAO

View File

@ -341,6 +341,7 @@ struct XorrisO { /* the global context of xorriso */
int ban_stdio_write;
int do_dummy;
int do_close;
int auto_close; /* Whether to let do_close depend on media state */
int write_speed; /* Write speed in libburn units : 1000 bytes/second ,
0 = Max, -1 = Min, -2= do not set */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2013.10.14.140028"
#define Xorriso_timestamP "2013.10.20.125455"