1 
2 /* libdax_msgs
3    Message handling facility of libburn and libisofs.
4    Copyright (C) 2006-2016 Thomas Schmitt <scdbackup@gmx.net>,
5    provided under GPL version 2 or later.
6 */
7 
8 
9 /*
10   *Never* set this macro outside libdax_msgs.c !
11   The entrails of the message handling facility are not to be seen by
12   the other library components or the applications.
13 */
14 #ifdef LIBDAX_MSGS_H_INTERNAL
15 
16 
17 #ifndef LIBDAX_MSGS_SINGLE_THREADED
18 #include <pthread.h>
19 #endif
20 
21 
22 struct libdax_msgs_item {
23 
24  double timestamp;
25  pid_t process_id;
26  int origin;
27 
28  int severity;
29  int priority;
30 
31  /* Apply for your developer's error code range at
32       libburn-hackers@pykix.org
33     Report introduced codes in the list below. */
34  int error_code;
35 
36  char *msg_text;
37  int os_errno;
38 
39  struct libdax_msgs_item *prev,*next;
40 
41 };
42 
43 
44 struct libdax_msgs {
45 
46  int refcount;
47 
48  struct libdax_msgs_item *oldest;
49  struct libdax_msgs_item *youngest;
50  int count;
51 
52  int queue_severity;
53  int print_severity;
54  char print_id[81];
55 
56 #ifndef LIBDAX_MSGS_SINGLE_THREADED
57  pthread_mutex_t lock_mutex;
58 #endif
59 
60 
61 };
62 
63 #endif /* LIBDAX_MSGS_H_INTERNAL */
64 
65 
66 #ifndef LIBDAX_MSGS_H_INCLUDED
67 #define LIBDAX_MSGS_H_INCLUDED 1
68 
69 
70 #ifndef LIBDAX_MSGS_H_INTERNAL
71 
72 
73                           /* Architectural aspects */
74 /*
75   libdax_msgs is designed to serve in libraries which want to offer their
76   applications a way to control the output of library messages. It shall be
77   incorporated by an owner, i.e. a software entity which encloses the code
78   of the .c file.
79 
80   Owner of libdax_msgs is libburn. A fully compatible variant named libiso_msgs
81   is owned by libisofs and can get generated by a script of the libburn
82   project: libburn/libdax_msgs_to_xyz_msgs.sh .
83 
84   Reason: One cannot link two owners of the same variant together because
85   both would offer the same functions to the linker. For that situation one
86   has to create a compatible variant as it is done for libisofs.
87 
88   Compatible variants may get plugged together by call combinations like
89     burn_set_messenger(iso_get_messenger());
90   A new variant would demand a _set_messenger() function if it has to work
91   with libisofs. If only libburn is planned as link partner then a simple
92   _get_messenger() does suffice.
93   Take care to shutdown libburn before its provider of the *_msgs object
94   gets shut down.
95 
96 */
97 
98                           /* Public Opaque Handles */
99 
100 /** A pointer to this is a opaque handle to a message handling facility */
101 struct libdax_msgs;
102 
103 /** A pointer to this is a opaque handle to a single message item */
104 struct libdax_msgs_item;
105 
106 #endif /* ! LIBDAX_MSGS_H_INTERNAL */
107 
108 
109                             /* Public Macros */
110 
111 
112 /* Registered Severities */
113 
114 /* It is well advisable to let applications select severities via strings and
115    forwarded functions libdax_msgs__text_to_sev(), libdax_msgs__sev_to_text().
116    These macros are for use by the owner of libdax_msgs.
117 */
118 
119 /** Use this to get messages of any severity. Do not use for submitting.
120 */
121 #define LIBDAX_MSGS_SEV_ALL                                          0x00000000
122 
123 
124 /** Messages of this severity shall transport plain disk file paths
125     whenever an event of severity SORRY or above is related with an
126     individual disk file.
127     No message text shall be added to the file path. The ERRFILE message
128     shall be issued before the human readable message which carries the
129     true event severity. That message should contain the file path so it
130     can be found by strstr(message, path)!=NULL.
131     The error code shall be the same as with the human readable message.
132 */
133 #define LIBDAX_MSGS_SEV_ERRFILE                                      0x08000000
134 
135 
136 /** Debugging messages not to be visible to normal users by default
137 */
138 #define LIBDAX_MSGS_SEV_DEBUG                                        0x10000000
139 
140 /** Update of a progress report about long running actions
141 */
142 #define LIBDAX_MSGS_SEV_UPDATE                                       0x20000000
143 
144 /** Not so usual events which were gracefully handled
145 */
146 #define LIBDAX_MSGS_SEV_NOTE                                         0x30000000
147 
148 /** Possibilities to achieve a better result
149 */
150 #define LIBDAX_MSGS_SEV_HINT                                         0x40000000
151 
152 /** Warnings about problems which could not be handled optimally
153 */
154 #define LIBDAX_MSGS_SEV_WARNING                                      0x50000000
155 
156 
157 /** Non-fatal error messages indicating that parts of an action failed but
158     processing may go on if one accepts deviations from the desired result.
159 
160     SORRY may also be the severity for incidents which are severe enough
161     for FAILURE but happen within already started irrevocable actions,
162     like ISO image generation. A precondition for such a severity ease is
163     that the action can be continued after the incident.
164     See below MISHAP for what xorriso would need instead of this kind of SORRY
165     and generates for itself in case of libisofs image generation.
166 
167     E.g.: A pattern yields no result.
168           A speed setting cannot be made.
169           A libisofs input file is inaccessible during image generation.
170 
171     After SORRY a function should try to go on if that makes any sense
172     and if no threshold prescribes abort on SORRY. The function should
173     nevertheless indicate some failure in its return value.
174     It should - but it does not have to.
175 */
176 #define LIBDAX_MSGS_SEV_SORRY                                        0x60000000
177 
178 
179 /** A FAILURE (see below) which can be tolerated during long lasting
180     operations just because they cannot simply be stopped or revoked.
181 
182     xorriso converts libisofs SORRY messages issued during image generation
183     into MISHAP messages in order to allow its evaluators to distinguish
184     image generation problems from minor image composition problems.
185     E.g.:
186       A libisofs input file is inaccessible during image generation.
187 
188     After a MISHAP a function should behave like after SORRY.
189 */
190 #define LIBDAX_MSGS_SEV_MISHAP                                       0x64000000
191 
192 
193 /** Non-fatal error indicating that an important part of an action failed and
194     that only a new setup of preconditions will give hope for sufficient
195     success.
196 
197     E.g.: No media is inserted in the output drive.
198           No write mode can be found for inserted media.
199           A libisofs input file is inaccessible during grafting.
200 
201     After FAILURE a function should end with a return value indicating failure.
202     It is at the discretion of the function whether it ends immediately in any
203     case or whether it tries to go on if the eventual threshold allows.
204 */
205 #define LIBDAX_MSGS_SEV_FAILURE                                      0x68000000
206 
207 
208 /** An error message which puts the whole operation of the program in question
209 
210     E.g.: Not enough memory for essential temporary objects.
211           Irregular errors from resources.
212           Programming errors (soft assert).
213 
214     After FATAL a function should end very soon with a return value
215     indicating severe failure.
216 */
217 #define LIBDAX_MSGS_SEV_FATAL                                        0x70000000
218 
219 
220 /** A message from an abort handler which will finally finish libburn
221 */
222 #define LIBDAX_MSGS_SEV_ABORT                                        0x71000000
223 
224 /** A severity to exclude resp. discard any possible message.
225     Do not use this severity for submitting.
226 */
227 #define LIBDAX_MSGS_SEV_NEVER                                        0x7fffffff
228 
229 
230 /* Registered Priorities */
231 
232 /* Priorities are to be selected by the programmers and not by the user. */
233 
234 #define LIBDAX_MSGS_PRIO_ZERO                                        0x00000000
235 #define LIBDAX_MSGS_PRIO_LOW                                         0x10000000
236 #define LIBDAX_MSGS_PRIO_MEDIUM                                      0x20000000
237 #define LIBDAX_MSGS_PRIO_HIGH                                        0x30000000
238 #define LIBDAX_MSGS_PRIO_TOP                                         0x7ffffffe
239 
240 /* Do not use this priority for submitting */
241 #define LIBDAX_MSGS_PRIO_NEVER                                       0x7fffffff
242 
243 
244 /* Origin numbers of libburn drives may range from 0 to 1048575 */
245 #define LIBDAX_MSGS_ORIGIN_DRIVE_BASE          0
246 #define LIBDAX_MSGS_ORIGIN_DRIVE_TOP     0xfffff
247 
248 /* Origin numbers of libisofs images may range from 1048575 to 2097152 */
249 #define LIBDAX_MSGS_ORIGIN_IMAGE_BASE   0x100000
250 #define LIBDAX_MSGS_ORIGIN_IMAGE_TOP    0x1fffff
251 
252 
253 
254                             /* Public Functions */
255 
256        /* Calls initiated from inside the direct owner (e.g. from libburn) */
257 
258 
259 /** Create new empty message handling facility with queue and issue a first
260     official reference to it.
261     @param flag Bitfield for control purposes (unused yet, submit 0)
262     @return >0 success, <=0 failure
263 */
264 int libdax_msgs_new(struct libdax_msgs **m, int flag);
265 
266 
267 /** Destroy a message handling facility and all its eventual messages.
268     The submitted pointer gets set to NULL.
269     Actually only the last destroy call of all official references to the
270     object will really dispose it. All others just decrement the reference
271     counter.
272     Call this function only with official reference pointers obtained by
273     libdax_msgs_new() or libdax_msgs_refer(), and only once per such pointer.
274     @param flag Bitfield for control purposes (unused yet, submit 0)
275     @return 1 for success, 0 for pointer to NULL, -1 for fatal error
276 */
277 int libdax_msgs_destroy(struct libdax_msgs **m, int flag);
278 
279 
280 /** Create an official reference to an existing libdax_msgs object. The
281     references keep the object alive at least until it is released by
282     a matching number of destroy calls. So each reference MUST be revoked
283     by exactly one call to libdax_msgs_destroy().
284     @param pt The pointer to be set and registered
285     @param m  A pointer to the existing object
286     @param flag Bitfield for control purposes (unused yet, submit 0)
287     @return 1 for success, 0 for failure
288 */
289 int libdax_msgs_refer(struct libdax_msgs **pt, struct libdax_msgs *o, int flag);
290 
291 
292 /** Submit a message to a message handling facility.
293     @param origin  program specific identification number of the originator of
294                    a message. E.g. drive number. Programs should have an own
295                    range of origin numbers. See above LIBDAX_MSGS_ORIGIN_*_BASE
296                    Use -1 if no number is known.
297     @param error_code  Unique error code. Use only registered codes. See below.
298                    The same unique error_code may be issued at different
299                    occasions but those should be equivalent out of the view
300                    of a libdax_msgs application. (E.g. "cannot open ATA drive"
301                    versus "cannot open SCSI drive" would be equivalent.)
302     @param severity The LIBDAX_MSGS_SEV_* of the event.
303     @param priority The LIBDAX_MSGS_PRIO_* number of the event.
304     @param msg_text Printable and human readable message text.
305     @param os_errno Eventual error code from operating system (0 if none)
306     @param flag Bitfield for control purposes
307                     bit0= If direct output to stderr:
308                           CarriageReturn rather than LineFeed
309     @return 1 on success, 0 on rejection, <0 for severe errors
310 */
311 int libdax_msgs_submit(struct libdax_msgs *m, int origin, int error_code,
312                        int severity, int priority, char *msg_text,
313                        int os_errno, int flag);
314 
315 
316 
317      /* Calls from applications (to be forwarded by direct owner) */
318 
319 
320 /** Convert a registered severity number into a severity name
321     @param flag Bitfield for control purposes:
322       bit0= list all severity names in a blank separated string
323     @return >0 success, <=0 failure
324 */
325 int libdax_msgs__sev_to_text(int severity, char **severity_name,
326                              int flag);
327 
328 
329 /** Convert a severity name into a severity number,
330     @param flag Bitfield for control purposes (unused yet, submit 0)
331     @return >0 success, <=0 failure
332 */
333 int libdax_msgs__text_to_sev(char *severity_name, int *severity,
334                              int flag);
335 
336 
337 /** Set minimum severity for messages to be queued (default
338     LIBDAX_MSGS_SEV_ALL) and for messages to be printed directly to stderr
339     (default LIBDAX_MSGS_SEV_NEVER).
340     @param print_id A text of at most 80 characters to be printed before
341                     any eventually printed message (default is "libdax: ").
342     @param flag Bitfield for control purposes (unused yet, submit 0)
343     @return always 1 for now
344 */
345 int libdax_msgs_set_severities(struct libdax_msgs *m, int queue_severity,
346                                int print_severity, char *print_id, int flag);
347 
348 
349 /** Obtain a message item that has at least the given severity and priority.
350     Usually all older messages of lower severity are discarded then. If no
351     item of sufficient severity was found, all others are discarded from the
352     queue.
353     @param flag Bitfield for control purposes (unused yet, submit 0)
354     @return 1 if a matching item was found, 0 if not, <0 for severe errors
355 */
356 int libdax_msgs_obtain(struct libdax_msgs *m, struct libdax_msgs_item **item,
357                        int severity, int priority, int flag);
358 
359 
360 /** Destroy a message item obtained by libdax_msgs_obtain(). The submitted
361     pointer gets set to NULL.
362     Caution: Copy eventually obtained msg_text before destroying the item,
363              if you want to use it further.
364     @param flag Bitfield for control purposes (unused yet, submit 0)
365     @return 1 for success, 0 for pointer to NULL, <0 for severe errors
366 */
367 int libdax_msgs_destroy_item(struct libdax_msgs *m,
368                              struct libdax_msgs_item **item, int flag);
369 
370 
371 /** Obtain from a message item the three application oriented components as
372     submitted with the originating call of libdax_msgs_submit().
373     Caution: msg_text becomes a pointer into item, not a copy.
374     @param flag Bitfield for control purposes (unused yet, submit 0)
375     @return 1 on success, 0 on invalid item, <0 for servere errors
376 */
377 int libdax_msgs_item_get_msg(struct libdax_msgs_item *item,
378                              int *error_code, char **msg_text, int *os_errno,
379                              int flag);
380 
381 
382 /** Obtain from a message item the submitter identification submitted
383     with the originating call of libdax_msgs_submit().
384     @param flag Bitfield for control purposes (unused yet, submit 0)
385     @return 1 on success, 0 on invalid item, <0 for servere errors
386 */
387 int libdax_msgs_item_get_origin(struct libdax_msgs_item *item,
388                             double *timestamp, pid_t *process_id, int *origin,
389                             int flag);
390 
391 
392 /** Obtain from a message item severity and priority as submitted
393     with the originating call of libdax_msgs_submit().
394     @param flag Bitfield for control purposes (unused yet, submit 0)
395     @return 1 on success, 0 on invalid item, <0 for servere errors
396 */
397 int libdax_msgs_item_get_rank(struct libdax_msgs_item *item,
398                               int *severity, int *priority, int flag);
399 
400 
401 #ifdef LIBDAX_MSGS_________________
402 
403 
404                       /* Registered Error Codes */
405 
406 
407 Format: error_code  (LIBDAX_MSGS_SEV_*,LIBDAX_MSGS_PRIO_*) = explanation
408 If no severity or priority are fixely associated, use "(,)".
409 
410 ------------------------------------------------------------------------------
411 Range "libdax_msgs"        :  0x00000000 to 0x0000ffff
412 
413  0x00000000 (ALL,ZERO)     = Initial setting in new libdax_msgs_item
414  0x00000001 (DEBUG,ZERO)   = Test error message
415  0x00000002 (DEBUG,ZERO)   = Debugging message
416  0x00000003 (FATAL,HIGH)   = Out of virtual memory
417  0x00000004 (FATAL,HIGH)   = Generic fatal error
418 
419 
420 ------------------------------------------------------------------------------
421 Range "elmom"              :  0x00010000 to 0x0001ffff
422 
423 
424 
425 ------------------------------------------------------------------------------
426 Range "scdbackup"          :  0x00020000 to 0x0002ffff
427 
428  Accessing and defending drives:
429 
430  0x00020001 (SORRY,LOW)    = Cannot open busy device
431  0x00020002 (SORRY,HIGH)   = Encountered error when closing drive
432  0x00020003 (SORRY,HIGH)   = Could not grab drive
433  0x00020004 (NOTE,HIGH)    = Opened O_EXCL scsi sibling
434  0x00020005 (SORRY,HIGH)   = Failed to open device
435  0x00020006 (FATAL,HIGH)   = Too many scsi siblings
436  0x00020007 (NOTE,HIGH)    = Closed O_EXCL scsi siblings
437  0x00020008 (SORRY,HIGH)   = Device busy. Failed to fcntl-lock
438  0x00020009 (SORRY,HIGH)   = Neither stdio-path nor its directory exist
439  0x0002000a (FAILURE,HIGH) = Cannot accept '...' as SG_IO CDROM drive
440  0x0002000b (FAILURE,HIGH) = File object '...' not found
441  0x0002000c (FAILURE,HIGH) = Cannot start device file enumeration
442  0x0002000d (FAILURE,HIGH) = Cannot enumerate next device
443  0x0002000e (NOTE,HIGH)    = Failed to open device during
444 
445  General library operations:
446 
447  0x00020101 (WARNING,HIGH) = Cannot find given worker item
448  0x00020102 (SORRY,HIGH)   = A drive operation is still going on
449  0x00020103 (WARNING,HIGH) = After scan a drive operation is still going on
450  0x00020104 (SORRY,HIGH)   = NULL pointer caught
451  0x00020105 (SORRY,HIGH)   = Drive is already released
452  0x00020106 (SORRY,HIGH)   = Drive is busy on attempt to close
453  0x00020107 (WARNING,HIGH) = A drive is still busy on shutdown of library
454  0x00020108 (SORRY,HIGH)   = Drive is not grabbed on disc status inquiry
455  0x00020108 (FATAL,HIGH)   = Could not allocate new drive object
456  0x00020109 (FATAL,HIGH)   = Library not running
457  0x0002010a (FATAL,HIGH)   = Unsuitable track mode
458  0x0002010b (FATAL,HIGH)   = Burn run failed
459  0x0002010c (FATAL,HIGH)   = Failed to transfer command to drive
460  0x0002010d (DEBUG,HIGH)   = Could not inquire TOC
461  0x0002010e (FATAL,HIGH)   = Attempt to read ATIP from ungrabbed drive
462  0x0002010f (DEBUG,HIGH)   = SCSI error condition on command
463  0x00020110 (FATAL,HIGH)   = Persistent drive address too long
464  0x00020111 (FATAL,HIGH)   = Could not allocate new auxiliary object
465  0x00020112 (SORRY,HIGH)   = Bad combination of write_type and block_type
466  0x00020113 (FATAL,HIGH)   = Drive capabilities not inquired yet
467  0x00020114 (SORRY,HIGH)   = Attempt to set ISRC with bad data
468  0x00020115 (SORRY,HIGH)   = Attempt to set track mode to unusable value
469  0x00020116 (FATAL,HIGH)   = Track mode has unusable value
470  0x00020117 (FATAL,HIGH)   = toc_entry of drive is already in use
471  0x00020118 (DEBUG,HIGH)   = Closing track
472  0x00020119 (DEBUG,HIGH)   = Closing session
473  0x0002011a (NOTE,HIGH)    = Padding up track to minimum size
474  0x0002011b (FATAL,HIGH)   = Attempt to read track info from ungrabbed drive
475  0x0002011c (FATAL,HIGH)   = Attempt to read track info from busy drive
476  0x0002011d (FATAL,HIGH)   = SCSI error on write
477  0x0002011e (SORRY,HIGH)   = Unsuitable media detected
478  0x0002011f (SORRY,HIGH)   = Burning is restricted to a single track
479  0x00020120 (NOTE,HIGH)    = FORMAT UNIT ignored
480  0x00020121 (FATAL,HIGH)   = Write preparation setup failed
481  0x00020122 (FAILURE,HIGH) = SCSI error on format_unit
482  0x00020123 (SORRY,HIGH)   = DVD Media are unsuitable for desired track type
483  0x00020124 (SORRY,HIGH)   = SCSI error on set_streaming
484  0x00020125 (SORRY,HIGH)   = Write start address not supported
485  0x00020126 (SORRY,HIGH)   = Write start address not properly aligned
486  0x00020127 (NOTE,HIGH)    = Write start address is ...
487  0x00020128 (FATAL,HIGH)   = Unsupported inquiry_type with mmc_get_performance
488  0x00020129 (SORRY,HIGH)   = Will not format media type
489  0x0002012a (FATAL,HIGH)   = Cannot inquire write mode capabilities
490  0x0002012b (FATAL,HIGH)   = Drive offers no suitable write mode with this job
491  0x0002012c (SORRY,HIGH)   = Too many logical tracks recorded
492  0x0002012d (FATAL,HIGH)   = Exceeding range of permissible write addresses
493  0x0002012e (NOTE,HIGH)    = Activated track default size
494  0x0002012f (SORRY,HIGH)   = SAO is restricted to single fixed size session
495  0x00020130 (SORRY,HIGH)   = Drive and media state unsuitable for blanking
496  0x00020131 (SORRY,HIGH)   = No suitable formatting type offered by drive
497  0x00020132 (SORRY,HIGH)   = Selected format is not suitable for libburn
498  0x00020133 (SORRY,HIGH)   = Cannot mix data and audio in SAO mode
499  0x00020134 (NOTE,HIGH)    = Defaulted TAO to DAO
500  0x00020135 (SORRY,HIGH)   = Cannot perform TAO, job unsuitable for DAO
501  0x00020136 (SORRY,HIGH)   = DAO burning restricted to single fixed size track
502  0x00020137 (HINT,HIGH)    = TAO would be possible
503  0x00020138 (FATAL,HIGH)   = Cannot reserve track
504  0x00020139 (SORRY,HIGH)   = Write job parameters are unsuitable
505  0x0002013a (FATAL,HIGH)   = No suitable media detected
506  0x0002013b (DEBUG,HIGH)   = SCSI command indicates host or driver error
507  0x0002013c (SORRY,HIGH)   = Malformed capabilities page 2Ah received
508  0x0002013d (DEBUG,LOW)    = Waiting for free buffer space takes long time
509  0x0002013e (SORRY,HIGH)   = Timeout with waiting for free buffer. Now disabled
510  0x0002013f (DEBUG,LOW)    = Reporting total time spent with waiting for buffer
511  0x00020140 (FATAL,HIGH)   = Drive is busy on attempt to write random access
512  0x00020141 (SORRY,HIGH)   = Write data count not properly aligned
513  0x00020142 (FATAL,HIGH)   = Drive is not grabbed on random access write
514  0x00020143 (SORRY,HIGH)   = Read start address not properly aligned
515  0x00020144 (SORRY,HIGH)   = SCSI error on read
516  0x00020145 (FATAL,HIGH)   = Drive is busy on attempt to read data
517  0x00020146 (FATAL,HIGH)   = Drive is a virtual placeholder
518  0x00020147 (SORRY,HIGH)   = Cannot address start byte
519  0x00020148 (SORRY,HIGH)   = Cannot write desired amount of data
520  0x00020149 (SORRY,HIGH)   = Unsuitable filetype for pseudo-drive
521  0x0002014a (SORRY,HIGH)   = Cannot read desired amount of data
522  0x0002014b (SORRY,HIGH)   = Drive is already registered resp. scanned
523  0x0002014c (FATAL,HIGH)   = Emulated drive caught in SCSI function
524  0x0002014d (SORRY,HIGH)   = Asynchronous SCSI error
525  0x0002014f (SORRY,HIGH)   = Timeout with asynchronous SCSI command
526  0x00020150 (DEBUG,LOW)    = Reporting asynchronous waiting time
527  0x00020151 (FAILURE,HIGH) = Read attempt on write-only drive
528  0x00020152 (FATAL,HIGH)   = Cannot start fifo thread
529  0x00020153 (SORRY,HIGH)   = Read error on fifo input
530  0x00020154 (NOTE,HIGH)    = Forwarded input error ends output
531  0x00020155 (SORRY,HIGH)   = Desired fifo buffer too large
532  0x00020156 (SORRY,HIGH)   = Desired fifo buffer too small
533  0x00020157 (FATAL,HIGH)   = burn_source is not a fifo object
534  0x00020158 (DEBUG,LOW)    = Reporting thread disposal precautions
535  0x00020159 (DEBUG,HIGH)   = TOC Format 0 returns inconsistent data
536  0x0002015a (NOTE,HIGH)    = Could not examine busy device
537  0x0002015b (HINT,HIGH)    = Busy '...' seems to be a hard disk, as '...1' exists
538  0x0002015c (FAILURE,HIGH) = Fifo size too small for desired peek buffer
539  0x0002015d (FAILURE,HIGH) = Fifo input ended short of desired peek buffer size
540  0x0002015e (FATAL,HIGH)   = Fifo is already under consumption when peeking
541  0x0002015f (MISHAP,HIGH)  = Damaged CD table-of-content detected and truncated
542  0x00020160 (WARNING,HIGH) = Session without leadout encountered
543  0x00020161 (WARNING,HIGH) = Empty session deleted
544  0x00020162 (SORRY,HIGH)   = BD-R not unformatted blank any more. Cannot format
545  0x00020163 (NOTE,HIGH)    = Blank BD-R left unformatted for zero spare capacity
546  0x00020164 (SORRY,HIGH)   = Drive does not format BD-RE without spares
547  0x00020165 (WARNING,HIGH) = Drive does not support fast formatting
548  0x00020166 (WARNING,HIGH) = Drive does not support full formatting
549  0x00020167 (SORRY,HIGH)   = Drive does not support non-default formatting
550  0x00020168 (FAILURE,HIGH) = Media not properly formatted. Cannot write.
551  0x00020169 (WARNING,HIGH) = Last session on media is still open
552  0x0002016a (FAILURE,HIGH) = No MMC transport adapter is present
553  0x0002016b (WARNING,HIGH) = No MMC transport adapter is present
554  0x0002016c (DEBUG,HIGH)   = No MMC transport adapter is present
555  0x0002016e (DEBUG,HIGH)   = MODE SENSE page 2A too short
556  0x0002016f (DEBUG,HIGH)   = Unable to grab scanned drive
557  0x00020170 (NOTE,HIGH)    = Closing open session before writing new one
558  0x00020171 (NOTE,HIGH)    = Closing BD-R with accidentally open session
559  0x00020172 (SORRY,HIGH)   = Read start address larger than number of readable blocks
560  0x00020173 (FAILURE,HIGH) = Drive tells NWA smaller than last written address
561  0x00020174 (SORRY,HIGH)   = Fifo alignment does not allow desired read size
562  0x00020175 (FATAL,HIGH)   = Supporting library is too old
563  0x00020176 (NOTE,HIGH)    = Stream recording disabled because of small OS buffer
564  0x00020177 (ABORT,HIGH)   = Urged drive worker threads to do emergency halt
565  0x00020178 (DEBUG,HIGH)   = Write thread ended
566  0x00020179 (FAILURE,HIGH) = Offset source start address is before end of previous source
567  0x0002017a (FAILURE,HIGH) = Expected offset source object as parameter
568  0x0002017b (WARNING,HIGH) = Sequential BD-R media likely to soon fail writing
569  0x0002017c (FAILURE,HIGH) = No valid write type selected
570  0x0002017d (FATAL,HIGH)   = Invalid file descriptor with stdio pseudo-drive
571  0x0002017e (FAILURE,HIGH) = Failed to close track, session, or disc
572  0x0002017f (FAILURE,HIGH) = Failed to synchronize drive cache
573  0x00020180 (FAILURE,HIGH) = Premature end of input encountered
574  0x00020181 (FAILURE,HIGH) = Pseudo-drive is a read-only file. Cannot write.
575  0x00020182 (FAILURE,HIGH) = Cannot truncate disk file for pseudo blanking
576  0x00020183 (WARNING,HIGH) = Failed to open device (a pseudo-drive) for reading
577  0x00020184 (WARNING,HIGH) = No Next-Writable-Address
578  0x00020185 (WARNING,HIGH) = Track damaged, not closed and not writable
579  0x00020186 (WARNING,HIGH) = Track damaged and not closed
580  0x00020187 (NOTE,HIGH)    = Track not marked as damaged. No action taken.
581  0x00020188 (FAILURE,HIGH) = Cannot close damaged track on given media type
582  0x00020189 (FATAL,HIGH)   = Drive is already grabbed by libburn
583  0x0002018a (SORRY,HIGH)   = Timeout exceeded. Retry canceled.
584  0x0002018b (FAILURE,HIGH) = Too many CD-TEXT packs
585  0x0002018c (FAILURE,HIGH) = CD-TEXT pack type out of range
586  0x0002018d (FAILURE,HIGH) = CD-TEXT block number out of range
587  0x0002018e (FAILURE,HIGH) = Too many CD-TEXT packs in block
588  0x0002018f (FAILURE,HIGH) = CD-TEXT pack CRC mismatch
589  0x00020190 (WARNING,HIGH) = CD-TEXT pack CRC mismatch had to be corrected
590  0x00020191 (FAILURE,HIGH) = Unknown parameter in text input file
591  0x00020192 (FAILURE,HIGH) = Text input file sequence error
592  0x00020193 (FAILURE,HIGH) = Text input file readability problem
593  0x00020194 (FAILURE,HIGH) = Text input file syntax error or specs violation
594  0x00020195 (WARNING,HIGH) = Text input file warning
595  0x00020196 (FAILURE,HIGH) = Session has already defined tracks
596  0x00020197 (FAILURE,HIGH) = Unsupported text input file feature
597  0x00020198 (FAILURE,HIGH) = CD-TEXT pack file readability problem
598  0x00020199 (SORRY,HIGH)   = Text input file reading aborted
599  0x0002019a (SORRY,HIGH)   = Bad track index number
600  0x0002019b (SORRY,HIGH)   = CD track number exceeds range of 1 to 99
601  0x0002019c (SORRY,HIGH)   = Session has no defined tracks
602  0x0002019d (SORRY,HIGH)   = Audio read size not properly aligned
603  0x0002019e (NOTE,HIGH)    = Drive does not support media certification
604  0x0002019f (FAILURE,HIGH) = CD-TEXT binary pack array faulty
605  0x000201a0 (WARNING,HIGH) = Maximum number of CD-TEXT blocks exceeded
606  0x000201a1 (FAILURE,HIGH) = Cannot open disk file for writing
607  0x000201a2 (FAILURE,HIGH) = Error while writing to disk file
608  0x000201a3 (UPDATE,HIGH)  = Progress message of burn_drive_extract_audio()
609  0x000201a4 (FAILURE,HIGH) = Failure to read audio sectors
610  0x000201a5 (FAILURE,HIGH) = Asynchronous SCSI error
611  0x000201a6 (FATAL,HIGH)   = Lost connection to drive
612  0x000201a7 (FAILURE,HIGH) = SCSI command yielded host problem
613  0x000201a8 (FAILURE,HIGH) = SCSI command yielded driver problem
614  0x000201a9 (FAILURE,HIGH) = Implausible length from GET CONFIGURATION
615  0x000201aa (FAILURE,HIGH) = No CD-TEXT packs in file
616  0x000201ab (WARN,HIGH)    = Leaving burn_source_fifo object undisposed
617  0x000201ac (NOTE,HIGH)    = Drive currently does not offer Stream Recording
618  0x000201ad (NOTE,HIGH)    = WRITE commands have been repeated
619 
620 
621  libdax_audioxtr:
622  0x00020200 (SORRY,HIGH)   = Cannot open audio source file
623  0x00020201 (SORRY,HIGH)   = Audio source file has unsuitable format
624  0x00020202 (SORRY,HIGH)   = Failed to prepare reading of audio data
625 
626 
627 
628 ------------------------------------------------------------------------------
629 Range "vreixo"              :  0x00030000 to 0x0003ffff
630 
631  0x0003ffff (FAILURE,HIGH) = Operation canceled
632  0x0003fffe (FATAL,HIGH)   = Unknown or unexpected fatal error
633  0x0003fffd (FAILURE,HIGH) = Unknown or unexpected error
634  0x0003fffc (FATAL,HIGH)   = Internal programming error
635  0x0003fffb (FAILURE,HIGH) = NULL pointer where NULL not allowed
636  0x0003fffa (FATAL,HIGH)   = Memory allocation error
637  0x0003fff9 (FATAL,HIGH)   = Interrupted by a signal
638  0x0003fff8 (FAILURE,HIGH) = Invalid parameter value
639  0x0003fff7 (FATAL,HIGH)   = Cannot create a needed thread
640  0x0003fff6 (FAILURE,HIGH) = Write error
641  0x0003fff5 (FAILURE,HIGH) = Buffer read error
642  0x0003ffc0 (FAILURE,HIGH) = Trying to add a node already added to another dir
643  0x0003ffbf (FAILURE,HIGH) = Node with same name already exist
644  0x0003ffbe (FAILURE,HIGH) = Trying to remove a node that was not added to dir
645  0x0003ffbd (FAILURE,HIGH) = A requested node does not exist
646  0x0003ffbc (FAILURE,HIGH) = Image already bootable
647  0x0003ffbb (FAILURE,HIGH) = Trying to use an invalid file as boot image
648  0x0003ff80 (FAILURE,HIGH) = Error on file operation
649  0x0003ff7f (FAILURE,HIGH) = Trying to open an already opened file
650  0x0003ff7e (FAILURE,HIGH) = Access to file is not allowed
651  0x0003ff7d (FAILURE,HIGH) = Incorrect path to file
652  0x0003ff7c (FAILURE,HIGH) = The file does not exist in the filesystem
653  0x0003ff7b (FAILURE,HIGH) = Trying to read or close a file not opened
654  0x0003ff7a (FAILURE,HIGH) = Directory used where no dir is expected
655  0x0003ff79 (FAILURE,HIGH) = File read error
656  0x0003ff78 (FAILURE,HIGH) = Not dir used where a dir is expected
657  0x0003ff77 (FAILURE,HIGH) = Not symlink used where a symlink is expected
658  0x0003ff76 (FAILURE,HIGH) = Cannot seek to specified location
659  0x0003ff75 (HINT,MEDIUM)  = File not supported in ECMA-119 tree and ignored
660  0x0003ff74 (HINT,MEDIUM)  = File bigger than supported by used standard
661  0x0003ff73 (MISHAP,HIGH)  = File read error during image creation
662  0x0003ff72 (HINT,MEDIUM)  = Cannot convert filename to requested charset
663  0x0003ff71 (SORRY,HIGH)   = File cannot be added to the tree
664  0x0003ff70 (HINT,MEDIUM)  = File path breaks specification constraints
665  0x0003ff00 (FAILURE,HIGH) = Charset conversion error
666  0x0003feff (FAILURE,HIGH) = Too much files to mangle
667  0x0003fec0 (FAILURE,HIGH) = Wrong or damaged Primary Volume Descriptor
668  0x0003febf (SORRY,HIGH)   = Wrong or damaged RR entry
669  0x0003febe (SORRY,HIGH)   = Unsupported RR feature
670  0x0003febd (FAILURE,HIGH) = Wrong or damaged ECMA-119
671  0x0003febc (FAILURE,HIGH) = Unsupported ECMA-119 feature
672  0x0003febb (SORRY,HIGH)   = Wrong or damaged El-Torito catalog
673  0x0003feba (SORRY,HIGH)   = Unsupported El-Torito feature
674  0x0003feb9 (SORRY,HIGH)   = Cannot patch isolinux boot image
675  0x0003feb8 (SORRY,HIGH)   = Unsupported SUSP feature
676  0x0003feb7 (WARNING,HIGH) = Error on a RR entry that can be ignored
677  0x0003feb6 (HINT,MEDIUM)  = Error on a RR entry that can be ignored
678  0x0003feb5 (WARNING,HIGH) = Multiple ER SUSP entries found
679  0x0003feb4 (HINT,MEDIUM)  = Unsupported volume descriptor found
680  0x0003feb3 (WARNING,HIGH) = El-Torito related warning
681  0x0003feb2 (MISHAP,HIGH)  = Image write cancelled
682  0x0003feb1 (WARNING,HIGH) = El-Torito image is hidden
683 
684 Outdated codes which may not be re-used for other purposes than
685 re-instating them, if ever:
686 
687 X 0x00031001 (SORRY,HIGH)    = Cannot read file (ignored)
688 X 0x00031002 (FATAL,HIGH)    = Cannot read file (operation canceled)
689 X 0x00031000 (FATAL,HIGH)    = Unsupported ISO-9660 image
690 X 0x00031001 (HINT,MEDIUM)   = Unsupported Vol Desc that will be ignored
691 X 0x00031002 (FATAL,HIGH)    = Damaged ISO-9660 image
692 X 0x00031003 (SORRY,HIGH)    = Cannot read previous image file
693 X 0x00030101 (HINT,MEDIUM)   = Unsupported SUSP entry that will be ignored
694 X 0x00030102 (SORRY,HIGH)    = Wrong/damaged SUSP entry
695 X 0x00030103 (WARNING,MEDIUM)= Multiple SUSP ER entries where found
696 X 0x00030111 (SORRY,HIGH)    = Unsupported RR feature
697 X 0x00030112 (SORRY,HIGH)    = Error in a Rock Ridge entry
698 X 0x00030201 (HINT,MEDIUM)   = Unsupported Boot Vol Desc that will be ignored
699 X 0x00030202 (SORRY,HIGH)    = Wrong El-Torito catalog
700 X 0x00030203 (HINT,MEDIUM)   = Unsupported El-Torito feature
701 X 0x00030204 (SORRY,HIGH)    = Invalid file to be an El-Torito image
702 X 0x00030205 (WARNING,MEDIUM)= Cannot properly patch isolinux image
703 X 0x00030206 (WARNING,MEDIUM)= Copying El-Torito from a previous image without
704 X                              enough info about it
705 X 0x00030301 (NOTE,MEDIUM)   = Unsupported file type for Joliet tree
706 
707 
708 ------------------------------------------------------------------------------
709 Range "application"         :  0x00040000 to 0x0004ffff
710 
711  0x00040000 (ABORT,HIGH)    : Application supplied message
712  0x00040001 (FATAL,HIGH)    : Application supplied message
713  0x00040002 (SORRY,HIGH)    : Application supplied message
714  0x00040003 (WARNING,HIGH)  : Application supplied message
715  0x00040004 (HINT,HIGH)     : Application supplied message
716  0x00040005 (NOTE,HIGH)     : Application supplied message
717  0x00040006 (UPDATE,HIGH)   : Application supplied message
718  0x00040007 (DEBUG,HIGH)    : Application supplied message
719  0x00040008 (*,HIGH)        : Application supplied message
720 
721 
722 ------------------------------------------------------------------------------
723 Range "libisofs-xorriso"    :  0x00050000 to 0x0005ffff
724 
725 This is an alternative representation of libisofs.so.6 error codes in xorriso.
726 If values returned by iso_error_get_code() do not fit into 0x30000 to 0x3ffff
727 then they get truncated to 16 bit and mapped into this range.
728 (This should never need to happen, of course.)
729 
730 ------------------------------------------------------------------------------
731 Range "libisoburn"          :  0x00060000 to 0x00006ffff
732 
733  0x00060000 (*,*)           : Message which shall be attributed to libisoburn
734 
735  >>> the messages of libisoburn need to be registered individually
736 
737 
738 ------------------------------------------------------------------------------
739 
740 #endif /* LIBDAX_MSGS_________________ */
741 
742 
743 
744 #ifdef LIBDAX_MSGS_H_INTERNAL
745 
746                              /* Internal Functions */
747 
748 
749 /** Lock before doing side effect operations on m */
750 static int libdax_msgs_lock(struct libdax_msgs *m, int flag);
751 
752 /** Unlock after effect operations on m are done */
753 static int libdax_msgs_unlock(struct libdax_msgs *m, int flag);
754 
755 
756 /** Create new empty message item.
757     @param link Previous item in queue
758     @param flag Bitfield for control purposes (unused yet, submit 0)
759     @return >0 success, <=0 failure
760 */
761 static int libdax_msgs_item_new(struct libdax_msgs_item **item,
762                                 struct libdax_msgs_item *link, int flag);
763 
764 /** Destroy a message item obtained by libdax_msgs_obtain(). The submitted
765     pointer gets set to NULL.
766     @param flag Bitfield for control purposes (unused yet, submit 0)
767     @return 1 for success, 0 for pointer to NULL
768 */
769 static int libdax_msgs_item_destroy(struct libdax_msgs_item **item, int flag);
770 
771 
772 #endif /* LIBDAX_MSGS_H_INTERNAL */
773 
774 
775 #endif /* ! LIBDAX_MSGS_H_INCLUDED */
776