New -osirrox sub-options o_excl_on/off. Program osirrox starts with o_excl_off.

This commit is contained in:
Thomas Schmitt 2009-09-19 16:09:21 +00:00
parent d9665979ab
commit 4feba8b2df
5 changed files with 159 additions and 25 deletions

View File

@ -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 "Aug 31, 2009"
.TH XORRISO 1 "Sep 19, 2009"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -2752,6 +2752,14 @@ allows to restore large numbers of hard links without exhausting
-temp_mem_limit. It does not preserve directory mtime and it needs
-osirrox option auto_chmod_on in order to extract directories which offer no
write permission. Default is "sort_lba_off".
.br
Option "o_excl_on" is the default unless the program was started with leafname
"osirrox". On Linux it tries to avoid using drives which are mounted or in
use by other libburn programs.
Option "o_excl_off" allows on Linux to access such drives. Drives which
get aquired while "o_excl_off" will refuse to get blanked, formatted,
written, or ejected. But be aware that even harmless inquiries can spoil
ongoing burns of CD-R[W] and DVD-R[W].
.TP
\fB\-extract\fR iso_rr_path disk_path
Restore the file objects at and underneath iso_rr_path to their corresponding
@ -2946,13 +2954,17 @@ X of Y MB written (fifo nn%) [buf mmm%]
.br
nn% done, estimate finish Tue Jul 15 20:13:28 2008
.TP
\fB\-scdbackup_tag\fR name timestamp
Set the parameters "name" and "timestamp" for an scdbackup checksum tag.
It will be appended to the -md5 session tag if the image starts at LBA 0,
which is the case if output gets written as first session onto a sequential
media, or piped into a program, named pipe or character device.
\fB\-scdbackup_tag\fR list_path record_name
Set the parameter "name" for a scdbackup checksum record.
It will be appended in an scdbackup checksum tag to the -md5 session tag if
the image starts at LBA 0. This is the case if it gets written as first
session onto a sequential media, or piped into a program, named pipe or
character device.
.br
Program scdbackup_verify will recognize and verify these tags.
If list_path is not empty then the record will also be appended to the
data file given by this path.
.br
Program scdbackup_verify will recognize and verify tag resp. record.
.TP
.B Scripting, dialog and program control features:
.TP

View File

