Made use of ISO_ERR_SEV() and ISO_ERR_PRIO()
This commit is contained in:
@ -638,3 +638,81 @@ int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes,
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* <<< to be replaced by libburn-0.4.3 API call burn_sev_to_text().
|
||||
This is a copy of libdax_msgs__sev_to_text() which is not exposed
|
||||
by the API of of libburn-0.4.2 . As soon as xorriso gets based on
|
||||
libburn-0.4.4 this redundancy is to be removed.
|
||||
It is safe, nevertheless, because the severity codes are eternal.
|
||||
*/
|
||||
#define LIBDAX_MSGS_SEV_ALL 0x00000000
|
||||
#define LIBDAX_MSGS_SEV_DEBUG 0x10000000
|
||||
#define LIBDAX_MSGS_SEV_UPDATE 0x20000000
|
||||
#define LIBDAX_MSGS_SEV_NOTE 0x30000000
|
||||
#define LIBDAX_MSGS_SEV_HINT 0x40000000
|
||||
#define LIBDAX_MSGS_SEV_WARNING 0x50000000
|
||||
#define LIBDAX_MSGS_SEV_SORRY 0x60000000
|
||||
#define LIBDAX_MSGS_SEV_FAILURE 0x68000000
|
||||
#define LIBDAX_MSGS_SEV_FATAL 0x70000000
|
||||
#define LIBDAX_MSGS_SEV_ABORT 0x71000000
|
||||
#define LIBDAX_MSGS_SEV_NEVER 0x7fffffff
|
||||
|
||||
int isoburn__sev_to_text(int severity, char **severity_name,
|
||||
int flag)
|
||||
{
|
||||
if(flag&1) {
|
||||
*severity_name= "NEVER\nABORT\nFATAL\nFAILURE\nSORRY\nWARNING\nHINT\nNOTE\nUPDATE\nDEBUG\nALL";
|
||||
return(1);
|
||||
}
|
||||
*severity_name= "";
|
||||
if(severity>=LIBDAX_MSGS_SEV_NEVER)
|
||||
*severity_name= "NEVER";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_ABORT)
|
||||
*severity_name= "ABORT";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_FATAL)
|
||||
*severity_name= "FATAL";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_FAILURE)
|
||||
*severity_name= "FAILURE";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_SORRY)
|
||||
*severity_name= "SORRY";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_WARNING)
|
||||
*severity_name= "WARNING";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_HINT)
|
||||
*severity_name= "HINT";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_NOTE)
|
||||
*severity_name= "NOTE";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_UPDATE)
|
||||
*severity_name= "UPDATE";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_DEBUG)
|
||||
*severity_name= "DEBUG";
|
||||
else if(severity>=LIBDAX_MSGS_SEV_ALL)
|
||||
*severity_name= "ALL";
|
||||
else {
|
||||
*severity_name= "";
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_report_iso_error(int iso_error_code, char msg_text[], int os_errno,
|
||||
char min_severity[], int flag)
|
||||
{
|
||||
int error_code, iso_sev, min_sev, ret;
|
||||
char *sev_text_pt, *msg_text_pt= NULL;
|
||||
|
||||
error_code= 0x00050000 | ISO_ERR_CODE(iso_error_code);
|
||||
if(iso_error_code<0)
|
||||
msg_text_pt= (char *) iso_error_to_msg(iso_error_code);
|
||||
if(msg_text_pt==NULL)
|
||||
msg_text_pt= msg_text;
|
||||
iso_sev= ISO_ERR_SEV(iso_error_code);
|
||||
sev_text_pt= min_severity;
|
||||
burn_text_to_sev(min_severity, &min_sev, 0);
|
||||
if(min_sev < iso_sev)
|
||||
/* >>> with libburn-0.4.4 do: burn_sev_to_text(iso_sev, &sev_text_pt, 0); */
|
||||
isoburn__sev_to_text(iso_sev, &sev_text_pt, 0);
|
||||
ret= burn_msgs_submit(error_code, msg_text_pt, os_errno, sev_text_pt, NULL);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user