New option -early_drive_test

master
Thomas Schmitt 12 years ago
parent cf49e83893
commit 08e112c687
  1. 1
      libisoburn/libisoburn.ver
  2. 3
      xorriso/base_obj.c
  3. 43
      xorriso/drive_mgt.c
  4. 19
      xorriso/opts_d_h.c
  5. 6
      xorriso/parse_exec.c
  6. 6
      xorriso/text_io.c
  7. 20
      xorriso/write_run.c
  8. 12
      xorriso/xorriso.1
  9. 5
      xorriso/xorriso.h
  10. 97
      xorriso/xorriso.info
  11. 14
      xorriso/xorriso.texi
  12. 7
      xorriso/xorriso_private.h
  13. 2
      xorriso/xorriso_timestamp.h

@ -161,6 +161,7 @@ Xorriso_option_displacement;
Xorriso_option_drive_class;
Xorriso_option_dummy;
Xorriso_option_dvd_obs;
Xorriso_option_early_drive_test;
Xorriso_option_eject;
Xorriso_option_end;
Xorriso_option_errfile_log;

@ -183,6 +183,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->displacement= 0;
m->displacement_sign= 0;
m->drives_exclusive= 1;
m->early_stdio_test= 0;
m->do_calm_drive= 1;
m->indev[0]= 0;
m->in_drive_handle= NULL;
@ -306,7 +307,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->errfile_mode= 0;
m->errfile_fp= NULL;
m->img_read_error_mode= 2; /* abort faulty image reading with FATAL */
m->img_read_error_mode= 1; /* abort faulty image reading with FAILURE */
m->extract_error_mode= 1; /* keep extracted files after read error */
strcpy(m->return_with_text, "SORRY");
Xorriso__text_to_sev(m->return_with_text, &m->return_with_severity, 0);

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net>
Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
@ -225,6 +225,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
if((xorriso->ino_behavior & (1 | 2)) && !(xorriso->do_aaip & (4 | 32)))
aquire_flag|= 64;
burn_preset_device_open(xorriso->drives_exclusive, 0, 0);
burn_allow_drive_role_4(1 | (xorriso->early_stdio_test & 6));
ret= isoburn_drive_aquire(&dinfo, libburn_adr, aquire_flag);
burn_preset_device_open(1, 0, 0);
Xorriso_process_msg_queues(xorriso,0);
@ -832,14 +833,18 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
if(profile_no == 0x0002 && s == BURN_DISC_EMPTY)
profile_no= 0;
sprintf(respt, "Media current: ");
drive_role= burn_drive_get_drive_role(drive);
if (profile_no > 0 && ret > 0) {
if (profile_name[0])
sprintf(respt+strlen(respt), "%s", profile_name);
else
sprintf(respt+strlen(respt), "%4.4Xh", profile_no);
drive_role= burn_drive_get_drive_role(drive);
if(drive_role==2)
sprintf(respt+strlen(respt), ", overwriteable");
else if(drive_role == 4)
sprintf(respt+strlen(respt), ", random read-only");
else if(drive_role == 5)
sprintf(respt+strlen(respt), ", random write-only");
else if(drive_role==0 || drive_role==3)
sprintf(respt+strlen(respt), ", sequential");
strcat(respt, "\n");
@ -898,15 +903,21 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
if (disc==NULL) {
Xorriso_process_msg_queues(xorriso,0);
ret= isoburn_get_min_start_byte(drive, &start_byte, 0);
nwa= start_byte / 2048;
if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0);
if(flag&1)
if(drive_role == 5 && s == BURN_DISC_APPENDABLE) {
ret= burn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
if(ret == 1)
num_data= nwa;
} else {
ret= isoburn_get_min_start_byte(drive, &start_byte, 0);
nwa= start_byte / 2048;
if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0);
if(flag&1)
{ret= 0; goto ex;}
sprintf(xorriso->info_text, "Cannot obtain Table Of Content");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
{ret= 0; goto ex;}
sprintf(xorriso->info_text, "Cannot obtain Table Of Content");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
{ret= 0; goto ex;}
}
}
/* fabricate TOC */
@ -921,13 +932,13 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
1, 0, image_blocks, volume_id);
nwa= image_blocks;
} else {
nwa= 0;
nwa= num_data;
ret= burn_disc_get_formats(drive, &status, &size, &dummy,
&num_formats);
if(ret>0 && status==BURN_FORMAT_IS_FORMATTED)
nwa= size/2048;
sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
typetext, 1, 0, nwa);
typetext, 1, num_data, nwa);
}
if(!(flag&1))
Xorriso_toc_line(xorriso, flag & 8);
@ -1023,8 +1034,8 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
{ret= 1; goto ex;}
num_wasted= lba - num_payload;
num_nondata= lba - num_data;
Sfile_scale(((double) num_data) * 2048.0, mem_text,5,1e4,1);
Sfile_scale(((double) num_data) * 2048.0, mem_text,5,1e4,1);
sprintf(respt, "Media summary: %d session%s, %d data blocks, %s data",
num_sessions, (num_sessions==1 ? "" : "s"), num_data, mem_text);
num_free= isoburn_disc_available_space(drive, NULL);
@ -1293,6 +1304,12 @@ int Xorriso_atip(struct XorrisO *xorriso, int flag)
else if(ret==3)
sprintf(respt+strlen(respt), "%s\n",
"Emulated (stdio-drive, sequential write-only)");
else if(ret == 4)
sprintf(respt+strlen(respt), "%s\n",
"Emulated (stdio-drive, 2k random read-only)");
else if(ret == 5)
sprintf(respt+strlen(respt), "%s\n",
"Emulated (stdio-drive, 2k random write-only)");
else if(ret!=1)
sprintf(respt+strlen(respt), "%s\n","Emulated (stdio-drive)");
else