@ -4739,12 +4739,14 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->toc_emulation_flag= 0;
m->image_start_mode= 0;
m->image_start_value[0]= 0;
m->drives_exclusive= 1;
m->do_calm_drive= 1;
m->indev[0]= 0;
m->in_drive_handle= NULL;
m->in_volset_handle= NULL;
m->in_charset= NULL;
m->isofs_st_out= time(0) - 1;
m->indev_is_exclusive= 1;
m->isofs_st_in= 0;
m->volset_change_pending= 0;
m->no_volset_present= 0;
@ -4754,6 +4756,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->out_drive_handle= NULL;
m->out_charset= NULL;
m->dev_fd_1= -1;
m->outdev_is_exclusive= 1;
m->grow_blindly_msc2= -1;
m->ban_stdio_write= 0;
m->do_dummy= 0;
@ -4882,9 +4885,10 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
ret= Sfile_leafname(progname, leafname, 0);
if(ret<=0)
goto failure;
if(strcmp(leafname, "osirrox")==0)
if(strcmp(leafname, "osirrox")==0) {
m->allow_restore= 1;
else if(strcmp(leafname, "xorrisofs")==0 || strcmp(leafname, "genisofs")==0 ||
m->drives_exclusive= 0;
} else if(strcmp(leafname, "xorrisofs")==0 || strcmp(leafname, "genisofs")==0 ||
strcmp(leafname, "mkisofs")==0 || strcmp(leafname, "genisoimage")==0) {
m->argument_emulation= 1;
m->pacifier_style= 1;
@ -6545,8 +6549,10 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
*/
{
int is_default, no_defaults, i, ret, adr_mode, bin_path_in_use= 0, do_single;
int show_indev= 1, show_outdev= 1, show_dev= 0;
char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment;
char *in_pt, *out_pt, *nl_charset, *local_charset, *mode_pt;
char *dev_filter= NULL;
static char channel_prefixes[4][4]= {".","R","I","M"};
static char load_names[][20]= {"auto", "session", "track", "lba", "volid"};
static int max_load_mode= 4;
@ -6702,7 +6708,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
}
is_default= (xorriso->allow_restore==0 && xorriso->do_concat_split==1 &&
xorriso->do_auto_chmod==0);
xorriso->do_auto_chmod==0 && xorriso->drives_exclusive == 1);
mode_pt= "off";
if(xorriso->allow_restore == -1)
mode_pt= "banned";
@ -6713,10 +6719,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(xorriso->allow_restore == -1)
sprintf(line,"-osirrox %s\n", mode_pt);
else
sprintf(line,"-osirrox %s:%s:%s:%s\n", mode_pt,
sprintf(line,"-osirrox %s:%s:%s:%s:%s\n", mode_pt,
xorriso->do_concat_split ? "concat_split_on" : "concat_split_off",
xorriso->do_auto_chmod ? "auto_chmod_on" : "auto_chmod_off",
xorriso->do_restore_sort_lba ? "sort_lba_on" : "sort_lba_off"
xorriso->do_restore_sort_lba ? "sort_lba_on" : "sort_lba_off",
xorriso->drives_exclusive ? "o_excl_on" : "o_excl_off"
);
if(!(is_default && no_defaults))
@ -7196,19 +7203,57 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
}
do_single= 0;
ret= Xorriso_status_filter(xorriso, filter, "-indev", 0);
if(ret <= 0)
ret= Xorriso_status_filter(xorriso, filter, "-outdev", 0);
if(ret > 0)
dev_filter= filter;
if(dev_filter != NULL) {
show_dev= Xorriso_status_filter(xorriso, filter, "-dev", 0);
if(show_dev > 0)
dev_filter= NULL;
}
if(dev_filter != NULL) {
show_indev= Xorriso_status_filter(xorriso, filter, "-indev", 0);
show_outdev= Xorriso_status_filter(xorriso, filter, "-outdev", 0);
if(show_outdev > 0 || show_indev > 0)
do_single= 1;
}
if(xorriso->drives_exclusive != xorriso->indev_is_exclusive &&
xorriso->indev[0])
do_single= 1;
else if(xorriso->drives_exclusive != xorriso->outdev_is_exclusive &&
xorriso->outdev[0])
do_single= 1;
if(strcmp(xorriso->indev, xorriso->outdev) == 0 && !do_single) {
sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
Xorriso_status_result(xorriso,filter,fp,flag&2);
Xorriso_status_result(xorriso, dev_filter, fp, flag & 2);
} else {
if(xorriso->drives_exclusive != xorriso->indev_is_exclusive &&
xorriso->indev[0] && show_indev) {
sprintf(line,"-osirrox o_excl_%s\n",
xorriso->indev_is_exclusive ? "on" : "off");
Xorriso_status_result(xorriso, NULL, fp, flag & 2);
}
sprintf(line,"-indev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
Xorriso_status_result(xorriso,filter,fp,flag&2);
Xorriso_status_result(xorriso, dev_filter, fp, flag & 2);
if(xorriso->drives_exclusive != xorriso->indev_is_exclusive &&
xorriso->indev[0] && show_indev) {
sprintf(line,"-osirrox o_excl_%s\n",
xorriso->drives_exclusive ? "on" : "off");
Xorriso_status_result(xorriso, NULL, fp, flag & 2);
}
if(xorriso->drives_exclusive != xorriso->outdev_is_exclusive &&
xorriso->outdev[0] && show_outdev) {
sprintf(line,"-osirrox o_excl_%s\n",
xorriso->outdev_is_exclusive ? "on" : "off");
Xorriso_status_result(xorriso, NULL, fp, flag & 2);
}
sprintf(line,"-outdev %s\n", Text_shellsafe(xorriso->outdev,sfe,0));
Xorriso_status_result(xorriso,filter,fp,flag&2);
Xorriso_status_result(xorriso, dev_filter, fp, flag & 2);
if(xorriso->drives_exclusive != xorriso->outdev_is_exclusive &&
xorriso->outdev[0] && show_outdev) {
sprintf(line,"-osirrox o_excl_%s\n",
xorriso->drives_exclusive ? "on" : "off");
Xorriso_status_result(xorriso, NULL, fp, flag & 2);
}
}
return(1);
@ -12680,6 +12725,23 @@ int Xorriso_append_scdbackup_record(struct XorrisO *xorriso, int flag)
}
int Xorriso_may_burn(struct XorrisO *xorriso, int flag)
{
if(xorriso->outdev_is_exclusive)
return(1);
sprintf(xorriso->info_text, "The output drive was not aquired exclusively.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
sprintf(xorriso->info_text, "A possible remedy is: -ossirox 'o_excl_on'");
if(xorriso->outdev[0]) {
strcat(xorriso->info_text," -outdev ");
Text_shellsafe(xorriso->outdev, xorriso->info_text, 1);
}
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
return(0);
}
/* ---------------------------- Options API ------------------------ */
@ -17230,6 +17292,10 @@ int Xorriso_option_osirrox(struct XorrisO *xorriso, char *mode, int flag)
xorriso->do_restore_sort_lba= 1;
else if(strncmp(cpt, "sort_lba_off", l)==0)
xorriso->do_restore_sort_lba= 0;
else if(strncmp(cpt, "o_excl_off", l)==0)
xorriso->drives_exclusive= 0;
else if(strncmp(cpt, "o_excl_on", l)==0)
xorriso->drives_exclusive= 1;
else {
unknown_mode:;
sprintf(xorriso->info_text, "-osirrox: unknown mode '%s'", cpt);

View File

@ -204,12 +204,16 @@ struct XorrisO { /* the global context of xorriso */
*/
char image_start_value[81]; /* value according image_start_mode */
int drives_exclusive; /* burn_preset_device_open() param exclusive */
int do_calm_drive; /* bit0= calm down drive after aquiring it */
char indev[SfileadrL];
void *in_drive_handle; /* interpreted only by xorrisoburn.c */
void *in_volset_handle; /* interpreted only by xorrisoburn.c */
char *in_charset; /* The charset to interpret the filename bytes */
int indev_is_exclusive;
time_t isofs_st_out; /* A time point at least 1 second before image
composition began. To be stored with image as
xattr "isofs.st". */
@ -229,6 +233,7 @@ struct XorrisO { /* the global context of xorriso */
int dev_fd_1; /* The fd which substitutes for /dev/fd/1 and is
connected to externaly perveived stdout.
*/
int outdev_is_exclusive;
int grow_blindly_msc2; /* if >= 0 this causes growing from drive to drive.
The value is used as block address offset for
@ -691,6 +696,8 @@ int Xorriso_report_md5_outcome(struct XorrisO *xorriso, char *severity,
int Xorriso_append_scdbackup_record(struct XorrisO *xorriso, int flag);
int Xorriso_may_burn(struct XorrisO *xorriso, int flag);
int Sfile_str(char target[SfileadrL], char *source, int flag);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.09.17.144849"
#define Xorriso_timestamP "2009.09.19.161026"

View File

@ -1001,16 +1001,20 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
if(ret<=0)
goto ex;
ret= burn_drive_equals_adr(out_drive, libburn_adr, 1);
if(ret==1)
if(ret==1) {
dinfo= out_dinfo;
xorriso->indev_is_exclusive= xorriso->outdev_is_exclusive;
}
} else if((flag&3)==2 && xorriso->in_drive_handle!=NULL) {
ret= Xorriso_get_drive_handles(xorriso, &in_dinfo, &in_drive,
"on attempt to compare new outdev with indev", 0);
if(ret<=0)
goto ex;
ret= burn_drive_equals_adr(in_drive, libburn_adr, 1);
if(ret==1)
if(ret==1) {
dinfo= in_dinfo;
xorriso->outdev_is_exclusive= xorriso->indev_is_exclusive;
}
}
if(dinfo==NULL) {
@ -1019,7 +1023,9 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
aquire_flag|= 32;
if((xorriso->ino_behavior & (1 | 2)) && !(xorriso->do_aaip & (4 | 32)))
aquire_flag|= 64;
burn_preset_device_open(xorriso->drives_exclusive, 0, 0);
ret= isoburn_drive_aquire(&dinfo, libburn_adr, aquire_flag);
burn_preset_device_open(1, 0, 0);
Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) {
sprintf(xorriso->info_text,"Cannot aquire drive '%s'", adr);
@ -1029,6 +1035,10 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
if(flag&1)
if(xorriso->image_start_mode&(1<<31)) /* used up setting */
xorriso->image_start_mode= 0; /* no need to perform auto setting */
if(flag & 1)
xorriso->indev_is_exclusive= xorriso->drives_exclusive;
if(flag & 2)
xorriso->outdev_is_exclusive= xorriso->drives_exclusive;
}
drive= dinfo[0].drive;
if(flag&1) {
@ -1289,7 +1299,7 @@ ex:
*/
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
{
int in_is_out_too, ret;
int in_is_out_too, ret, do_eject;
struct burn_drive_info *dinfo;
struct burn_drive *drive;
char sfe[5*SfileadrL];
@ -1309,8 +1319,15 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
"on attempt to give up drive", 0);
if(!in_is_out_too) {
do_eject= !!(flag&4);
if((flag & 4) && !xorriso->indev_is_exclusive) {
sprintf(xorriso->info_text,
"Will not eject media in non-exclusively aquired input drive.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
do_eject= 0;
}
if(drive!=NULL)
isoburn_drive_release(drive,!!(flag&4));
isoburn_drive_release(drive, do_eject);
if(dinfo!=NULL)
burn_drive_info_free(dinfo);
}
@ -1333,11 +1350,18 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
in_is_out_too= 0;
}
if((flag&2) && xorriso->out_drive_handle!=NULL) {
do_eject= !!(flag&4);
if((flag & 4) && !xorriso->outdev_is_exclusive) {
sprintf(xorriso->info_text,
"Will not eject media in non-exclusively aquired output drive.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
do_eject= 0;
}
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to give up drive", 2);
if(!in_is_out_too) {
if(drive!=NULL)
isoburn_drive_release(drive,!!(flag&4));
isoburn_drive_release(drive, do_eject);
if(dinfo!=NULL)
burn_drive_info_free(dinfo);
}
@ -1543,6 +1567,10 @@ int Xorriso_auto_format(struct XorrisO *xorriso, int flag)
off_t size;
unsigned dummy;
ret= Xorriso_may_burn(xorriso, 0);
if(ret <= 0)
return(0);
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to autoformat", 2);
if(ret<=0)
@ -1949,6 +1977,10 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
goto ex;
}
ret= Xorriso_may_burn(xorriso, 0);
if(ret <= 0)
goto ex;
xorriso->run_state= 1; /* Indicate that burning has started */
isoburn_disc_write(burn_options, disc);
burn_write_opts_free(burn_options);
@ -5608,6 +5640,9 @@ int Xorriso_blank_media(struct XorrisO *xorriso, int flag)
time_t start_time;
char mode_names[4][80]= {"all", "fast", "deformat", "deformat_quickest"};
ret= Xorriso_may_burn(xorriso, 0);
if(ret <= 0)
return(0);
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to -blank", 2);
if(ret<=0)
@ -5712,6 +5747,9 @@ int Xorriso_format_media(struct XorrisO *xorriso, off_t in_size, int flag)
time_t start_time;
enum burn_disc_status disc_state;
ret= Xorriso_may_burn(xorriso, 0);
if(ret <= 0)
return(0);
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to -format", 2);
if(ret<=0)
@ -5864,6 +5902,9 @@ int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag)
char current_profile_name[80];
off_t size;
ret= Xorriso_may_burn(xorriso, 0);
if(ret <= 0)
return(0);
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to blank or format", 2);
if(ret<=0)
@ -8717,6 +8758,9 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
struct burn_drive *drive;
off_t seek_ret;
ret= Xorriso_may_burn(xorriso, 0);
if(ret <= 0)
return(0);
if(flag & 1) {
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to learn current session lba", 1);
@ -8838,6 +8882,9 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
char reasons[BURN_REASONS_LEN], sfe[5*SfileadrL], profile_name[80];
char head_buffer[64*1024];
ret= Xorriso_may_burn(xorriso, 0);
if(ret <= 0)
return(0);
ret= Xorriso_auto_format(xorriso, 0);
if(ret <=0 )
return(0);
@ -10447,7 +10494,9 @@ int Xorriso_mount(struct XorrisO *xorriso, char *dev, int adr_mode,
{ret= -1; goto ex;}
if(ret == 0 && strncmp(dev, "stdio:", 6) != 0)
sprintf(libburn_adr, "stdio:%s", dev);
burn_preset_device_open(xorriso->drives_exclusive, 0, 0);
ret= isoburn_drive_aquire(&dinfo, libburn_adr, 1);
burn_preset_device_open(1, 0, 0);
Xorriso_process_msg_queues(xorriso,0);
if(ret <= 0)
{ret= 0; goto ex;}