Inserted problem messages where libisoburn API produces own failures
This commit is contained in:
parent
1490708bdc
commit
ea5daa0f80
@ -255,7 +255,7 @@ int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
|
|||||||
if(conv_ret<=0) {
|
if(conv_ret<=0) {
|
||||||
sprintf(msg, "Unsuitable drive address: '%s'\n",adr);
|
sprintf(msg, "Unsuitable drive address: '%s'\n",adr);
|
||||||
msg[BURN_MSGS_MESSAGE_LEN-1]= 0;
|
msg[BURN_MSGS_MESSAGE_LEN-1]= 0;
|
||||||
burn_msgs_submit(0, msg, 0, "SORRY", NULL);
|
burn_msgs_submit(0x00060000, msg, 0, "SORRY", NULL);
|
||||||
ret= 0; goto ex;
|
ret= 0; goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,8 +309,11 @@ int isoburn_find_emulator(struct isoburn **pt,
|
|||||||
ret= isoburn_find_by_drive(pt, drive, 0);
|
ret= isoburn_find_by_drive(pt, drive, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
return(0);
|
return(0);
|
||||||
if((*pt)->emulation_mode==-1)
|
if((*pt)->emulation_mode==-1) {
|
||||||
|
burn_msgs_submit(0x00060000,
|
||||||
|
"Unsuitable drive and media state", 0, "FAILURE", NULL);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
}
|
||||||
if((*pt)->emulation_mode==0)
|
if((*pt)->emulation_mode==0)
|
||||||
return(0);
|
return(0);
|
||||||
return(1);
|
return(1);
|
||||||
@ -388,8 +391,11 @@ int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(isoburn_disc_get_status(d)!=BURN_DISC_APPENDABLE &&
|
if(isoburn_disc_get_status(d)!=BURN_DISC_APPENDABLE &&
|
||||||
isoburn_disc_get_status(d)!=BURN_DISC_FULL)
|
isoburn_disc_get_status(d)!=BURN_DISC_FULL) {
|
||||||
|
burn_msgs_submit(0x00060000,
|
||||||
|
"Media contains no recognizable data", 0, "SORRY",NULL);
|
||||||
return(0);
|
return(0);
|
||||||
|
}
|
||||||
ret= isoburn_find_emulator(&o, d, 0);
|
ret= isoburn_find_emulator(&o, d, 0);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
return(0);
|
return(0);
|
||||||
@ -454,7 +460,7 @@ void isoburn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
|
|||||||
write_type= burn_write_opts_auto_write_type(opts, disc, reasons, 0);
|
write_type= burn_write_opts_auto_write_type(opts, disc, reasons, 0);
|
||||||
if (write_type == BURN_WRITE_NONE) {
|
if (write_type == BURN_WRITE_NONE) {
|
||||||
sprintf(msg, "Failed to find a suitable write mode:\n%s", reasons);
|
sprintf(msg, "Failed to find a suitable write mode:\n%s", reasons);
|
||||||
burn_msgs_submit(0, msg, 0, "SORRY", NULL);
|
burn_msgs_submit(0x00060000, msg, 0, "SORRY", NULL);
|
||||||
if(o!=NULL)
|
if(o!=NULL)
|
||||||
o->wrote_well= 0;
|
o->wrote_well= 0;
|
||||||
/* To cause a negative reply with burn_drive_wrote_well() */
|
/* To cause a negative reply with burn_drive_wrote_well() */
|
||||||
@ -531,8 +537,12 @@ int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag)
|
|||||||
ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0);
|
ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
if(!caps->start_adr)
|
if(!caps->start_adr) {
|
||||||
|
burn_msgs_submit(0x00060000,
|
||||||
|
"Cannot set start byte address with this type of media",
|
||||||
|
0, "FAILURE", NULL);
|
||||||
{ret= 0; goto ex;}
|
{ret= 0; goto ex;}
|
||||||
|
}
|
||||||
o->min_start_byte= value;
|
o->min_start_byte= value;
|
||||||
if(value % caps->start_alignment)
|
if(value % caps->start_alignment)
|
||||||
value+= caps->start_alignment - (value % caps->start_alignment);
|
value+= caps->start_alignment - (value % caps->start_alignment);
|
||||||
@ -557,7 +567,7 @@ int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte,
|
|||||||
ret= isoburn_find_emulator(&o, d, 0);
|
ret= isoburn_find_emulator(&o, d, 0);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
return(-1);
|
return(-1);
|
||||||
if(ret==0)
|
if(ret==0)
|
||||||
return(0);
|
return(0);
|
||||||
*start_byte= o->min_start_byte;
|
*start_byte= o->min_start_byte;
|
||||||
if(o->min_start_byte<=0)
|
if(o->min_start_byte<=0)
|
||||||
@ -701,11 +711,13 @@ int isoburn_report_iso_error(int iso_error_code, char msg_text[], int os_errno,
|
|||||||
int error_code, iso_sev, min_sev, ret;
|
int error_code, iso_sev, min_sev, ret;
|
||||||
char *sev_text_pt, *msg_text_pt= NULL;
|
char *sev_text_pt, *msg_text_pt= NULL;
|
||||||
|
|
||||||
/* <<< delete as soon as replacement appears in libisofs */
|
error_code= 0x00050000;
|
||||||
|
|
||||||
|
/* It would have been neat ...
|
||||||
#define ISO_ERR_CODE(e) (e & 0x0000FFFF)
|
#define ISO_ERR_CODE(e) (e & 0x0000FFFF)
|
||||||
|
|
||||||
|
|
||||||
error_code= 0x00050000 | ISO_ERR_CODE(iso_error_code);
|
error_code= 0x00050000 | ISO_ERR_CODE(iso_error_code);
|
||||||
|
*/
|
||||||
|
|
||||||
if(iso_error_code<0)
|
if(iso_error_code<0)
|
||||||
msg_text_pt= (char *) iso_error_to_msg(iso_error_code);
|
msg_text_pt= (char *) iso_error_to_msg(iso_error_code);
|
||||||
if(msg_text_pt==NULL)
|
if(msg_text_pt==NULL)
|
||||||
|
@ -58,8 +58,12 @@ int isoburn_new(struct isoburn **objpt, int flag)
|
|||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
*objpt= o= (struct isoburn *) malloc(sizeof(struct isoburn));
|
*objpt= o= (struct isoburn *) malloc(sizeof(struct isoburn));
|
||||||
if(o==NULL)
|
if(o==NULL) {
|
||||||
|
burn_msgs_submit(0x00060000,
|
||||||
|
"Cannot allocate memory for isoburn control object",
|
||||||
|
0, "FATAL", NULL);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
o->drive= NULL;
|
o->drive= NULL;
|
||||||
o->emulation_mode= 0;
|
o->emulation_mode= 0;
|
||||||
@ -276,6 +280,7 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
|
|||||||
if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE
|
if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE
|
||||||
&& (state != BURN_DISC_FULL || ! new_img)) {
|
&& (state != BURN_DISC_FULL || ! new_img)) {
|
||||||
/* unsuitable status */
|
/* unsuitable status */
|
||||||
|
burn_msgs_submit(0x00060000, "Unsuitable media state", 0, "FAILURE", NULL);
|
||||||
{ret= -2; goto ex;}
|
{ret= -2; goto ex;}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,10 +327,15 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
|
|||||||
} else {
|
} else {
|
||||||
int lba, nwa;
|
int lba, nwa;
|
||||||
ret = isoburn_disc_track_lba_nwa(d, NULL, 0, &lba, &nwa);
|
ret = isoburn_disc_track_lba_nwa(d, NULL, 0, &lba, &nwa);
|
||||||
if (ret != 1)
|
if (ret != 1) {
|
||||||
|
burn_msgs_submit(0x00060000, "Cannot determine next writeable address", 0,
|
||||||
|
"FAILURE", NULL);
|
||||||
{ret= -3; goto ex;}
|
{ret= -3; goto ex;}
|
||||||
|
}
|
||||||
if (nwa == 0 && state == BURN_DISC_APPENDABLE) {
|
if (nwa == 0 && state == BURN_DISC_APPENDABLE) {
|
||||||
/* invalid nwa */
|
/* invalid nwa */
|
||||||
|
burn_msgs_submit(0x00060000, "Encountered 0 as next writeable address", 0,
|
||||||
|
"FAILURE", NULL);
|
||||||
{ret= -4; goto ex;}
|
{ret= -4; goto ex;}
|
||||||
}
|
}
|
||||||
iso_write_opts_set_ms_block(wopts, nwa);
|
iso_write_opts_set_ms_block(wopts, nwa);
|
||||||
@ -347,7 +357,7 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
|
|||||||
o->fifo = burn_fifo_source_new(wsrc, 2048, fifo_chunks, 0);
|
o->fifo = burn_fifo_source_new(wsrc, 2048, fifo_chunks, 0);
|
||||||
burn_source_free(wsrc);
|
burn_source_free(wsrc);
|
||||||
if (o->fifo == NULL) {
|
if (o->fifo == NULL) {
|
||||||
fprintf(stderr, "Cannot attach fifo\n");
|
burn_msgs_submit(0x00060000, "Cannot attach fifo", 0, "FATAL", NULL);
|
||||||
{ret= -1; goto ex;}
|
{ret= -1; goto ex;}
|
||||||
}
|
}
|
||||||
#endif /* ! Libisoburn_no_fifO */
|
#endif /* ! Libisoburn_no_fifO */
|
||||||
@ -416,6 +426,7 @@ int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc,
|
|||||||
|
|
||||||
/* API @since 0.1.0
|
/* API @since 0.1.0
|
||||||
@param flag bit0= this is a regular end, not an abort
|
@param flag bit0= this is a regular end, not an abort
|
||||||
|
give up source reference
|
||||||
*/
|
*/
|
||||||
int isoburn_cancel_prepared_write(struct burn_drive *d, int flag)
|
int isoburn_cancel_prepared_write(struct burn_drive *d, int flag)
|
||||||
{
|
{
|
||||||
@ -432,6 +443,8 @@ int isoburn_cancel_prepared_write(struct burn_drive *d, int flag)
|
|||||||
if(o->iso_source->version<1)
|
if(o->iso_source->version<1)
|
||||||
return(0);
|
return(0);
|
||||||
o->iso_source->cancel(o->iso_source);
|
o->iso_source->cancel(o->iso_source);
|
||||||
|
burn_source_free(o->iso_source);
|
||||||
|
o->iso_source= NULL;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,8 +495,11 @@ int isoburn_ropt_new(struct isoburn_read_opts **new_o, int flag)
|
|||||||
struct isoburn_read_opts *o;
|
struct isoburn_read_opts *o;
|
||||||
|
|
||||||
o= (*new_o)= calloc(1, sizeof(struct isoburn_read_opts));
|
o= (*new_o)= calloc(1, sizeof(struct isoburn_read_opts));
|
||||||
if(o==NULL)
|
if(o==NULL) {
|
||||||
|
burn_msgs_submit(0x00060000, "Cannot allocate memory for read options",
|
||||||
|
0, "FATAL", NULL);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
}
|
||||||
o->norock= 0;
|
o->norock= 0;
|
||||||
o->nojoliet= 0;
|
o->nojoliet= 0;
|
||||||
o->noiso1999= 1;
|
o->noiso1999= 1;
|
||||||
@ -616,8 +632,12 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag)
|
|||||||
struct isoburn_imgen_opts *o;
|
struct isoburn_imgen_opts *o;
|
||||||
|
|
||||||
o= (*new_o)= calloc(1, sizeof(struct isoburn_imgen_opts));
|
o= (*new_o)= calloc(1, sizeof(struct isoburn_imgen_opts));
|
||||||
if(o==NULL)
|
if(o==NULL) {
|
||||||
|
burn_msgs_submit(0x00060000,
|
||||||
|
"Cannot allocate memory for image generation options",
|
||||||
|
0, "FATAL", NULL);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
}
|
||||||
o->level= 2;
|
o->level= 2;
|
||||||
o->rockridge= 1;
|
o->rockridge= 1;
|
||||||
o->joliet= 0;
|
o->joliet= 0;
|
||||||
|
@ -116,19 +116,15 @@ int isoburn_read_image(struct burn_drive *d,
|
|||||||
struct isoburn *o= NULL;
|
struct isoburn *o= NULL;
|
||||||
|
|
||||||
if(read_opts==NULL) {
|
if(read_opts==NULL) {
|
||||||
|
burn_msgs_submit(0x00060000,
|
||||||
/* >>> program error */;
|
"Program error: isoburn_read_image: read_opts==NULL",
|
||||||
|
0, "FATAL", NULL);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
if(d != NULL) {
|
if(d != NULL) {
|
||||||
ret = isoburn_find_emulator(&o, d, 0);
|
ret = isoburn_find_emulator(&o, d, 0);
|
||||||
if (ret < 0)
|
if (ret < 0 || o == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (o == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
status = isoburn_disc_get_status(d);
|
status = isoburn_disc_get_status(d);
|
||||||
}
|
}
|
||||||
if (d == NULL || status == BURN_DISC_BLANK || read_opts->pretend_blank) {
|
if (d == NULL || status == BURN_DISC_BLANK || read_opts->pretend_blank) {
|
||||||
@ -139,8 +135,12 @@ int isoburn_read_image(struct burn_drive *d,
|
|||||||
|
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
/* New empty image without relation to a drive */
|
/* New empty image without relation to a drive */
|
||||||
if (image==NULL)
|
if (image==NULL) {
|
||||||
|
burn_msgs_submit(0x00060000,
|
||||||
|
"Program error: isoburn_read_image: image==NULL",
|
||||||
|
0, "FATAL", NULL);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
/* create a new image */
|
/* create a new image */
|
||||||
ret = iso_image_new("ISOIMAGE", image);
|
ret = iso_image_new("ISOIMAGE", image);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -164,14 +164,16 @@ int isoburn_read_image(struct burn_drive *d,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status != BURN_DISC_APPENDABLE && status != BURN_DISC_FULL) {
|
if (status != BURN_DISC_APPENDABLE && status != BURN_DISC_FULL) {
|
||||||
/* incorrect disc status */
|
burn_msgs_submit(0x00060000,
|
||||||
|
"Program error: isoburn_read_image: incorrect disc status",
|
||||||
|
0, "FATAL", NULL);
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset((char *) &ropts, 0, sizeof(ropts));
|
memset((char *) &ropts, 0, sizeof(ropts));
|
||||||
|
|
||||||
ret = isoburn_disc_get_msc1(d, &int_num);
|
ret = isoburn_disc_get_msc1(d, &int_num);
|
||||||
if (ret < 0)
|
if (ret <= 0)
|
||||||
return -2;
|
return -2;
|
||||||
ms_block= int_num;
|
ms_block= int_num;
|
||||||
|
|
||||||
@ -233,13 +235,15 @@ int isoburn_attach_image(struct burn_drive *d, IsoImage *image)
|
|||||||
int ret;
|
int ret;
|
||||||
struct isoburn *o;
|
struct isoburn *o;
|
||||||
|
|
||||||
if (image == NULL)
|
if (image == NULL) {
|
||||||
|
burn_msgs_submit(0x00060000,
|
||||||
|
"Program error: isoburn_attach_image: image==NULL",
|
||||||
|
0, "FATAL", NULL);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
ret = isoburn_find_emulator(&o, d, 0);
|
ret = isoburn_find_emulator(&o, d, 0);
|
||||||
if (ret < 0)
|
if (ret < 0 || o == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
if (o == NULL)
|
|
||||||
return -1;
|
|
||||||
if(o->image != NULL)
|
if(o->image != NULL)
|
||||||
iso_image_unref(o->image);
|
iso_image_unref(o->image);
|
||||||
o->image = image;
|
o->image = image;
|
||||||
@ -284,8 +288,12 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
|
|||||||
struct burn_drive *drive;
|
struct burn_drive *drive;
|
||||||
struct ecma119_pri_vol_desc *pvm;
|
struct ecma119_pri_vol_desc *pvm;
|
||||||
|
|
||||||
if(o==NULL)
|
if(o==NULL) {
|
||||||
|
burn_msgs_submit(0x00060000,
|
||||||
|
"Program error: isoburn_start_emulation: o==NULL",
|
||||||
|
0, "FATAL", NULL);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
drive= o->drive;
|
drive= o->drive;
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ int isoburn_prepare_new_image(struct burn_drive *in_drive,
|
|||||||
preparation call.
|
preparation call.
|
||||||
@param flag Bitfield, submit 0 for now.
|
@param flag Bitfield, submit 0 for now.
|
||||||
bit0= -reserved for internal use-
|
bit0= -reserved for internal use-
|
||||||
@return <=0 error , 1 = success
|
@return <0 error, 0= no pending preparations detectable, 1 = canceled
|
||||||
*/
|
*/
|
||||||
int isoburn_cancel_prepared_write(struct burn_drive *input_drive, int flag);
|
int isoburn_cancel_prepared_write(struct burn_drive *input_drive, int flag);
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2008.02.04.154405"
|
#define Xorriso_timestamP "2008.02.04.184038"
|
||||||
|
@ -298,10 +298,13 @@ int Xorriso_report_iso_error(struct XorrisO *xorriso,
|
|||||||
int error_code, iso_sev, min_sev, ret;
|
int error_code, iso_sev, min_sev, ret;
|
||||||
char *sev_text_pt, *msg_text_pt= NULL;
|
char *sev_text_pt, *msg_text_pt= NULL;
|
||||||
|
|
||||||
/* <<< delete as soon as replacement appears in libisofs */
|
error_code= 0x00050000;
|
||||||
#define ISO_ERR_CODE(e) (e & 0x0000FFFF)
|
|
||||||
|
|
||||||
|
/* It would have been neat ...
|
||||||
|
#define ISO_ERR_CODE(e) (e & 0x0000FFFF)
|
||||||
error_code= 0x00050000 | ISO_ERR_CODE(iso_error_code);
|
error_code= 0x00050000 | ISO_ERR_CODE(iso_error_code);
|
||||||
|
*/
|
||||||
|
|
||||||
if(flag&1)
|
if(flag&1)
|
||||||
msg_text_pt= (char *) iso_error_to_msg(iso_error_code);
|
msg_text_pt= (char *) iso_error_to_msg(iso_error_code);
|
||||||
if(msg_text_pt==NULL)
|
if(msg_text_pt==NULL)
|
||||||
@ -838,6 +841,10 @@ no_track:;
|
|||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
||||||
goto ex;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
/* Done early to free any reference to the libisofs resources via disc */
|
||||||
|
if(disc!=NULL)
|
||||||
|
burn_disc_free(disc);
|
||||||
|
disc= NULL;
|
||||||
/* To wait for the end of the libisofs threads and their messages. */
|
/* To wait for the end of the libisofs threads and their messages. */
|
||||||
isoburn_sync_after_write(source_drive, 1);
|
isoburn_sync_after_write(source_drive, 1);
|
||||||
Xorriso_process_msg_queues(xorriso,0);
|
Xorriso_process_msg_queues(xorriso,0);
|
||||||
@ -1565,12 +1572,15 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag)
|
|||||||
else {
|
else {
|
||||||
ret= burn_msgs_obtain("ALL", &error_code, xorriso->info_text, &os_errno,
|
ret= burn_msgs_obtain("ALL", &error_code, xorriso->info_text, &os_errno,
|
||||||
severity);
|
severity);
|
||||||
tunneled= (error_code>=0x00050000 && error_code<0x00060000);
|
if(error_code>=0x00050000 && error_code<0x00060000)
|
||||||
|
tunneled= -1; /* "libisofs:" */
|
||||||
|
if(error_code>=0x00060000 && error_code<0x00070000)
|
||||||
|
tunneled= 1; /* "libisoburn:" */
|
||||||
}
|
}
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
break;
|
break;
|
||||||
Xorriso_msgs_submit(xorriso, error_code, xorriso->info_text, os_errno,
|
Xorriso_msgs_submit(xorriso, error_code, xorriso->info_text, os_errno,
|
||||||
severity, ((pass&&!tunneled)+1)<<2);
|
severity, ((pass+tunneled)+1)<<2);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user