@ -300,6 +300,23 @@ int Xorriso_option_dvd_obs(struct XorrisO *xorriso, char *obs, int flag)
}
/* Option -early_stdio_test */
int Xorriso_option_early_stdio_test(struct XorrisO *xorriso, char *mode,
int flag)
{
if(strcmp(mode, "on") == 0)
xorriso->early_stdio_test= 2 | 4;
else if(strcmp(mode, "off") == 0)
xorriso->early_stdio_test= 0;
else {
sprintf(xorriso->info_text, "-early_stdio_test: unknown mode '%s'", mode);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
return(1);
}
/* Option -eject */
/* @param flag bit0=do not report toc of eventually remaining drives
*/
@ -1414,6 +1431,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Enable production of scdbackup tag with -md5 on",
" -ban_stdio_write",
" Allow for writing only the usage of optical drives.",
" -early_stdio_test",
" Classify stdio drives by effective access permissions.",
" -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"",
" Blank media resp. invalidate ISO image on media.",
" -format \"as_needed\"|\"full\"|\"fast\"|\"by_index_#\"|\"by_size_#\"",

@ -461,7 +461,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
"calm_drive","cd","cdi","cdx","charset","close",
"commit_eject","compliance","copyright_file",
"dev","dialog","disk_dev_ino","disk_pattern","displacement",
"dummy","dvd_obs","eject",
"dummy","dvd_obs","early_stdio_test", "eject",
"iso_rr_pattern","follow","format","fs","gid","grow_blindly","hardlinks",
"history","indev","in_charset","joliet",
"list_delimiter","list_profiles","local_charset",
@ -853,6 +853,10 @@ next_command:;
} else if(strcmp(cmd,"dux")==0 || strcmp(cmd,"dusx")==0) {
ret= Xorriso_option_lsx(xorriso, argc, argv, idx, (cmd[2]!='s')|4);
} else if(strcmp(cmd,"early_stdio_test")==0) {
(*idx)++;
ret= Xorriso_option_early_stdio_test(xorriso, arg1, 0);
} else if(strcmp(cmd,"eject")==0) {
(*idx)++;
ret= Xorriso_option_eject(xorriso, arg1, 0);

@ -1242,6 +1242,12 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
is_default= ((xorriso->early_stdio_test & 6) == 0);
sprintf(line, "-early_stdio_test %s\n",
xorriso->early_stdio_test & 6 ? "on" : "off");
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->allow_restore==0 && xorriso->do_concat_split==1 &&
xorriso->do_auto_chmod==0 && xorriso->drives_exclusive == 1);
mode_pt= "off";

