Implemented option -eject
This commit is contained in:
parent
12e5fbb1f2
commit
8495cefa52
@ -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 ret;
|
||||
char sfe[4*SfileadrL];
|
||||
|
||||
if(xorriso->ban_stdio_write && strncmp(adr, "stdio:", 6)==0) {
|
||||
sprintf(xorriso->info_text,
|
||||
@ -3394,7 +3395,7 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
|
||||
return(0);
|
||||
}
|
||||
|
||||
if((flag&3)==0)
|
||||
if((flag&3)==0 || xorriso->in_drive_handle == xorriso->out_drive_handle)
|
||||
flag|= 3;
|
||||
if((flag&3)!=3) {
|
||||
/* <<< for now only -dev */;
|
||||
@ -3411,9 +3412,24 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(adr[0]==0)
|
||||
if(adr[0]==0) {
|
||||
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
|
||||
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
|
||||
} else
|
||||
ret= Xorriso_aquire_drive(xorriso, adr, flag&3);
|
||||
if(ret<0)
|
||||
return(ret);
|
||||
@ -3481,28 +3497,22 @@ int Xorriso_option_dummy(struct XorrisO *xorriso, char *mode, int flag)
|
||||
/* Option -eject */
|
||||
int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag)
|
||||
{
|
||||
/* <<< should become handles */
|
||||
char *drive1="", *drive2="";
|
||||
int gu_flag= 4, ret;
|
||||
|
||||
if(strncmp(which,"in",2)==0)
|
||||
drive1= xorriso->indev;
|
||||
gu_flag|= 1;
|
||||
else if(strncmp(which,"out",3)==0)
|
||||
drive1= xorriso->outdev;
|
||||
else {
|
||||
drive1= xorriso->indev;
|
||||
drive2= xorriso->outdev;
|
||||
}
|
||||
if(drive1== xorriso->indev && xorriso->volset_change_pending) {
|
||||
gu_flag|= 2;
|
||||
else
|
||||
gu_flag|= 3;
|
||||
if((gu_flag&1) && xorriso->volset_change_pending) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-eject: Image changes pending. -commit or -rollback first");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
fprintf(stderr, ">>> LIBBURN : eject media in drive%s %s %s\n",
|
||||
(drive2[0]!=0 ? "s" : ""), drive1, drive2);
|
||||
|
||||
return(1);
|
||||
ret= Xorriso_give_up_drive(xorriso, gu_flag);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,7 +323,7 @@ Writing the result:
|
||||
and no new loading of image, rather execute option -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.
|
||||
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);
|
||||
}
|
||||
*drive= (*dinfo)[0].drive;
|
||||
return(1);
|
||||
return((*drive)!=NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -196,6 +196,7 @@ ex:
|
||||
|
||||
/* @param flag bit0=input drive
|
||||
bit1=output drive
|
||||
bit2=eject
|
||||
*/
|
||||
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
@ -208,14 +209,16 @@ 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);
|
||||
isoburn_drive_release(drive,0);
|
||||
if(drive!=NULL)
|
||||
isoburn_drive_release(drive,!!(flag&4));
|
||||
|
||||
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;
|
||||
|
||||
burn_drive_info_free(dinfo);
|
||||
if(dinfo!=NULL)
|
||||
burn_drive_info_free(dinfo);
|
||||
xorriso->in_drive_handle= NULL;
|
||||
xorriso->indev[0]= 0;
|
||||
if(in_is_out_too) {
|
||||
@ -226,8 +229,10 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
||||
if((flag&2) && xorriso->out_drive_handle!=NULL) {
|
||||
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to give drive up", 2);
|
||||
isoburn_drive_release(drive,0);
|
||||
burn_drive_info_free(dinfo);
|
||||
if(drive!=NULL)
|
||||
isoburn_drive_release(drive,!!(flag&4));
|
||||
if(dinfo!=NULL)
|
||||
burn_drive_info_free(dinfo);
|
||||
xorriso->out_drive_handle= NULL;
|
||||
}
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
|
Loading…
Reference in New Issue
Block a user