Implemented options -outdev and -indev
This commit is contained in:
parent
556b40c264
commit
146debc163
@ -45,7 +45,8 @@ Renames or deletes file objects in the ISO image.
|
||||
.br
|
||||
Changes file properties in the ISO image.
|
||||
.br
|
||||
> Can write result as completely new image to optical media or filesystem objects.
|
||||
Can write result as completely new image to optical media or
|
||||
filesystem objects.
|
||||
.br
|
||||
Can write result as add-on session to appendable multi-session media,
|
||||
to overwriteable media, to regular files, and to block devices.
|
||||
@ -98,19 +99,11 @@ MMC media like DVD-RAM, DVD+RW, formatted DVD-RW, and of course not to disk
|
||||
files or non-CD/DVD block devices.
|
||||
Program growisofs by Andy Polyakov showed how to extend this functionality
|
||||
to overwriteable media or disk files which carry valid ISO 9660 filesystems.
|
||||
These two expansion methods are referred as "growing" in this text.
|
||||
.PP
|
||||
xorriso provides growing as well as an own method which produces a completely
|
||||
> new ISO image from the old one and the modifications. This unique xorriso
|
||||
> method produces compact filesystem images with no waste by outdated data blocks
|
||||
> and it can write modified images to targets which are completely unsuitable
|
||||
> for multi-session operations. E.g. fast blanked DVD-RW, named pipes,
|
||||
> character devices, sockets.
|
||||
> Therefore this method is called "modifying". Its drawback is that the target
|
||||
> cannot be the same media which holds the unmodified ISO image but that this
|
||||
> media has to be present while the new image gets written to another media.
|
||||
> So typically one needs either two optical drives or has to work with
|
||||
> filesystem objects as source and/or target media.
|
||||
These two expansion methods are referred as \fBgrowing\fR in this text.
|
||||
.br
|
||||
xorriso provides both ways of growing as well as an own method which produces
|
||||
a completely new ISO image from the old one and the modifications.
|
||||
See below.
|
||||
.PP
|
||||
xorriso adopts the concept of session by loading an eventual image directory
|
||||
tree, allowing to manipulate it by several actions, and to write the new
|
||||
@ -131,6 +124,18 @@ session.
|
||||
.br
|
||||
In some special situations (e.g. in a file-to-file situation) it can be
|
||||
useful to store intermediate states and to continue with image manipulations.
|
||||
.PP
|
||||
The unique xorriso method of \fBmodifying\fR produces compact filesystem
|
||||
images with no waste by outdated data blocks and it can write modified images
|
||||
to target media which are completely unsuitable for multi-session operations.
|
||||
E.g. fast blanked DVD-RW, named pipes, character devices, sockets.
|
||||
It is important to note that modified sessions can be written to blank
|
||||
media only.
|
||||
.br
|
||||
Modifying takes place whenever input drive and output drive are not the same.
|
||||
See options -dev, -indev, -outdev.
|
||||
So for this method one needs either two optical drives or has to work with
|
||||
filesystem objects as source and/or target media.
|
||||
.SS
|
||||
.B Libburn drives:
|
||||
.br
|
||||
@ -239,21 +244,34 @@ Options with prefix '?' are not tested yet.
|
||||
.B Aquiring source and target drive:
|
||||
.TP
|
||||
\fB\-dev\fR address
|
||||
Set input and output drive and load eventual ISO image.
|
||||
Set input and output drive to the same address and load eventual ISO image.
|
||||
If there is no ISO image then create a blank one.
|
||||
Set the image expansion method to growing.
|
||||
Only allowed as long as no ISO image was loaded and
|
||||
altered, or after actions -rollback, or -commit.
|
||||
.br
|
||||
This is only allowed as long as no changes are pending in the currently
|
||||
loaded ISO image. Eventually one has to perform -commit or -rollback first.
|
||||
Violation yields a SORRY event.
|
||||
.br
|
||||
An empty address string gives up the current device
|
||||
without aquiring a new one.
|
||||
.TP
|
||||
> \fB\-indev\fR address
|
||||
Set input drive and load eventual ISO image. Switch from
|
||||
growing to modifying. Same restrictions as with -dev
|
||||
\fB\-indev\fR address
|
||||
Set input drive and load eventual ISO image. If the new input drive differs
|
||||
from outdev then switch from growing to modifying. The same rules and
|
||||
restrictions apply as with -dev.
|
||||
.TP
|
||||
> \fB\-outdev\fR address
|
||||
Set output drive and switch from growing to modifying.
|
||||
\fB\-outdev\fR address
|
||||
Set output drive and if it differs from the input drive then switch from
|
||||
growing to modifying. Unlike -dev and -indev this action does not load a
|
||||
new ISO image. So it can be performed even if there are pending changes.
|
||||
.br
|
||||
-outdev can be performed without previous -dev or -indev. In that case an
|
||||
empty ISO image with no changes pending is created. It can either be populated
|
||||
by help of -add or it can be discarded silently if -dev or -indev are
|
||||
performed afterwards.
|
||||
.br
|
||||
An empty address string gives up the current output drive
|
||||
without aquiring a new one. No writing is possible without an output drive.
|
||||
.TP
|
||||
\fB\-ban_stdio_write\fR
|
||||
Allow for writing only the usage of optical drives. Disallow
|
||||
@ -330,7 +348,7 @@ Delete the given files from the ISO image.
|
||||
Note: This does not free any space on the -indev media, even if
|
||||
the deletion is committed to that same media.
|
||||
.br
|
||||
> The image size will shrink if the image is written to a different
|
||||
The image size will shrink if the image is written to a different
|
||||
media in modification mode.
|
||||
.TP
|
||||
\fB\-rm_r\fR iso_rr_path [***]
|
||||
@ -847,7 +865,7 @@ enter option and arguments :
|
||||
.br
|
||||
enter option and arguments :
|
||||
.br
|
||||
.B \-commit -eject -end
|
||||
.B \-commit -eject all -end
|
||||
.br
|
||||
.SS
|
||||
.B Modifying an existing ISO image
|
||||
@ -870,7 +888,7 @@ Add new directory tree /movies. Burn to DVD and eject.
|
||||
/movies=/home/me/prepared_for_dvd/movies \\
|
||||
-- \\
|
||||
-commit \\
|
||||
-eject
|
||||
-eject all
|
||||
.SS
|
||||
.B Examples of input timestrings
|
||||
.br
|
||||
|
@ -4322,15 +4322,10 @@ int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
return(2);
|
||||
}
|
||||
|
||||
/* >>> care for modifying */
|
||||
|
||||
ret= Xorriso_write_growing(xorriso, 0);
|
||||
ret= Xorriso_write_session(xorriso, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
|
||||
xorriso->volset_change_pending= 0;
|
||||
|
||||
if(flag&1)
|
||||
return(1);
|
||||
strcpy(newdev, xorriso->outdev);
|
||||
@ -4387,14 +4382,17 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef NIX
|
||||
if((flag&3)==0 || xorriso->in_drive_handle == xorriso->out_drive_handle)
|
||||
flag|= 3;
|
||||
|
||||
if((flag&3)!=3) {
|
||||
/* <<< for now only -dev */;
|
||||
fprintf(stderr, ">>> XORRISO : would execute -%sdev %s\n",
|
||||
((flag&3)==1 ? "in" : ((flag&3)==2 ? "out" : "")), adr);
|
||||
return(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(xorriso->volset_change_pending && (flag&1)) {
|
||||
sprintf(xorriso->info_text,
|
||||
@ -5378,10 +5376,7 @@ int Xorriso_option_print_size(struct XorrisO *xorriso, int flag)
|
||||
Xorriso_result(xorriso,0);
|
||||
return(2);
|
||||
}
|
||||
|
||||
/* >>> care for modifying */
|
||||
|
||||
ret= Xorriso_write_growing(xorriso, 1);
|
||||
ret= Xorriso_write_session(xorriso, 1);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text,"-print-size: Failed to set up virtual -commit");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
@ -5559,7 +5554,7 @@ int Xorriso_option_rollback(struct XorrisO *xorriso, int flag)
|
||||
|
||||
if(Sfile_str(indev, xorriso->indev, 0)<=0)
|
||||
return(-1);
|
||||
ret= Xorriso_give_up_drive(xorriso, 1);
|
||||
ret= Xorriso_give_up_drive(xorriso, 1|8);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
ret= Xorriso_option_dev(xorriso, indev,
|
||||
@ -5657,7 +5652,7 @@ int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag)
|
||||
int ret, free_space= 0, media_space= 0;
|
||||
|
||||
ret= Xorriso_tell_media_space(xorriso, &media_space, &free_space, 0);
|
||||
if(ret<0) {
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text, "Cannot -tell_media_space");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
@ -5697,9 +5692,23 @@ int Xorriso_option_temp_mem_limit(struct XorrisO *xorriso, char *size,
|
||||
/* Option -toc */
|
||||
int Xorriso_option_toc(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret;
|
||||
int ret, in_ret= 1000;
|
||||
|
||||
ret= Xorriso_toc(xorriso, 0);
|
||||
if(strcmp(xorriso->indev,xorriso->outdev)==0)
|
||||
ret= Xorriso_toc(xorriso, 0);
|
||||
else {
|
||||
if(xorriso->indev[0]!=0)
|
||||
in_ret= Xorriso_toc(xorriso, 0);
|
||||
if(xorriso->indev[0]!=0 && xorriso->outdev[0]!=0) {
|
||||
strcpy(xorriso->result_line, "-------------: ---------------------------------------------------------------\n");
|
||||
Xorriso_result(xorriso,0);
|
||||
}
|
||||
ret= 1;
|
||||
if(xorriso->outdev[0]!=0)
|
||||
ret= Xorriso_toc(xorriso, 2);
|
||||
if(in_ret<ret)
|
||||
ret= in_ret;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -5977,7 +5986,7 @@ next_command:;
|
||||
|
||||
} else if(strcmp(cmd,"-outdev")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_dev(xorriso, arg1, 1);
|
||||
ret= Xorriso_option_dev(xorriso, arg1, 2);
|
||||
|
||||
} else if(strcmp(cmd,"-page")==0) {
|
||||
(*idx)+= 2;
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2007.11.14.142904"
|
||||
#define Xorriso_timestamP "2007.11.14.143119"
|
||||
|
@ -127,7 +127,8 @@ int Xorriso_get_drive_handles(struct XorrisO *xorriso,
|
||||
*dinfo= (struct burn_drive_info *) xorriso->in_drive_handle;
|
||||
if(*dinfo==NULL) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text, "No drive aquired %s", attempt);
|
||||
sprintf(xorriso->info_text, "No %s drive aquired %s",
|
||||
(flag&2 ? "output" : "input"), attempt);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
@ -136,83 +137,177 @@ int Xorriso_get_drive_handles(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret;
|
||||
struct iso_volset *volset;
|
||||
struct isoburn_read_opts ropts;
|
||||
struct burn_drive_info *dinfo= NULL;
|
||||
struct burn_drive *drive= NULL;
|
||||
|
||||
if(xorriso->out_drive_handle != NULL) {
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to attach volset to drive", 2);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
}
|
||||
if(xorriso->in_volset_handle!=NULL) {
|
||||
iso_volset_free((struct iso_volset *) xorriso->in_volset_handle);
|
||||
xorriso->in_volset_handle= NULL;
|
||||
xorriso->volset_change_pending= 0;
|
||||
}
|
||||
memset(&ropts, sizeof(ropts), 0);
|
||||
ropts.pretend_blank= 1;
|
||||
ret= isoburn_read_volset(drive, &ropts, &volset);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text, "Failed to create new empty ISO image object");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
||||
return(-1);
|
||||
}
|
||||
xorriso->in_volset_handle= volset;
|
||||
xorriso->volset_change_pending= 0;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0=aquire as isoburn input drive
|
||||
bit1=aquire as libburn output drive (as isoburn drive if bit0)
|
||||
@return <=0 failure , 1= ok
|
||||
2=success, but not writeable with bit1
|
||||
3=success, but not blank and not ISO with bit0
|
||||
*/
|
||||
int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
||||
{
|
||||
int ret;
|
||||
struct burn_drive_info *dinfo= NULL;
|
||||
struct burn_drive *drive;
|
||||
int ret, hret, not_writeable= 0;
|
||||
struct burn_drive_info *dinfo= NULL, *out_dinfo, *in_dinfo;
|
||||
struct burn_drive *drive, *out_drive, *in_drive;
|
||||
enum burn_disc_status state;
|
||||
struct iso_volset *volset;
|
||||
struct isoburn_read_opts ropts;
|
||||
|
||||
|
||||
if((flag&3)!=3) {
|
||||
if((flag&3)==0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"XORRISOBURN program error : Xorriso_aquire_drive bit0+bit1 not set");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
||||
return(0);
|
||||
}
|
||||
ret= Xorriso_give_up_drive(xorriso, flag&3);
|
||||
ret= Xorriso_give_up_drive(xorriso, (flag&3)|8);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
|
||||
ret= isoburn_drive_scan_and_grab(&dinfo, adr, 1);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text,"Cannot aquire drive '%s'", adr);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
if((flag&3)==1 && xorriso->out_drive_handle!=NULL) {
|
||||
ret= Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive,
|
||||
"on attempt to compare new indev with outdev", 2);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
ret= burn_drive_equals_adr(out_drive, adr, 1);
|
||||
if(ret==1)
|
||||
dinfo= out_dinfo;
|
||||
} 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 indev with outdev", 0);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
ret= burn_drive_equals_adr(in_drive, adr, 1);
|
||||
if(ret==1)
|
||||
dinfo= in_dinfo;
|
||||
}
|
||||
if(flag&2) {
|
||||
xorriso->out_drive_handle= dinfo;
|
||||
if(Sfile_str(xorriso->indev, adr, 0)<=0)
|
||||
return(-1);
|
||||
}
|
||||
if(flag&1) {
|
||||
xorriso->in_drive_handle= dinfo;
|
||||
if(Sfile_str(xorriso->outdev, adr, 0)<=0)
|
||||
return(-1);
|
||||
} else
|
||||
return(1);
|
||||
|
||||
if(dinfo==NULL) {
|
||||
ret= isoburn_drive_scan_and_grab(&dinfo, adr, 1);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text,"Cannot aquire drive '%s'", adr);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
drive= dinfo[0].drive;
|
||||
|
||||
/* check for invalid state */
|
||||
state= isoburn_disc_get_status(drive);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
|
||||
/* >>> show drive and media status */;
|
||||
if(flag&2) {
|
||||
xorriso->out_drive_handle= dinfo;
|
||||
if(Sfile_str(xorriso->outdev, adr, 0)<=0)
|
||||
return(-1);
|
||||
if(state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) {
|
||||
sprintf(xorriso->info_text, "Disc status unsuitable for writing");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
not_writeable= 1;
|
||||
}
|
||||
}
|
||||
if(flag&1) {
|
||||
xorriso->in_drive_handle= dinfo;
|
||||
if(Sfile_str(xorriso->indev, adr, 0)<=0)
|
||||
return(-1);
|
||||
} else if(flag&2) {
|
||||
if(xorriso->in_volset_handle==NULL) {
|
||||
/* No volume loaded: create empty one */
|
||||
ret= Xorriso_create_empty_iso(xorriso, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
} else {
|
||||
iso_volset_ref(xorriso->in_volset_handle);
|
||||
ret= isoburn_attach_volset(drive,
|
||||
(struct iso_volset *) xorriso->in_volset_handle);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Failed to attach ISO image object to outdev");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
Xorriso_toc(xorriso, 1|2);
|
||||
return(1+not_writeable);
|
||||
}
|
||||
|
||||
if(state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) {
|
||||
sprintf(xorriso->info_text, "Disc status unsuitable for writing");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
if(xorriso->in_volset_handle!=NULL)
|
||||
iso_volset_free((struct iso_volset *) xorriso->in_volset_handle);
|
||||
xorriso->in_volset_handle= NULL;
|
||||
|
||||
/* check for invalid state */
|
||||
if(state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE &&
|
||||
state != BURN_DISC_FULL) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Disc status not blank and unsuitable for reading");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
/* fill read opts */
|
||||
memset(&ropts, sizeof(ropts), 0);
|
||||
ropts.norock= 0;
|
||||
ropts.nojoliet= 0;
|
||||
ropts.preferjoliet= 0;
|
||||
ropts.uid= 0;
|
||||
ropts.gid= 0;
|
||||
ropts.mode= 0555;
|
||||
ropts.pretend_blank= 0;
|
||||
|
||||
if(isoburn_read_volset(drive, &ropts, &volset) <= 0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,"Cannot read ISO image volset");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
ret= 0; goto ex;
|
||||
ret= 3; goto ex;
|
||||
}
|
||||
xorriso->in_volset_handle= volset;
|
||||
if(xorriso->out_drive_handle != NULL &&
|
||||
xorriso->out_drive_handle != xorriso->in_drive_handle) {
|
||||
ret= Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive,
|
||||
"on attempt to attach ISO image volset to outdev", 2);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
iso_volset_ref(xorriso->in_volset_handle);
|
||||
isoburn_attach_volset(out_drive, xorriso->in_volset_handle);
|
||||
}
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
Xorriso_toc(xorriso, 1);
|
||||
ret= 1;
|
||||
ret= 1+not_writeable;
|
||||
ex:
|
||||
if(ret<0) {
|
||||
|
||||
/* >>> give up drive */;
|
||||
|
||||
if(ret<=0) {
|
||||
hret= Xorriso_give_up_drive(xorriso, flag&3);
|
||||
if(hret<ret)
|
||||
ret= hret;
|
||||
}
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
return(ret);
|
||||
@ -222,10 +317,11 @@ ex:
|
||||
/* @param flag bit0=input drive
|
||||
bit1=output drive
|
||||
bit2=eject
|
||||
bit3=no info message or toc
|
||||
*/
|
||||
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int in_is_out_too;
|
||||
int in_is_out_too, ret;
|
||||
struct burn_drive_info *dinfo;
|
||||
struct burn_drive *drive;
|
||||
|
||||
@ -233,33 +329,45 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
||||
|
||||
if((flag&1) && xorriso->in_drive_handle != NULL) {
|
||||
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to give drive up", 0);
|
||||
if(drive!=NULL)
|
||||
isoburn_drive_release(drive,!!(flag&4));
|
||||
"on attempt to give up drive", 0);
|
||||
|
||||
if(!in_is_out_too) {
|
||||
if(drive!=NULL && !in_is_out_too)
|
||||
isoburn_drive_release(drive,!!(flag&4));
|
||||
if(dinfo!=NULL && !in_is_out_too)
|
||||
burn_drive_info_free(dinfo);
|
||||
}
|
||||
xorriso->in_drive_handle= NULL;
|
||||
xorriso->indev[0]= 0;
|
||||
|
||||
if(xorriso->in_volset_handle!=NULL)
|
||||
iso_volset_free((struct iso_volset *) xorriso->in_volset_handle);
|
||||
xorriso->in_volset_handle= NULL;
|
||||
xorriso->volset_change_pending= 0;
|
||||
|
||||
if(dinfo!=NULL)
|
||||
burn_drive_info_free(dinfo);
|
||||
xorriso->in_drive_handle= NULL;
|
||||
xorriso->indev[0]= 0;
|
||||
if(in_is_out_too) {
|
||||
xorriso->out_drive_handle= NULL;
|
||||
xorriso->outdev[0]= 0;
|
||||
}
|
||||
in_is_out_too= 0;
|
||||
}
|
||||
if((flag&2) && xorriso->out_drive_handle!=NULL) {
|
||||
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to give drive up", 2);
|
||||
if(drive!=NULL)
|
||||
isoburn_drive_release(drive,!!(flag&4));
|
||||
if(dinfo!=NULL)
|
||||
burn_drive_info_free(dinfo);
|
||||
if(!in_is_out_too) {
|
||||
if(drive!=NULL)
|
||||
isoburn_drive_release(drive,!!(flag&4));
|
||||
if(dinfo!=NULL)
|
||||
burn_drive_info_free(dinfo);
|
||||
}
|
||||
xorriso->out_drive_handle= NULL;
|
||||
xorriso->outdev[0]= 0;
|
||||
} else if((flag&1) && xorriso->out_drive_handle!=NULL) {
|
||||
ret= Xorriso_create_empty_iso(xorriso, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
if(!(flag&8)) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Only the output drive remains. Created empty ISO image.\n");
|
||||
Xorriso_info(xorriso, 0);
|
||||
Xorriso_toc(xorriso, 1|2);
|
||||
}
|
||||
}
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
return(1);
|
||||
@ -287,19 +395,19 @@ int Xorriso_make_write_options(
|
||||
|
||||
/* @param flag bit0= do not write but only prepare and return size in sectors
|
||||
*/
|
||||
int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
|
||||
int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret, media_space;
|
||||
struct isoburn_source_opts sopts;
|
||||
struct burn_drive_info *dinfo;
|
||||
struct burn_drive *drive;
|
||||
struct burn_drive_info *dinfo, *source_dinfo;
|
||||
struct burn_drive *drive, *source_drive;
|
||||
struct burn_disc *disc= NULL;
|
||||
struct burn_write_opts *burn_options;
|
||||
off_t readcounter= 0,writecounter= 0;
|
||||
int num_sessions= 0, num_tracks= 0;
|
||||
struct burn_session **sessions;
|
||||
struct burn_track **tracks;
|
||||
|
||||
enum burn_disc_status s;
|
||||
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to write", 2);
|
||||
@ -327,9 +435,31 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
|
||||
sopts.ouput_charset= NULL;
|
||||
sopts.fifo_size= xorriso->fs * 2048;
|
||||
|
||||
if (isoburn_prepare_disc(drive, &disc, &sopts) <= 0) {
|
||||
if(xorriso->out_drive_handle == xorriso->in_drive_handle ||
|
||||
xorriso->in_drive_handle == NULL) {
|
||||
ret= isoburn_prepare_disc(drive, &disc, &sopts);
|
||||
} else {
|
||||
s= isoburn_disc_get_status(drive);
|
||||
if(s!=BURN_DISC_BLANK) {
|
||||
s= burn_disc_get_status(drive);
|
||||
if(s!=BURN_DISC_BLANK)
|
||||
sprintf(xorriso->info_text,
|
||||
"-indev differs from -outdev and -outdev media is not blank");
|
||||
else
|
||||
sprintf(xorriso->info_text,
|
||||
"-indev differs from -outdev and -outdev media holds valid ISO image");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
{ret= 0; goto ex;}
|
||||
}
|
||||
ret= Xorriso_get_drive_handles(xorriso, &source_dinfo, &source_drive,
|
||||
"on attempt to get source for write", 0);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
ret= isoburn_prepare_new_image(source_drive, &disc, &sopts);
|
||||
}
|
||||
if (ret <= 0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,"Cannot prepare disc");
|
||||
sprintf(xorriso->info_text,"Failed to prepare session write run");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
{ret= 0; goto ex;}
|
||||
}
|
||||
@ -341,6 +471,7 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
|
||||
ret= burn_disc_get_sectors(disc);
|
||||
if(flag&1)
|
||||
goto ex;
|
||||
|
||||
media_space= burn_disc_available_space(drive, burn_options) / (off_t) 2048;
|
||||
if(media_space < ret) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
@ -972,13 +1103,15 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag)
|
||||
|
||||
|
||||
/* @param flag bit0=short report form
|
||||
bit1=report about output drive
|
||||
*/
|
||||
int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int num_sessions= 0, num_tracks= 0, lba= 0, nwa= -1, pmin, psec, pframe, ret;
|
||||
int track_count= 0, session_no, track_no, profile_no= -1;
|
||||
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0;
|
||||
char profile_name[80],*respt;
|
||||
int is_inout_drive= 0;
|
||||
char profile_name[80],*respt,*devadr;
|
||||
struct burn_disc *disc= NULL;
|
||||
struct burn_session **sessions;
|
||||
struct burn_track **tracks;
|
||||
@ -988,13 +1121,21 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
||||
enum burn_disc_status s;
|
||||
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to print Table Of Content", 2);
|
||||
"on attempt to print Table Of Content", flag&2);
|
||||
if(ret<=0)
|
||||
return(0);
|
||||
|
||||
respt= xorriso->result_line;
|
||||
|
||||
sprintf(respt, "Drive current: -indev '%s'\n", xorriso->indev);
|
||||
if(strcmp(xorriso->indev, xorriso->outdev)==0)
|
||||
is_inout_drive= 1;
|
||||
if(flag&2)
|
||||
devadr= xorriso->outdev;
|
||||
else
|
||||
devadr= xorriso->indev;
|
||||
sprintf(respt, "Drive current: %s '%s'\n",
|
||||
(is_inout_drive ? "-dev" : (flag&2 ? "-outdev" : "-indev")),
|
||||
devadr);
|
||||
Xorriso_result(xorriso,0);
|
||||
sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n",
|
||||
dinfo[0].vendor, dinfo[0].product, dinfo[0].revision);
|
||||
@ -1211,10 +1352,7 @@ int Xorriso_tell_media_space(struct XorrisO *xorriso,
|
||||
burn_write_opts_free(burn_options);
|
||||
|
||||
if(xorriso->volset_change_pending) {
|
||||
|
||||
/* >>> care for modifying */
|
||||
|
||||
ret= Xorriso_write_growing(xorriso, 1);
|
||||
ret= Xorriso_write_session(xorriso, 1);
|
||||
if(ret>0)
|
||||
(*free_space)-= ret;
|
||||
}
|
||||
@ -1321,12 +1459,6 @@ int Xorriso_format_media(struct XorrisO *xorriso, int flag)
|
||||
int ret, mode_flag= 0;
|
||||
struct burn_drive_info *dinfo;
|
||||
struct burn_drive *drive;
|
||||
|
||||
#ifdef NIX
|
||||
struct burn_progress p;
|
||||
double percent = 1.0;
|
||||
#endif
|
||||
|
||||
int current_profile;
|
||||
char current_profile_name[80];
|
||||
|
||||
@ -1363,30 +1495,6 @@ int Xorriso_format_media(struct XorrisO *xorriso, int flag)
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
|
||||
#ifdef NIX
|
||||
|
||||
usleep(1000000);
|
||||
while(burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) {
|
||||
if(p.sectors>0 && p.sector>=0) /* display 1 to 99 percent */
|
||||
percent = 1.0 + ((double) p.sector+1.0)
|
||||
/ ((double) p.sectors) * 98.0;
|
||||
sprintf(xorriso->info_text, "Formatting ( %.1f%% done )", percent);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
|
||||
usleep(1000000);
|
||||
}
|
||||
|
||||
burn_disc_get_profile(dinfo[0].drive, ¤t_profile, current_profile_name);
|
||||
sprintf(xorriso->info_text, "Media type now: %4.4xh \"%s\"\n",
|
||||
current_profile, current_profile_name);
|
||||
Xorriso_info(xorriso, 0);
|
||||
if(current_profile != 0x13 && current_profile != 0x1a) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Failed to change media profile to desired value.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text, "Formatting done\n");
|
||||
Xorriso_info(xorriso,0);
|
||||
|
@ -18,11 +18,17 @@ struct XorrisO;
|
||||
|
||||
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag);
|
||||
|
||||
int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* @param flag bit0=aquire as isoburn input drive
|
||||
bit1=aquire as libburn output drive (as isoburn drive if bit0)
|
||||
@return <=0 failure , 1=success , 2=neither readable or writeable
|
||||
*/
|
||||
int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag);
|
||||
|
||||
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag);
|
||||
|
||||
int Xorriso_write_growing(struct XorrisO *xorriso, int flag);
|
||||
int Xorriso_write_session(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* @param flag bit0=graft in as empty directory, not as copy from disk
|
||||
@return <=0 = error , 1 = added simple node , 2 = added directory
|
||||
@ -32,7 +38,8 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
|
||||
|
||||
int Xorriso__text_to_sev(char *severity_name, int *severity_number,int flag);
|
||||
|
||||
/* @param flag bit0=short report form
|
||||
/* @param flag bit0=report about output drive
|
||||
bit1=short report form
|
||||
*/
|
||||
int Xorriso_toc(struct XorrisO *xorriso, int flag);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user