@ -1757,20 +1757,29 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
if(isoburn_needs_emulation(drive)) {
if(flag&1) {
ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &dummy, &nwa);
Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,
"Cannot obtain next writeable address of emulated multi-session media\n");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
}
if(nwa==32)
if(nwa == 32 && disc_state != BURN_DISC_APPENDABLE)
nwa= 0; /* No automatic toc emulation. Formatter might not be aware. */
burn_write_opts_set_start_byte(burn_options,((off_t) nwa) * (off_t) 2048);
} else {
nwa= 0;
burn_write_opts_set_start_byte(burn_options, (off_t) 0);
if (disc_state == BURN_DISC_APPENDABLE) {
ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &dummy, &nwa);
Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) {
sprintf(xorriso->info_text,
"Cannot obtain next writeable address of emulated appendable media\n");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
}
}
}
burn_write_opts_set_start_byte(burn_options,((off_t) nwa) * (off_t) 2048);
}
if(write_start_address>=0) {
@ -2232,8 +2241,11 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
}
if(iso_lba < 32)
return(2);
if(!(flag & 2)) {
/* head_buffer was not filled yet. Read it from output media. */
if(burn_drive_get_drive_role(drive) == 5) /* write-only */
return(2);
if(job != NULL && job->data_to_fd >= 0) {
if((flag & 8) && job->sector_map != NULL) {
ret= Sectorbitmap_bytes_are_set(job->sector_map,

@ -873,6 +873,16 @@ Allow for writing only the usage of MMC optical drives. Disallow
to write the result into files of nearly arbitrary type.
Once set, this command cannot be revoked.
.TP
\fB\-early_stdio_test\fR "on"|"off"
If enabled by "on" then regular files and block devices get tested for
effective access permissions. This implies to try opening those files for
writing, which otherwise will happen only later and only if actual
writing is desired.
.br
The test result is used for classifying the pseudo drives as overwriteable,
read-only, write-only, or uselessly empty. This may lead to earlier detection
of severe problems, and may avoid some less severe error events.
.TP
.B Inserting files into ISO image:
.PP
The following commands expect file addresses of two kinds:
@ -2867,9 +2877,9 @@ if the threshold of option -abort_on allows this.
.br
"failure" aborts image tree reading on first event of at least SORRY.
It issues an own FAILURE event.
This is the default.
.br
"fatal" acts like "failure" but issues the own event as FATAL.
This is the default.
.br
With occasion "file_extraction" there are three behaviors:
.br

@ -802,6 +802,11 @@ int Xorriso_option_dummy(struct XorrisO *xorriso, char *mode, int flag);
/* Option -dvd_obs "default"|"32k"|"64k" */
int Xorriso_option_dvd_obs(struct XorrisO *xorriso, char *obs, int flag);
/* Option -early_stdio_test */
/* @since 1.0.6 */
int Xorriso_option_early_stdio_test(struct XorrisO *xorriso, char *mode,
int flag);
/* Option -eject */
/* @param flag bit0=do not report toc of eventually remaining drives
*/

@ -824,6 +824,16 @@ activate them only after image loading.
to write the result into files of nearly arbitrary type. Once
set, this command cannot be revoked.
-early_stdio_test "on"|"off"
If enabled by "on" then regular files and block devices get tested
for effective access permissions. This implies to try opening
those files for writing, which otherwise will happen only later
and only if actual writing is desired.
The test result is used for classifying the pseudo drives as
overwriteable, read-only, write-only, or uselessly empty. This may
lead to earlier detection of severe problems, and may avoid some
less severe error events.

File: xorriso.info, Node: Insert, Next: SetInsert, Prev: Loading, Up: Options
@ -2531,9 +2541,8 @@ failed unexpectedly.
"best_effort" goes on with reading after events with severity
below FAILURE if the threshold of option -abort_on allows this.
"failure" aborts image tree reading on first event of at least
SORRY. It issues an own FAILURE event.
SORRY. It issues an own FAILURE event. This is the default.
"fatal" acts like "failure" but issues the own event as FATAL.
This is the default.
With occasion "file_extraction" there are three behaviors:
"keep" maintains incompletely extracted files on disk. This is the
default.
@ -4142,6 +4151,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -dusx show directory size on disk: Navigate. (line 101)
* -dux show directory size on disk: Navigate. (line 96)
* -dvd_obs set write block size: SetWrite. (line 236)
* -early_stdio_test classifies stdio drives: Loading. (line 251)
* -eject ejects drive tray: Writing. (line 36)
* -end writes pending session and ends program: Scripting. (line 122)
* -errfile_log logs problematic disk files: Scripting. (line 84)
@ -4326,6 +4336,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* disk_path, _definition: Insert. (line 6)
* Drive, _definiton: Drives. (line 6)
* Drive, accessability, -drive_class: Loading. (line 54)
* Drive, classify stdio, -early_stdio_test: Loading. (line 251)
* Drive, demand real MMC, -ban_stdio_write: Loading. (line 246)
* Drive, eject tray, -eject: Writing. (line 36)
* Drive, for input and output, -dev: AqDrive. (line 10)
@ -4538,46 +4549,46 @@ Node: Dialog21570
Node: Options23227
Node: AqDrive24835
Node: Loading27741
Node: Insert41367
Node: SetInsert50986
Node: Manip59553
Node: CmdFind68234
Node: Filter79534
Node: Writing83883
Node: SetWrite90172
Node: Bootable104113
Node: Jigdo117431
Node: Charset121689
Node: Exception124440
Node: DialogCtl128955
Node: Inquiry131542
Node: Navigate135919
Node: Verify143859
Node: Restore152448
Node: Emulation159104
Node: Scripting168940
Node: Frontend174502
Node: Examples175797
Node: ExDevices176966
Node: ExCreate177600
Node: ExDialog178874
Node: ExGrowing180136
Node: ExModifying180938
Node: ExBootable181439
Node: ExCharset181986
Node: ExPseudo182814
Node: ExCdrecord183708
Node: ExMkisofs184023
Node: ExGrowisofs185359
Node: ExException186483
Node: ExTime186937
Node: ExIncBackup187396
Node: ExRestore191317
Node: ExRecovery192286
Node: Files192852
Node: Seealso194080
Node: Legal194660
Node: CommandIdx195582
Node: ConceptIdx209889
Node: Insert41888
Node: SetInsert51507
Node: Manip60074
Node: CmdFind68755
Node: Filter80055
Node: Writing84404
Node: SetWrite90693
Node: Bootable104634
Node: Jigdo117952
Node: Charset122210
Node: Exception124961
Node: DialogCtl129472
Node: Inquiry132059
Node: Navigate136436
Node: Verify144376
Node: Restore152965
Node: Emulation159621
Node: Scripting169457
Node: Frontend175019
Node: Examples176314
Node: ExDevices177483
Node: ExCreate178117
Node: ExDialog179391
Node: ExGrowing180653
Node: ExModifying181455
Node: ExBootable181956
Node: ExCharset182503
Node: ExPseudo183331
Node: ExCdrecord184225
Node: ExMkisofs184540
Node: ExGrowisofs185876
Node: ExException187000
Node: ExTime187454
Node: ExIncBackup187913
Node: ExRestore191834
Node: ExRecovery192803
Node: Files193369
Node: Seealso194597
Node: Legal195177
Node: CommandIdx196099
Node: ConceptIdx210479

End Tag Table

@ -1096,6 +1096,18 @@ Mode "on" causes -calm_drive to be performed automatically after each -dev,
Allow for writing only the usage of MMC optical drives. Disallow
to write the result into files of nearly arbitrary type.
Once set, this command cannot be revoked.
@c man .TP
@item -early_stdio_test "on"|"off"
@kindex -early_stdio_test classifies stdio drives
@cindex Drive, classify stdio, -early_stdio_test
If enabled by "on" then regular files and block devices get tested for
effective access permissions. This implies to try opening those files for
writing, which otherwise will happen only later and only if actual
writing is desired.
@*
The test result is used for classifying the pseudo drives as overwriteable,
read-only, write-only, or uselessly empty. This may lead to earlier detection
of severe problems, and may avoid some less severe error events.
@end table
@c man .TP
@c man .B Inserting files into ISO image:
@ -3379,9 +3391,9 @@ if the threshold of option -abort_on allows this.
@*
"failure" aborts image tree reading on first event of at least SORRY.
It issues an own FAILURE event.
This is the default.
@*
"fatal" acts like "failure" but issues the own event as FATAL.
This is the default.
@*
With occasion "file_extraction" there are three behaviors:
@*

@ -251,6 +251,13 @@ struct XorrisO { /* the global context of xorriso */
int drives_exclusive; /* burn_preset_device_open() param exclusive */
int early_stdio_test; /* For burn_allow_drive_role_4():
bit1= Test whether a stdio drive can be opened for
read-write resp. read-only resp. write only.
bit2= Classify files which cannot be opened at all
as role 0 : useless dummy.
*/
int do_calm_drive; /* bit0= calm down drive after aquiring it */
char indev[SfileadrL];

@ -1 +1 @@
#define Xorriso_timestamP "2011.03.21.093208"
#define Xorriso_timestamP "2011.03.21.093705"

Loading…
Cancel
Save