Implemented option -eject
This commit is contained in:
parent
4195d73f82
commit
d0d074b11f
@ -3385,6 +3385,7 @@ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
|
|||||||
int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
|
int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
char sfe[4*SfileadrL];
|
||||||
|
|
||||||
if(xorriso->ban_stdio_write && strncmp(adr, "stdio:", 6)==0) {
|
if(xorriso->ban_stdio_write && strncmp(adr, "stdio:", 6)==0) {
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
@ -3394,7 +3395,7 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((flag&3)==0)
|
if((flag&3)==0 || xorriso->in_drive_handle == xorriso->out_drive_handle)
|
||||||
flag|= 3;
|
flag|= 3;
|
||||||
if((flag&3)!=3) {
|
if((flag&3)!=3) {
|
||||||
/* <<< for now only -dev */;
|
/* <<< for now only -dev */;
|
||||||
@ -3411,9 +3412,24 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(adr[0]==0)
|
if(adr[0]==0) {
|
||||||
ret= Xorriso_give_up_drive(xorriso, flag&3);
|
if((flag&1) && xorriso->in_drive_handle != NULL) {
|
||||||
|
if(xorriso->in_drive_handle == xorriso->out_drive_handle)
|
||||||
|
sprintf(xorriso->info_text,"Giving up -dev %s",
|
||||||
|
Text_shellsafe(xorriso->indev, sfe, 0));
|
||||||
else
|
else
|
||||||
|
sprintf(xorriso->info_text,"Giving up -indev %s",
|
||||||
|
Text_shellsafe(xorriso->indev, sfe, 0));
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||||
|
}
|
||||||
|
if((flag&2) && xorriso->in_drive_handle != NULL &&
|
||||||
|
xorriso->in_drive_handle != xorriso->out_drive_handle) {
|
||||||
|
sprintf(xorriso->info_text,"Giving up -outdev %s",
|
||||||
|
Text_shellsafe(xorriso->indev, sfe, 0));
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||||
|
}
|
||||||
|
ret= Xorriso_give_up_drive(xorriso, flag&3);
|
||||||
|
} else
|
||||||
ret= Xorriso_aquire_drive(xorriso, adr, flag&3);
|
ret= Xorriso_aquire_drive(xorriso, adr, flag&3);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
return(ret);
|
return(ret);
|
||||||
@ -3481,28 +3497,22 @@ int Xorriso_option_dummy(struct XorrisO *xorriso, char *mode, int flag)
|
|||||||
/* Option -eject */
|
/* Option -eject */
|
||||||
int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag)
|
int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag)
|
||||||
{
|
{
|
||||||
/* <<< should become handles */
|
int gu_flag= 4, ret;
|
||||||
char *drive1="", *drive2="";
|
|
||||||
|
|
||||||
if(strncmp(which,"in",2)==0)
|
if(strncmp(which,"in",2)==0)
|
||||||
drive1= xorriso->indev;
|
gu_flag|= 1;
|
||||||
else if(strncmp(which,"out",3)==0)
|
else if(strncmp(which,"out",3)==0)
|
||||||
drive1= xorriso->outdev;
|
gu_flag|= 2;
|
||||||
else {
|
else
|
||||||
drive1= xorriso->indev;
|
gu_flag|= 3;
|
||||||
drive2= xorriso->outdev;
|
if((gu_flag&1) && xorriso->volset_change_pending) {
|
||||||
}
|
|
||||||
if(drive1== xorriso->indev && xorriso->volset_change_pending) {
|
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
"-eject: Image changes pending. -commit or -rollback first");
|
"-eject: Image changes pending. -commit or -rollback first");
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
ret= Xorriso_give_up_drive(xorriso, gu_flag);
|
||||||
fprintf(stderr, ">>> LIBBURN : eject media in drive%s %s %s\n",
|
return(ret);
|
||||||
(drive2[0]!=0 ? "s" : ""), drive1, drive2);
|
|
||||||
|
|
||||||
return(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ Writing the result:
|
|||||||
and no new loading of image, rather execute option -end.
|
and no new loading of image, rather execute option -end.
|
||||||
To suppress a final write, execute -rollback -end.
|
To suppress a final write, execute -rollback -end.
|
||||||
|
|
||||||
> -eject "in"|"out"|"all" Eject the media in -indev, resp. -outdev, resp. both
|
-eject "in"|"out"|"all" Eject the media in -indev, resp. -outdev, resp. both
|
||||||
drives.
|
drives.
|
||||||
Note: It is not possible yet to effectively eject disk files.
|
Note: It is not possible yet to effectively eject disk files.
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2007.10.19.164957"
|
#define Xorriso_timestamP "2007.10.19.173547"
|
||||||
|
@ -113,7 +113,7 @@ int Xorriso_get_drive_handles(struct XorrisO *xorriso,
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
*drive= (*dinfo)[0].drive;
|
*drive= (*dinfo)[0].drive;
|
||||||
return(1);
|
return((*drive)!=NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,6 +196,7 @@ ex:
|
|||||||
|
|
||||||
/* @param flag bit0=input drive
|
/* @param flag bit0=input drive
|
||||||
bit1=output drive
|
bit1=output drive
|
||||||
|
bit2=eject
|
||||||
*/
|
*/
|
||||||
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
||||||
{
|
{
|
||||||
@ -208,13 +209,15 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
|||||||
if((flag&1) && xorriso->in_drive_handle != NULL) {
|
if((flag&1) && xorriso->in_drive_handle != NULL) {
|
||||||
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||||
"on attempt to give drive up", 0);
|
"on attempt to give drive up", 0);
|
||||||
isoburn_drive_release(drive,0);
|
if(drive!=NULL)
|
||||||
|
isoburn_drive_release(drive,!!(flag&4));
|
||||||
|
|
||||||
if(xorriso->in_volset_handle!=NULL)
|
if(xorriso->in_volset_handle!=NULL)
|
||||||
iso_volset_free((struct iso_volset *) xorriso->in_volset_handle);
|
iso_volset_free((struct iso_volset *) xorriso->in_volset_handle);
|
||||||
xorriso->in_volset_handle= NULL;
|
xorriso->in_volset_handle= NULL;
|
||||||
xorriso->volset_change_pending= 0;
|
xorriso->volset_change_pending= 0;
|
||||||
|
|
||||||
|
if(dinfo!=NULL)
|
||||||
burn_drive_info_free(dinfo);
|
burn_drive_info_free(dinfo);
|
||||||
xorriso->in_drive_handle= NULL;
|
xorriso->in_drive_handle= NULL;
|
||||||
xorriso->indev[0]= 0;
|
xorriso->indev[0]= 0;
|
||||||
@ -226,7 +229,9 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
|||||||
if((flag&2) && xorriso->out_drive_handle!=NULL) {
|
if((flag&2) && xorriso->out_drive_handle!=NULL) {
|
||||||
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||||
"on attempt to give drive up", 2);
|
"on attempt to give drive up", 2);
|
||||||
isoburn_drive_release(drive,0);
|
if(drive!=NULL)
|
||||||
|
isoburn_drive_release(drive,!!(flag&4));
|
||||||
|
if(dinfo!=NULL)
|
||||||
burn_drive_info_free(dinfo);
|
burn_drive_info_free(dinfo);
|
||||||
xorriso->out_drive_handle= NULL;
|
xorriso->out_drive_handle= NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user