Ticket #125 (closed bug: fixed)
Message queue API enhancement needed for libisofs
|Reported by:||scdbackup||Owned by:||vreixo|
This is a long term trap that should be solved soon.
Problem: When new severities are introduced then the producer of such messages has to provide translation functions from severity to text and vice versa. libburn does, libisofs does not. For now libisoburn uses the translation functions of libburn and tunnels messages through the libburn message queue which it generated from libisofs error replies.
But iso_error_get_severity() can theoretically issue severities which libburn does not know yet. So it can neither be translated nor submitted to the libburn message queue.
So it is necessary that libisofs can take care by itself for the severities which it issued as messages or as error return codes.
The libburn message API which is used by libisoburn for now:
/** Submit a message to the libburn queueing system. It will be queued or printed as if it was generated by libburn itself. @param error_code The unique error code of your message. Submit 0 if you do not have reserved error codes within the libburnia project. @param msg_text Not more than BURN_MSGS_MESSAGE_LEN characters of message text. @param os_errno Eventual errno related to the message. Submit 0 if the message is not related to a operating system error. @param severity One of "ABORT", "FATAL", "FAILURE", "SORRY", "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG". Defaults to "FATAL". @param d An eventual drive to which the message shall be related. Submit NULL if the message is not specific to a particular drive object. @return 1 if message was delivered, <=0 if failure */ int burn_msgs_submit(int error_code, char msg_text, int os_errno, char severity, struct burn_drive *d); ** Convert a severity name into a severity number, which gives the severity rank of the name. @param severity_name A name as with burn_msgs_submit(), e.g. "SORRY". @param severity_number The rank number: the higher, the more severe. @param flag Bitfield for control purposes (unused yet, submit 0) @return >0 success, <=0 failure */ int burn_text_to_sev(char *severity_name, int *severity_number, int flag); /** Convert a severity number into a severity name @param severity_number The rank number: the higher, the more severe. @param severity_name A name as with burn_msgs_submit(), e.g. "SORRY". @param flag Bitfield for control purposes (unused yet, submit 0) */ int burn_sev_to_text(int severity_number, char **severity_name, int flag);
These functions quite directly forward the libdax_msgs.[ch] functions
int libdax_msgs_submit(struct libdax_msgs *m, int origin, int error_code, int severity, int priority, char *msg_text, int os_errno, int flag); int libdax_msgs__text_to_sev(char *severity_name, int *severity, int flag); int libdax_msgs__sev_to_text(int severity, char **severity_name, int flag);
so implementation is not much work.
The current remedy in libburn and xorriso is to know in the app the newest pairs of severity text and code. Although these pairs are not inner secrets of the message system, this is not a clean solution.