2007-10-14 12:20:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Adapter to libisoburn, libisofs and libburn for xorriso,
|
|
|
|
a command line oriented batch and dialog tool which creates, loads,
|
|
|
|
manipulates and burns ISO 9660 filesystem images.
|
|
|
|
|
2008-01-01 12:32:23 +00:00
|
|
|
Copyright 2007-2008 Thomas Schmitt, <scdbackup@gmx.net>
|
2007-10-14 12:20:56 +00:00
|
|
|
|
|
|
|
Provided under GPL version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
2007-10-15 15:27:51 +00:00
|
|
|
#include <sys/stat.h>
|
2007-10-22 21:18:13 +00:00
|
|
|
#include <time.h>
|
2007-10-14 12:20:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
|
2008-01-26 00:26:57 +00:00
|
|
|
#ifndef Xorriso_standalonE
|
2007-10-14 12:20:56 +00:00
|
|
|
|
|
|
|
/* The library which does the ISO 9660 / RockRidge manipulations */
|
|
|
|
#include <libisofs/libisofs.h>
|
|
|
|
|
|
|
|
/* The library which does MMC optical drive operations */
|
|
|
|
#include <libburn/libburn.h>
|
|
|
|
|
|
|
|
/* The library which enhances overwriteable media with ISO 9660 multi-session
|
|
|
|
capabilities via the method invented by Andy Polyakov for growisofs */
|
|
|
|
#include <libisoburn/libisoburn.h>
|
|
|
|
|
2007-10-16 21:09:36 +00:00
|
|
|
/* The official xorriso options API. "No shortcuts" */
|
|
|
|
#include "xorriso.h"
|
|
|
|
|
2007-10-14 12:20:56 +00:00
|
|
|
/* The inner description of XorrisO */
|
|
|
|
#include "xorriso_private.h"
|
|
|
|
|
|
|
|
/* The inner isofs- and burn-library interface */
|
|
|
|
#include "xorrisoburn.h"
|
|
|
|
|
2008-01-26 00:26:57 +00:00
|
|
|
#else /* ! Xorriso_standalonE */
|
|
|
|
|
|
|
|
#include "../libisofs/libisofs.h"
|
|
|
|
#include "../libburn/libburn.h"
|
|
|
|
#include "../libisoburn/libisoburn.h"
|
|
|
|
#include "xorriso.h"
|
|
|
|
#include "xorriso_private.h"
|
|
|
|
#include "xorrisoburn.h"
|
|
|
|
|
|
|
|
#endif /* Xorriso_standalonE */
|
|
|
|
|
2007-10-14 12:20:56 +00:00
|
|
|
|
2007-11-07 12:37:19 +00:00
|
|
|
int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
|
|
|
int flag);
|
|
|
|
|
2008-01-26 00:26:57 +00:00
|
|
|
#define LIBISO_ISDIR(node) (iso_node_get_type(node) == LIBISO_DIR)
|
|
|
|
#define LIBISO_ISREG(node) (iso_node_get_type(node) == LIBISO_FILE)
|
|
|
|
#define LIBISO_ISLNK(node) (iso_node_get_type(node) == LIBISO_SYMLINK)
|
|
|
|
#define LIBISO_ISCHR(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \
|
|
|
|
S_ISCHR(iso_node_get_mode(node)))
|
|
|
|
#define LIBISO_ISBLK(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \
|
|
|
|
S_ISBLK(iso_node_get_mode(node)))
|
|
|
|
#define LIBISO_ISFIFO(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \
|
|
|
|
S_ISFIFO(iso_node_get_mode(node)))
|
|
|
|
#define LIBISO_ISSOCK(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \
|
|
|
|
S_ISSOCK(iso_node_get_mode(node)))
|
|
|
|
|
2007-11-07 12:37:19 +00:00
|
|
|
|
2007-10-14 12:20:56 +00:00
|
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char *handler_prefix= NULL;
|
2007-10-17 13:02:32 +00:00
|
|
|
char *queue_sev, *print_sev;
|
2007-10-14 12:20:56 +00:00
|
|
|
|
2007-10-16 21:09:36 +00:00
|
|
|
sprintf(xorriso->info_text, "Starting up libraries ...\n");
|
|
|
|
Xorriso_info(xorriso, 0);
|
2007-10-14 12:20:56 +00:00
|
|
|
|
|
|
|
handler_prefix= calloc(strlen(xorriso->progname)+3+1, 1);
|
|
|
|
if(handler_prefix==NULL) {
|
2007-10-16 21:09:36 +00:00
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"Cannot allocate memory for initializing libraries");
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
2007-10-14 12:20:56 +00:00
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
ret= isoburn_initialize();
|
|
|
|
if(ret==0) {
|
2007-10-16 21:09:36 +00:00
|
|
|
sprintf(xorriso->info_text, "Cannot initialize libraries");
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
2007-10-14 12:20:56 +00:00
|
|
|
free(handler_prefix);
|
|
|
|
return(0);
|
|
|
|
}
|
2007-10-18 18:57:19 +00:00
|
|
|
xorriso->libs_are_started= 1;
|
2007-10-14 12:20:56 +00:00
|
|
|
|
2007-10-17 13:02:32 +00:00
|
|
|
queue_sev= "DEBUG";
|
|
|
|
if(xorriso->library_msg_direct_print) {
|
|
|
|
|
|
|
|
/* >>> need option for controlling this in XorrisO.
|
|
|
|
See also Xorriso_msgs_submit */;
|
|
|
|
|
2007-10-19 16:49:37 +00:00
|
|
|
print_sev= xorriso->report_about_text;
|
2007-10-17 13:02:32 +00:00
|
|
|
} else
|
|
|
|
print_sev= "NEVER";
|
2008-01-26 00:26:57 +00:00
|
|
|
|
|
|
|
iso_set_msgs_severities(queue_sev, print_sev, "libsofs : ");
|
2007-10-17 13:02:32 +00:00
|
|
|
burn_msgs_set_severities(queue_sev, print_sev, "libburn : ");
|
2007-10-16 21:09:36 +00:00
|
|
|
|
|
|
|
/* ??? >>> do we want united queues ? */
|
|
|
|
/* burn_set_messenger(iso_get_messenger()); */
|
|
|
|
|
2007-10-14 12:20:56 +00:00
|
|
|
sprintf(handler_prefix, "%s : ", xorriso->progname);
|
2007-10-15 15:27:51 +00:00
|
|
|
burn_set_signal_handling(handler_prefix, NULL, 0);
|
2007-10-14 12:20:56 +00:00
|
|
|
|
2007-10-17 13:02:32 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2007-10-16 21:09:36 +00:00
|
|
|
sprintf(xorriso->info_text, "Library startup done.\n");
|
|
|
|
Xorriso_info(xorriso, 0);
|
2007-10-14 12:20:56 +00:00
|
|
|
free(handler_prefix);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-15 20:41:56 +00:00
|
|
|
/* @param flag bit0= global shutdown of libraries */
|
|
|
|
int Xorriso_detach_libraries(struct XorrisO *xorriso, int flag)
|
2008-01-15 17:45:08 +00:00
|
|
|
{
|
2008-01-15 20:41:56 +00:00
|
|
|
Xorriso_give_up_drive(xorriso, 3);
|
2008-01-26 00:26:57 +00:00
|
|
|
if(xorriso->in_volset_handle!=NULL) { /* standalone image */
|
|
|
|
iso_image_unref((IsoImage *) xorriso->in_volset_handle);
|
|
|
|
xorriso->in_volset_handle= NULL;
|
|
|
|
}
|
2008-01-15 20:41:56 +00:00
|
|
|
if(flag&1) {
|
|
|
|
if(xorriso->libs_are_started==0)
|
|
|
|
return(0);
|
|
|
|
isoburn_finish();
|
|
|
|
}
|
2008-01-15 17:45:08 +00:00
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-18 18:32:32 +00:00
|
|
|
/* @param flag bit1= obtain outdrive, else indrive */
|
|
|
|
int Xorriso_get_drive_handles(struct XorrisO *xorriso,
|
|
|
|
struct burn_drive_info **dinfo,
|
|
|
|
struct burn_drive **drive,
|
|
|
|
char *attempt, int flag)
|
|
|
|
{
|
|
|
|
if(flag&2)
|
|
|
|
*dinfo= (struct burn_drive_info *) xorriso->out_drive_handle;
|
|
|
|
else
|
|
|
|
*dinfo= (struct burn_drive_info *) xorriso->in_drive_handle;
|
|
|
|
if(*dinfo==NULL) {
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2007-11-14 14:28:44 +00:00
|
|
|
sprintf(xorriso->info_text, "No %s drive aquired %s",
|
|
|
|
(flag&2 ? "output" : "input"), attempt);
|
2007-10-18 18:32:32 +00:00
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
*drive= (*dinfo)[0].drive;
|
2007-10-19 17:35:20 +00:00
|
|
|
return((*drive)!=NULL);
|
2007-10-18 18:32:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-26 00:26:57 +00:00
|
|
|
/* @param flag bit0= suppress DEBUG messages */
|
|
|
|
int Xorriso_set_image_severities(struct XorrisO *xorriso, int flag)
|
|
|
|
{
|
|
|
|
char *queue_sev, *print_sev;
|
|
|
|
|
|
|
|
if(flag&1)
|
|
|
|
queue_sev= "UPDATE";
|
|
|
|
else
|
|
|
|
queue_sev= "DEBUG";
|
|
|
|
if(xorriso->library_msg_direct_print)
|
|
|
|
print_sev= xorriso->report_about_text;
|
|
|
|
else
|
|
|
|
print_sev= "NEVER";
|
|
|
|
iso_set_msgs_severities(queue_sev, print_sev, "libisofs : ");
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_update_volid(struct XorrisO *xorriso, int flag)
|
|
|
|
{
|
|
|
|
int gret, sret= 1;
|
|
|
|
|
|
|
|
gret= Xorriso_get_volid(xorriso, xorriso->loaded_volid, 0);
|
|
|
|
if(gret>0 && strcmp(xorriso->volid, "ISOIMAGE")==0)
|
|
|
|
strcpy(xorriso->volid, xorriso->loaded_volid);
|
|
|
|
else
|
|
|
|
sret= Xorriso_set_volid(xorriso, xorriso->volid, 1);
|
|
|
|
return(gret>0 && sret>0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-14 14:28:44 +00:00
|
|
|
int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag)
|
|
|
|
{
|
|
|
|
int ret;
|
2008-01-26 00:26:57 +00:00
|
|
|
IsoImage *volset;
|
2007-11-14 14:28:44 +00:00
|
|
|
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) {
|
2008-01-26 00:26:57 +00:00
|
|
|
iso_image_unref((IsoImage *) xorriso->in_volset_handle);
|
2007-11-14 14:28:44 +00:00
|
|
|
xorriso->in_volset_handle= NULL;
|
2008-01-26 00:26:57 +00:00
|
|
|
xorriso->loaded_volid[0]= 0;
|
2007-11-14 14:28:44 +00:00
|
|
|
xorriso->volset_change_pending= 0;
|
|
|
|
}
|
|
|
|
memset(&ropts, sizeof(ropts), 0);
|
|
|
|
ropts.pretend_blank= 1;
|
2008-01-26 00:26:57 +00:00
|
|
|
ropts.input_charset= NULL;
|
|
|
|
ret= isoburn_read_image(drive, &ropts, &volset);
|
2007-11-14 14:28:44 +00:00
|
|
|
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);
|
|
|
|
}
|
2008-01-26 00:26:57 +00:00
|
|
|
xorriso->in_volset_handle= (void *) volset;
|
|
|
|
Xorriso_update_volid(xorriso, 0);
|
2007-11-14 14:28:44 +00:00
|
|
|
xorriso->volset_change_pending= 0;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-15 15:27:51 +00:00
|
|
|
/* @param flag bit0=aquire as isoburn input drive
|
|
|
|
bit1=aquire as libburn output drive (as isoburn drive if bit0)
|
2007-11-14 14:28:44 +00:00
|
|
|
@return <=0 failure , 1= ok
|
|
|
|
2=success, but not writeable with bit1
|
|
|
|
3=success, but not blank and not ISO with bit0
|
2007-10-15 15:27:51 +00:00
|
|
|
*/
|
|
|
|
int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
|
|
|
{
|
2007-11-14 14:28:44 +00:00
|
|
|
int ret, hret, not_writeable= 0;
|
|
|
|
struct burn_drive_info *dinfo= NULL, *out_dinfo, *in_dinfo;
|
|
|
|
struct burn_drive *drive, *out_drive, *in_drive;
|
2007-10-15 15:27:51 +00:00
|
|
|
enum burn_disc_status state;
|
2008-01-26 00:26:57 +00:00
|
|
|
IsoImage *volset = NULL;
|
2007-10-15 15:27:51 +00:00
|
|
|
struct isoburn_read_opts ropts;
|
2008-01-26 00:26:57 +00:00
|
|
|
char adr_data[SfileadrL], *libburn_adr;
|
2007-10-15 15:27:51 +00:00
|
|
|
|
2007-11-14 14:28:44 +00:00
|
|
|
if((flag&3)==0) {
|
2007-10-16 21:09:36 +00:00
|
|
|
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);
|
2007-10-15 15:27:51 +00:00
|
|
|
return(0);
|
|
|
|
}
|
2007-11-14 14:28:44 +00:00
|
|
|
ret= Xorriso_give_up_drive(xorriso, (flag&3)|8);
|
2007-10-15 15:27:51 +00:00
|
|
|
if(ret<=0)
|
|
|
|
return(ret);
|
|
|
|
|
2008-01-26 00:26:57 +00:00
|
|
|
libburn_adr= adr;
|
|
|
|
if(strcmp(adr,"stdio:/dev/fd/1")==0) {
|
|
|
|
if(xorriso->dev_fd_1<0) {
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"\"stdio:/dev/fd/1\" was not a start argument. stdout possibly already tainted.");
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
{ret= 0; goto ex;}
|
|
|
|
} else {
|
|
|
|
sprintf(adr_data, "stdio:/dev/fd/%d", xorriso->dev_fd_1);
|
|
|
|
libburn_adr= adr_data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-14 14:28:44 +00:00
|
|
|
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;
|
2008-01-26 00:26:57 +00:00
|
|
|
ret= burn_drive_equals_adr(out_drive, libburn_adr, 1);
|
2007-11-14 14:28:44 +00:00
|
|
|
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;
|
2008-01-26 00:26:57 +00:00
|
|
|
ret= burn_drive_equals_adr(in_drive, libburn_adr, 1);
|
2007-11-14 14:28:44 +00:00
|
|
|
if(ret==1)
|
|
|
|
dinfo= in_dinfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(dinfo==NULL) {
|
2008-01-26 00:26:57 +00:00
|
|
|
ret= isoburn_drive_scan_and_grab(&dinfo, libburn_adr, 1);
|
2007-11-14 14:28:44 +00:00
|
|
|
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);
|
|
|
|
}
|
2007-10-15 15:27:51 +00:00
|
|
|
}
|
2007-11-14 14:28:44 +00:00
|
|
|
drive= dinfo[0].drive;
|
|
|
|
state= isoburn_disc_get_status(drive);
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2008-01-26 00:26:57 +00:00
|
|
|
if(flag&1) {
|
|
|
|
volset= isoburn_get_attached_image(drive);
|
|
|
|
if(volset != NULL) { /* The image object is already created */
|
|
|
|
iso_image_unref(volset);
|
|
|
|
}
|
|
|
|
}
|
2007-11-14 14:28:44 +00:00
|
|
|
|
2007-10-19 20:41:34 +00:00
|
|
|
if(flag&2) {
|
2007-10-15 15:27:51 +00:00
|
|
|
xorriso->out_drive_handle= dinfo;
|
2007-11-14 14:28:44 +00:00
|
|
|
if(Sfile_str(xorriso->outdev, adr, 0)<=0)
|
2007-10-19 20:41:34 +00:00
|
|
|
return(-1);
|
2007-11-14 14:28:44 +00:00
|
|
|
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;
|
|
|
|
}
|
2007-10-19 20:41:34 +00:00
|
|
|
}
|
|
|
|
if(flag&1) {
|
2007-10-15 15:27:51 +00:00
|
|
|
xorriso->in_drive_handle= dinfo;
|
2007-11-14 14:28:44 +00:00
|
|
|
if(Sfile_str(xorriso->indev, adr, 0)<=0)
|
2007-10-19 20:41:34 +00:00
|
|
|
return(-1);
|
2007-11-14 14:28:44 +00:00
|
|
|
} 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 {
|
2008-01-26 00:26:57 +00:00
|
|
|
iso_image_ref((IsoImage *) xorriso->in_volset_handle);
|
|
|
|
ret= isoburn_attach_image(drive, (IsoImage *) xorriso->in_volset_handle);
|
2007-11-14 14:28:44 +00:00
|
|
|
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);
|
|
|
|
}
|
2007-10-15 15:27:51 +00:00
|
|
|
|
2007-11-14 14:28:44 +00:00
|
|
|
if(xorriso->in_volset_handle!=NULL)
|
2008-01-26 00:26:57 +00:00
|
|
|
iso_image_unref((IsoImage *) xorriso->in_volset_handle);
|
2007-11-14 14:28:44 +00:00
|
|
|
xorriso->in_volset_handle= NULL;
|
2007-10-15 15:27:51 +00:00
|
|
|
|
|
|
|
/* check for invalid state */
|
2007-11-14 14:28:44 +00:00
|
|
|
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);
|
2007-10-15 15:27:51 +00:00
|
|
|
}
|
|
|
|
/* fill read opts */
|
2007-11-14 14:28:44 +00:00
|
|
|
memset(&ropts, sizeof(ropts), 0);
|
2007-10-15 15:27:51 +00:00
|
|
|
ropts.norock= 0;
|
|
|
|
ropts.nojoliet= 0;
|
2008-01-26 00:26:57 +00:00
|
|
|
ropts.noiso1999= 1;
|
2007-10-15 15:27:51 +00:00
|
|
|
ropts.preferjoliet= 0;
|
|
|
|
ropts.uid= 0;
|
|
|
|
ropts.gid= 0;
|
|
|
|
ropts.mode= 0555;
|
2008-01-26 00:26:57 +00:00
|
|
|
ropts.input_charset= NULL;
|
2007-11-14 14:28:44 +00:00
|
|
|
ropts.pretend_blank= 0;
|
2007-10-15 15:27:51 +00:00
|
|
|
|
2008-01-26 00:26:57 +00:00
|
|
|
Xorriso_set_image_severities(xorriso, 1); /* No DEBUG messages */
|
|
|
|
if(isoburn_read_image(drive, &ropts, &volset) <= 0) {
|
2007-10-17 13:02:32 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2008-01-26 00:26:57 +00:00
|
|
|
Xorriso_set_image_severities(xorriso, 0);
|
2007-10-17 20:02:45 +00:00
|
|
|
sprintf(xorriso->info_text,"Cannot read ISO image volset");
|
2007-10-16 21:09:36 +00:00
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
2007-11-14 14:28:44 +00:00
|
|
|
ret= 3; goto ex;
|
2007-10-15 15:27:51 +00:00
|
|
|
}
|
2008-01-26 00:26:57 +00:00
|
|
|
xorriso->in_volset_handle= (void *) volset;
|
|
|
|
Xorriso_set_image_severities(xorriso, 0);
|
|
|
|
Xorriso_update_volid(xorriso, 0);
|
|
|
|
|
2007-11-14 14:28:44 +00:00
|
|
|
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;
|
2008-01-26 00:26:57 +00:00
|
|
|
iso_image_ref((IsoImage *) xorriso->in_volset_handle);
|
|
|
|
isoburn_attach_image(out_drive, xorriso->in_volset_handle);
|
2007-11-14 14:28:44 +00:00
|
|
|
}
|
2007-11-02 14:36:26 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
Xorriso_toc(xorriso, 1);
|
2008-01-26 00:26:57 +00:00
|
|
|
if(xorriso->loaded_volid[0]!=0) {
|
|
|
|
sprintf(xorriso->result_line,"Volume id : '%s'\n",xorriso->loaded_volid);
|
|
|
|
Xorriso_result(xorriso,0);
|
|
|
|
if(strcmp(xorriso->loaded_volid, xorriso->volid)!=0) {
|
|
|
|
sprintf(xorriso->result_line, "New volume id: '%s'\n", xorriso->volid);
|
|
|
|
Xorriso_result(xorriso,0);
|
|
|
|
}
|
|
|
|
}
|
2007-11-14 14:28:44 +00:00
|
|
|
ret= 1+not_writeable;
|
2007-10-15 15:27:51 +00:00
|
|
|
ex:
|
2007-11-14 14:28:44 +00:00
|
|
|
if(ret<=0) {
|
|
|
|
hret= Xorriso_give_up_drive(xorriso, flag&3);
|
|
|
|
if(hret<ret)
|
|
|
|
ret= hret;
|
2007-10-15 15:27:51 +00:00
|
|
|
}
|
2007-10-17 13:02:32 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2007-10-15 15:27:51 +00:00
|
|
|
return(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* @param flag bit0=input drive
|
|
|
|
bit1=output drive
|
2007-10-19 17:35:20 +00:00
|
|
|
bit2=eject
|
2007-11-14 14:28:44 +00:00
|
|
|
bit3=no info message or toc
|
2007-10-15 15:27:51 +00:00
|
|
|
*/
|
|
|
|
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
|
|
|
|
{
|
2007-11-14 14:28:44 +00:00
|
|
|
int in_is_out_too, ret;
|
2007-10-15 15:27:51 +00:00
|
|
|
struct burn_drive_info *dinfo;
|
|
|
|
struct burn_drive *drive;
|
2008-01-26 00:26:57 +00:00
|
|
|
char sfe[5*SfileadrL];
|
2007-10-15 15:27:51 +00:00
|
|
|
|
|
|
|
in_is_out_too= (xorriso->in_drive_handle == xorriso->out_drive_handle);
|
2008-01-26 00:26:57 +00:00
|
|
|
if((flag&4) && in_is_out_too && (flag&(1|2))) {
|
|
|
|
if((flag&3)!=3) {
|
|
|
|
sprintf(xorriso->info_text,"Giving up for -eject whole -dev %s",
|
|
|
|
Text_shellsafe(xorriso->indev, sfe, 0));
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
|
|
|
}
|
|
|
|
flag|= 3; /* give up in/out drive to eject it */
|
|
|
|
}
|
2007-10-15 15:27:51 +00:00
|
|
|
|
|
|
|
if((flag&1) && xorriso->in_drive_handle != NULL) {
|
2007-10-18 18:32:32 +00:00
|
|
|
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
2007-11-14 14:28:44 +00:00
|
|
|
"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;
|
2007-10-15 15:27:51 +00:00
|
|
|
|
2007-10-18 22:56:43 +00:00
|
|
|
if(xorriso->in_volset_handle!=NULL)
|
2008-01-26 00:26:57 +00:00
|
|
|
iso_image_unref((IsoImage *) xorriso->in_volset_handle);
|
2007-10-18 14:48:35 +00:00
|
|
|
xorriso->in_volset_handle= NULL;
|
2008-01-26 00:26:57 +00:00
|
|
|
xorriso->loaded_volid[0]= 0;
|
2007-10-15 22:40:39 +00:00
|
|
|
xorriso->volset_change_pending= 0;
|
2007-10-15 15:27:51 +00:00
|
|
|
|
2007-11-14 14:28:44 +00:00
|
|
|
in_is_out_too= 0;
|
2007-10-15 15:27:51 +00:00
|
|
|
}
|
|
|
|
if((flag&2) && xorriso->out_drive_handle!=NULL) {
|
2007-10-18 18:32:32 +00:00
|
|
|
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
2008-01-26 00:26:57 +00:00
|
|
|
"on attempt to give up drive", 2);
|
2007-11-14 14:28:44 +00:00
|
|
|
if(!in_is_out_too) {
|
|
|
|
if(drive!=NULL)
|
|
|
|
isoburn_drive_release(drive,!!(flag&4));
|
|
|
|
if(dinfo!=NULL)
|
|
|
|
burn_drive_info_free(dinfo);
|
|
|
|
}
|
2007-10-15 15:27:51 +00:00
|
|
|
xorriso->out_drive_handle= NULL;
|
2007-10-19 20:41:34 +00:00
|
|
|
xorriso->outdev[0]= 0;
|
2007-11-14 14:28:44 +00:00
|
|
|
} 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);
|
|
|
|
}
|
2007-10-15 15:27:51 +00:00
|
|
|
}
|
2007-10-17 13:02:32 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2007-10-15 15:27:51 +00:00
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
2007-10-15 22:40:39 +00:00
|
|
|
|
2007-10-18 18:32:32 +00:00
|
|
|
int Xorriso_make_write_options(
|
|
|
|
struct XorrisO *xorriso, struct burn_drive *drive,
|
|
|
|
struct burn_write_opts **burn_options, int flag)
|
|
|
|
{
|
2008-01-26 00:26:57 +00:00
|
|
|
int drive_role;
|
|
|
|
|
2007-10-18 18:32:32 +00:00
|
|
|
*burn_options= burn_write_opts_new(drive);
|
|
|
|
if(*burn_options==NULL) {
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
sprintf(xorriso->info_text,"Cannot allocate option set");
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
burn_write_opts_set_simulate(*burn_options, !!xorriso->do_dummy);
|
2008-01-26 00:26:57 +00:00
|
|
|
drive_role= burn_drive_get_drive_role(drive);
|
|
|
|
burn_write_opts_set_multi(*burn_options,
|
|
|
|
!(xorriso->do_close || drive_role==0 || drive_role==3));
|
2007-10-18 18:32:32 +00:00
|
|
|
burn_drive_set_speed(drive, xorriso->speed, xorriso->speed);
|
|
|
|
burn_write_opts_set_underrun_proof(*burn_options, 1);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-19 15:13:16 +00:00
|
|
|
/* @param flag bit0= do not write but only prepare and return size in sectors
|
|
|
|
*/
|
2007-11-14 14:28:44 +00:00
|
|
|
int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
2007-10-15 15:27:51 +00:00
|
|
|
{
|
2007-10-20 19:48:36 +00:00
|
|
|
int ret, media_space;
|
2007-10-15 15:27:51 +00:00
|
|
|
struct isoburn_source_opts sopts;
|
2007-11-14 14:28:44 +00:00
|
|
|
struct burn_drive_info *dinfo, *source_dinfo;
|
|
|
|
struct burn_drive *drive, *source_drive;
|
2007-10-18 22:17:46 +00:00
|
|
|
struct burn_disc *disc= NULL;
|
2007-10-15 15:27:51 +00:00
|
|
|
struct burn_write_opts *burn_options;
|
2007-11-02 14:36:26 +00:00
|
|
|
off_t readcounter= 0,writecounter= 0;
|
|
|
|
int num_sessions= 0, num_tracks= 0;
|
|
|
|
struct burn_session **sessions;
|
|
|
|
struct burn_track **tracks;
|
2007-11-14 14:28:44 +00:00
|
|
|
enum burn_disc_status s;
|
2007-10-15 15:27:51 +00:00
|
|
|
|
2007-10-18 18:32:32 +00:00
|
|
|
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
|
|
|
"on attempt to write", 2);
|
|
|
|
if(ret<=0)
|
2007-10-15 15:27:51 +00:00
|
|
|
return(0);
|
|
|
|
|
2008-01-26 00:26:57 +00:00
|
|
|
memset(&sopts, 0, sizeof(sopts));
|
|
|
|
|
2007-10-15 15:27:51 +00:00
|
|
|
sopts.level= 2;
|
2008-01-26 00:26:57 +00:00
|
|
|
sopts.rockridge= 1;
|
|
|
|
sopts.joliet= !!xorriso->do_joliet;
|
|
|
|
sopts.iso1999= 0;
|
|
|
|
sopts.omit_version_numbers= 0;
|
|
|
|
sopts.allow_deep_paths= 1;
|
|
|
|
sopts.allow_longer_paths= 0;
|
|
|
|
sopts.max_37_char_filenames= 0;
|
|
|
|
sopts.no_force_dots= 0;
|
|
|
|
sopts.allow_lowercase= 0;
|
|
|
|
sopts.allow_full_ascii= 0;
|
|
|
|
sopts.joliet_longer_paths= 0;
|
2007-10-15 15:27:51 +00:00
|
|
|
sopts.sort_files= 1;
|
2008-01-26 00:26:57 +00:00
|
|
|
sopts.replace_dir_mode= 2*!!xorriso->do_global_mode;
|
2007-11-08 14:43:53 +00:00
|
|
|
sopts.dir_mode= xorriso->global_dir_mode;
|
2008-01-26 00:26:57 +00:00
|
|
|
sopts.replace_file_mode= 2*!!xorriso->do_global_mode;
|
2007-11-08 14:43:53 +00:00
|
|
|
sopts.file_mode= xorriso->global_file_mode;
|
2008-01-26 00:26:57 +00:00
|
|
|
sopts.replace_uid= 2*!!xorriso->do_global_uid;
|
2007-10-15 15:27:51 +00:00
|
|
|
sopts.uid= xorriso->global_uid;
|
2008-01-26 00:26:57 +00:00
|
|
|
sopts.replace_gid= 2*!!xorriso->do_global_gid;
|
2007-10-15 15:27:51 +00:00
|
|
|
sopts.gid= xorriso->global_gid;
|
2008-01-26 00:26:57 +00:00
|
|
|
sopts.output_charset= NULL;
|
2007-10-23 12:28:36 +00:00
|
|
|
sopts.fifo_size= xorriso->fs * 2048;
|
2007-10-15 15:27:51 +00:00
|
|
|
|
2007-11-14 14:28:44 +00:00
|
|
|
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) {
|
2007-10-17 13:02:32 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2007-11-14 14:28:44 +00:00
|
|
|
sprintf(xorriso->info_text,"Failed to prepare session write run");
|
2007-10-16 21:09:36 +00:00
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
2007-10-18 22:17:46 +00:00
|
|
|
{ret= 0; goto ex;}
|
2007-10-15 15:27:51 +00:00
|
|
|
}
|
|
|
|
|
2007-10-18 18:32:32 +00:00
|
|
|
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
|
|
|
|
if(ret<=0)
|
2007-10-18 22:17:46 +00:00
|
|
|
goto ex;
|
2007-10-19 15:13:16 +00:00
|
|
|
|
2007-10-20 19:48:36 +00:00
|
|
|
ret= burn_disc_get_sectors(disc);
|
|
|
|
if(flag&1)
|
|
|
|
goto ex;
|
2007-11-14 14:28:44 +00:00
|
|
|
|
2007-10-20 19:48:36 +00:00
|
|
|
media_space= burn_disc_available_space(drive, burn_options) / (off_t) 2048;
|
|
|
|
if(media_space < ret) {
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
sprintf(xorriso->info_text,"Image size %ds exceeds free space on media %ds",
|
|
|
|
ret, media_space);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
{ret= 0; goto ex;}
|
|
|
|
}
|
|
|
|
|
2007-10-15 15:27:51 +00:00
|
|
|
isoburn_disc_write(burn_options, disc);
|
|
|
|
burn_write_opts_free(burn_options);
|
|
|
|
|
|
|
|
ret= Xorriso_pacifier_loop(xorriso, drive, 0);
|
|
|
|
if(ret<=0)
|
2007-10-18 22:17:46 +00:00
|
|
|
goto ex;
|
2007-10-20 17:10:04 +00:00
|
|
|
if(!isoburn_drive_wrote_well(drive)) {
|
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"libburn indicates failure with writing.");
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
ret= 0; goto ex;
|
|
|
|
}
|
2007-10-15 15:27:51 +00:00
|
|
|
|
2007-11-02 14:36:26 +00:00
|
|
|
sessions= burn_disc_get_sessions(disc, &num_sessions);
|
|
|
|
if(num_sessions>0) {
|
|
|
|
tracks= burn_session_get_tracks(sessions[0], &num_tracks);
|
|
|
|
if(tracks!=NULL && num_tracks>0) {
|
|
|
|
burn_track_get_counters(tracks[0],&readcounter,&writecounter);
|
2007-11-02 18:47:38 +00:00
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"ISO image produced: %d sectors. Written to media: %d sectors\n",
|
2008-01-26 00:26:57 +00:00
|
|
|
(int) (readcounter/ (off_t) 2048),
|
|
|
|
(int) (writecounter/ (off_t) 2048));
|
2007-11-02 14:36:26 +00:00
|
|
|
Xorriso_info(xorriso, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-15 15:27:51 +00:00
|
|
|
ret= isoburn_activate_session(drive);
|
2007-10-17 13:02:32 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2007-10-15 15:27:51 +00:00
|
|
|
if(ret<=0) {
|
2007-10-17 13:02:32 +00:00
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"Could not write new set of volume descriptors");
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
2007-10-18 22:17:46 +00:00
|
|
|
goto ex;
|
2007-10-15 15:27:51 +00:00
|
|
|
}
|
2007-11-02 14:36:26 +00:00
|
|
|
|
|
|
|
sprintf(xorriso->info_text, "Writing completed sucessfully.\n\n");
|
|
|
|
Xorriso_info(xorriso, 0);
|
2007-10-18 22:17:46 +00:00
|
|
|
ret= 1;
|
|
|
|
ex:;
|
|
|
|
if(disc!=NULL)
|
|
|
|
burn_disc_free(disc);
|
2007-10-17 13:02:32 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2007-10-18 22:17:46 +00:00
|
|
|
return(ret);
|
2007-10-15 15:27:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
|
|
|
int flag)
|
|
|
|
{
|
|
|
|
int ret, size, free_bytes, i;
|
|
|
|
struct burn_progress progress;
|
|
|
|
char *status_text;
|
2007-10-20 17:10:04 +00:00
|
|
|
enum burn_drive_status drive_status;
|
|
|
|
double start_time, current_time;
|
2007-10-15 15:27:51 +00:00
|
|
|
|
2007-10-20 17:10:04 +00:00
|
|
|
start_time= Sfile_microtime(0);
|
2007-10-15 15:27:51 +00:00
|
|
|
while(burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING)
|
|
|
|
usleep(100002);
|
|
|
|
|
2007-10-20 17:10:04 +00:00
|
|
|
while(1) {
|
|
|
|
drive_status= burn_drive_get_status(drive, &progress);
|
|
|
|
if(drive_status == BURN_DRIVE_IDLE)
|
|
|
|
break;
|
|
|
|
current_time= Sfile_microtime(0);
|
2007-11-01 11:14:42 +00:00
|
|
|
if(drive_status == BURN_DRIVE_WRITING && progress.sectors > 0) {
|
2007-10-20 17:10:04 +00:00
|
|
|
sprintf(xorriso->info_text, "Writing: sector %d of %d",
|
|
|
|
progress.sector, progress.sectors);
|
|
|
|
ret= isoburn_get_fifo_status(drive, &size, &free_bytes, &status_text);
|
|
|
|
if(ret>0 )
|
2008-01-26 00:26:57 +00:00
|
|
|
sprintf(xorriso->info_text+strlen(xorriso->info_text),
|
|
|
|
" [fifo %s, %2d%% fill, size=%d , free=%d]", status_text,
|
|
|
|
(int) (100.0-100.0*((double) free_bytes)/(double) size),
|
|
|
|
size, free_bytes);
|
|
|
|
/*
|
2007-10-20 17:10:04 +00:00
|
|
|
sprintf(xorriso->info_text+strlen(xorriso->info_text),
|
|
|
|
" [fifo %s, %2d%% fill]", status_text,
|
|
|
|
(int) (100.0-100.0*((double) free_bytes)/(double) size));
|
2008-01-26 00:26:57 +00:00
|
|
|
*/
|
2007-10-20 17:10:04 +00:00
|
|
|
} else if(drive_status == BURN_DRIVE_CLOSING_SESSION ||
|
|
|
|
drive_status == BURN_DRIVE_CLOSING_TRACK)
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"Closing track/session. Working since %.f seconds",
|
|
|
|
current_time-start_time);
|
|
|
|
else if(drive_status == BURN_DRIVE_FORMATTING)
|
|
|
|
sprintf(xorriso->info_text, "Formatting. Working since %.f seconds",
|
|
|
|
current_time-start_time);
|
|
|
|
else
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"Thank you for being patient since %.f seconds",
|
|
|
|
current_time-start_time);
|
2007-10-16 21:09:36 +00:00
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
|
2007-10-15 15:27:51 +00:00
|
|
|
|
|
|
|
for(i= 0; i<10; i++) {
|
2007-10-17 13:02:32 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso, 0);
|
2007-10-15 15:27:51 +00:00
|
|
|
usleep(100000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-26 00:26:57 +00:00
|
|
|
int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume,
|
2007-10-21 09:48:17 +00:00
|
|
|
int flag)
|
2007-10-15 15:27:51 +00:00
|
|
|
{
|
2007-10-15 20:37:53 +00:00
|
|
|
if(xorriso->in_volset_handle==NULL) {
|
2007-10-17 13:02:32 +00:00
|
|
|
Xorriso_process_msg_queues(xorriso,0);
|
2008-01-26 00:26:57 +00:00
|
|
|
sprintf(xorriso->info_text,"No ISO image present.");
|
|
|
|
if(xorriso->indev[0]==0 && xorriso->outdev[0]==0)
|
2007-10-18 18:32:32 +00:00
|
|
|
sprintf(xorriso->info_text+strlen(xorriso->info_text),
|
2008-01-26 00:26:57 +00:00
|
|
|
" No -dev, -indev, or -outdev selected.");
|
2007-10-15 20:37:53 +00:00
|
|
|
else
|
2007-10-18 18:32:32 +00:00
|
|
|
sprintf(xorriso->info_text+strlen(xorriso->info_text),
|
|
|
|
" Possible program error with drive '%s'.", xorriso->indev);
|
2007-10-15 20:37:53 +00:00
|
|
|
|
2007-10-16 21:09:36 +00:00
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
2007-10-15 20:37:53 +00:00
|
|
|
return(0);
|
|
|
|
}
|
2008-01-26 00:26:57 +00:00
|
|
|
*volume= (IsoImage *) xorriso->in_volset_handle;
|
2007-10-21 09:48:17 +00:00
|
|
|
return(*volume != NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|