xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

messages.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Vreixo Formoso
3  * Copyright (c) 2009 - 2016 Thomas Schmitt
4  *
5  * This file is part of the libisofs project; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License version 2
7  * or later as published by the Free Software Foundation.
8  * See COPYING file for details.
9  */
10 
11 #ifdef HAVE_CONFIG_H
12 #include "../config.h"
13 #endif
14 
15 #include <stdlib.h>
16 #include <sys/types.h>
17 #include <string.h>
18 #include <stdio.h>
19 #include <stdarg.h>
20 
21 #ifdef Xorriso_standalonE
22 
23 #ifdef Xorriso_with_libjtE
24 #include "../libjte/libjte.h"
25 #endif
26 
27 #else
28 
29 #ifdef Libisofs_with_libjtE
30 #include <libjte/libjte.h>
31 #endif
32 
33 #endif /* ! Xorriso_standalonE */
34 
35 #include "libiso_msgs.h"
36 #include "libisofs.h"
37 #include "messages.h"
38 
39 #include "util.h"
40 #include "node.h"
41 #include "stream.h"
42 
43 
44 /*
45  * error codes are 32 bit numbers, that follow the following conventions:
46  *
47  * bit 31 (MSB) -> 1 (to make the value always negative)
48  * bits 30-24 -> Encoded severity (Use ISO_ERR_SEV to translate an error code
49  * to a LIBISO_MSGS_SEV_* constant)
50  * = 0x10 -> DEBUG
51  * = 0x20 -> UPDATE
52  * = 0x30 -> NOTE
53  * = 0x40 -> HINT
54  * = 0x50 -> WARNING
55  * = 0x60 -> SORRY
56  * = 0x64 -> MISHAP
57  * = 0x68 -> FAILURE
58  * = 0x70 -> FATAL
59  * = 0x71 -> ABORT
60  * bits 23-20 -> Encoded priority (Use ISO_ERR_PRIO to translate an error code
61  * to a LIBISO_MSGS_PRIO_* constant)
62  * = 0x0 -> ZERO
63  * = 0x1 -> LOW
64  * = 0x2 -> MEDIUM
65  * = 0x3 -> HIGH
66  * bits 19-16 -> Reserved for future usage (maybe message ranges)
67  * bits 15-0 -> Error code
68  */
69 #define ISO_ERR_SEV(e) (e & 0x7F000000)
70 #define ISO_ERR_PRIO(e) ((e & 0x00700000) << 8)
71 #define ISO_ERR_CODE(e) ((e & 0x0000FFFF) | 0x00030000)
72 
74 
75 /**
76  * Threshold for aborting.
77  */
79 
80 #define MAX_MSG_LEN 4096
81 
82 struct libiso_msgs *libiso_msgr = NULL;
83 
84 
85 /* ------------- List of xinfo clone functions ----------- */
86 
91 };
92 
94 
95 /* API */
97  iso_node_xinfo_cloner cloner, int flag)
98 {
99  struct iso_xinfo_cloner_assoc *assoc;
100 
101  /* Look for existing assoc of proc */
102  for (assoc = iso_xinfo_cloner_list; assoc != NULL; assoc = assoc->next)
103  if (assoc->proc == proc)
104  break;
105 
106  if (assoc == NULL) {
107  assoc = calloc(1, sizeof(struct iso_xinfo_cloner_assoc));
108  if (assoc == NULL)
109  return ISO_OUT_OF_MEM;
110  assoc->proc = proc;
111  assoc->next = iso_xinfo_cloner_list;
112  iso_xinfo_cloner_list = assoc;
113  }
114  assoc->cloner = cloner;
115  return ISO_SUCCESS;
116 }
117 
118 /* API */
120  iso_node_xinfo_cloner *cloner, int flag)
121 {
122  struct iso_xinfo_cloner_assoc *assoc;
123 
124  *cloner = NULL;
125  for (assoc = iso_xinfo_cloner_list; assoc != NULL; assoc = assoc->next) {
126  if (assoc->proc != proc)
127  continue;
128  *cloner = assoc->cloner;
129  return 1;
130  }
131  return 0;
132 }
133 
134 static
136 {
137  struct iso_xinfo_cloner_assoc *assoc, *next;
138 
139  for (assoc = iso_xinfo_cloner_list; assoc != NULL; assoc = next) {
140  next = assoc->next;
141  free((char *) assoc);
142  }
143  iso_xinfo_cloner_list= NULL;
144  return(1);
145 }
146 
147 /* ------------- End of xinfo clone functions list ----------- */
148 
149 
150 /*
151  @param flag bit0= do not set up locale by LC_* environment variables
152 */
153 int iso_init_with_flag(int flag)
154 {
155  int ret;
156 
157 #ifdef Libisofs_with_libjtE
158 
159  /* Ugly compile time check for header version compatibility.
160  If everything matches, then it produces no C code. In case of mismatch,
161  intentionally faulty C code will be inserted.
162  */
163  /* The indentation is an advise of man gcc to help old compilers ignoring */
164  #if iso_libjte_req_major > LIBJTE_VERSION_MAJOR
165  #define Libisofs_libjte_dot_h_too_olD 1
166  #endif
167  #if iso_libjte_req_major == LIBJTE_VERSION_MAJOR && iso_libjte_req_minor > LIBJTE_VERSION_MINOR
168  #define Libisofs_libjte_dot_h_too_olD 1
169  #endif
170  #if iso_libjte_req_minor == LIBJTE_VERSION_MINOR && iso_libjte_req_micro > LIBJTE_VERSION_MICRO
171  #define Libisofs_libjte_dot_h_too_olD 1
172  #endif
173 
174 #ifdef Libisofs_libjte_dot_h_too_olD
175 LIBJTE_MISCONFIGURATION = 0;
176 INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libjte_dot_h_TOO_OLD__SEE_libisofs_dot_h_AND_messages_c = 0;
177 LIBJTE_MISCONFIGURATION_ = 0;
178 #endif
179 
181  LIBJTE_VERSION_MICRO, 0)) {
182  fprintf(stderr,
183  "\nlibisofs: libjte TOO OLD ! Need at least libjte-%d.%d.%d\n\n",
186  return ISO_FATAL_ERROR;
187  }
188 
189 #endif /* Libisofs_with_libjtE */
190 
191  if (! (flag & 1)) {
192  iso_init_locale(0);
193  }
194  if (libiso_msgr == NULL) {
195  if (libiso_msgs_new(&libiso_msgr, 0) <= 0)
196  return ISO_FATAL_ERROR;
197  }
199  LIBISO_MSGS_SEV_FATAL, "libisofs: ", 0);
200 
202  if (ret < 0)
203  return ret;
206  if (ret < 0)
207  return ret;
210  if (ret < 0)
211  return ret;
214  if (ret < 0)
215  return ret;
218  if (ret < 0)
219  return ret;
222  if (ret < 0)
223  return ret;
224  return 1;
225 }
226 
227 int iso_init()
228 {
229  return iso_init_with_flag(0);
230 }
231 
233 {
237 }
238 
239 int iso_set_abort_severity(char *severity)
240 {
241  int ret, sevno;
242 
243  ret = libiso_msgs__text_to_sev(severity, &sevno, 0);
244  if (ret <= 0)
245  return ISO_WRONG_ARG_VALUE;
246  if (sevno > LIBISO_MSGS_SEV_FAILURE || sevno < LIBISO_MSGS_SEV_NOTE)
247  return ISO_WRONG_ARG_VALUE;
248  ret = abort_threshold;
249  abort_threshold = sevno;
250  return ret;
251 }
252 
253 void iso_msg_debug(int imgid, const char *fmt, ...)
254 {
255  char *msg = NULL;
256  va_list ap;
257 
259  va_start(ap, fmt);
260  vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
261  va_end(ap);
262 
264  LIBISO_MSGS_PRIO_ZERO, msg, 0, 0);
265 ex:;
266  LIBISO_FREE_MEM(msg);
267 }
268 
269 const char *iso_error_to_msg(int errcode)
270 {
271  switch(errcode) {
272  case ISO_CANCELED:
273  return "Operation canceled";
274  case ISO_FATAL_ERROR:
275  return "Unknown or unexpected fatal error";
276  case ISO_ERROR:
277  return "Unknown or unexpected error";
278  case ISO_ASSERT_FAILURE:
279  return "Internal programming error. Please report this bug";
280  case ISO_NULL_POINTER:
281  return "NULL pointer as value for an arg. that does not allow NULL";
282  case ISO_OUT_OF_MEM:
283  return "Memory allocation error";
284  case ISO_INTERRUPTED:
285  return "Interrupted by a signal";
286  case ISO_WRONG_ARG_VALUE:
287  return "Invalid parameter value";
288  case ISO_THREAD_ERROR:
289  return "Cannot create a needed thread";
290  case ISO_WRITE_ERROR:
291  return "Write error";
292  case ISO_BUF_READ_ERROR:
293  return "Buffer read error";
295  return "Trying to add to a dir a node already added to a dir";
297  return "Node with same name already exists";
299  return "Trying to remove a node that was not added to dir";
301  return "A requested node does not exist";
303  return "Try to set the boot image of an already bootable image";
305  return "Trying to use an invalid file as boot image";
307  return "Too many boot images added";
308  case ISO_FILE_ERROR:
309  return "Error on file operation";
311  return "Trying to open an already opened file";
313  return "Access to file is not allowed";
314  case ISO_FILE_BAD_PATH:
315  return "Incorrect path to file";
317  return "The file does not exist in the filesystem";
318  case ISO_FILE_NOT_OPENED:
319  return "Trying to read or close a file not opened";
320  case ISO_FILE_IS_DIR:
321  return "Directory used where no dir is expected";
322  case ISO_FILE_READ_ERROR:
323  return "Read error";
324  case ISO_FILE_IS_NOT_DIR:
325  return "Not dir used where a dir is expected";
327  return "Not symlink used where a symlink is expected";
328  case ISO_FILE_SEEK_ERROR:
329  return "Cannot seek to specified location";
330  case ISO_FILE_IGNORED:
331  return "File not supported in ECMA-119 tree and thus ignored";
332  case ISO_FILE_TOO_BIG:
333  return "A file is bigger than supported by used standard";
334  case ISO_FILE_CANT_WRITE:
335  return "File read error during image creation";
338  return "Cannot convert filename to requested charset";
339  case ISO_FILE_CANT_ADD:
340  return "File cannot be added to the tree";
342  return "File path break specification constraints and will be ignored";
344  return "Charset conversion error";
346  return "Too much files to mangle, cannot guarantee unique file names";
347  case ISO_WRONG_PVD:
348  return "Wrong or damaged Primary Volume Descriptor";
349  case ISO_WRONG_RR:
350  return "Wrong or damaged Rock Ridge entry";
351  case ISO_UNSUPPORTED_RR:
352  return "Unsupported Rock Ridge feature";
353  case ISO_WRONG_ECMA119:
354  return "Wrong or damaged ECMA-119";
356  return "Unsupported ECMA-119 feature";
357  case ISO_WRONG_EL_TORITO:
358  return "Wrong or damaged El-Torito catalog";
360  return "Unsupported El-Torito feature";
362  return "Cannot patch isolinux boot image";
364  return "Unsupported SUSP feature";
365  case ISO_WRONG_RR_WARN:
366  return "Error on a Rock Ridge entry that can be ignored";
367  case ISO_SUSP_UNHANDLED:
368  return "Unhandled SUSP entry";
370  return "Multiple ER SUSP entries found";
371  case ISO_UNSUPPORTED_VD:
372  return "Unsupported volume descriptor found";
373  case ISO_EL_TORITO_WARN:
374  return "El-Torito related warning";
376  return "Image write cancelled";
378  return "El-Torito image is hidden";
383  return "Read error occurred with IsoDataSource";
384  case ISO_AAIP_IGNORED:
385  return "AAIP info with ACL or xattr in ISO image will be ignored";
386  case ISO_AAIP_BAD_ACL:
387  return "Error with decoding ACL from AAIP info";
389  return "Error with encoding ACL for AAIP";
391  return "AAIP processing for ACL or xattr not enabled at compile time";
393  return "Error with decoding AAIP info for ACL or xattr";
395  return "Error with reading ACL or xattr from local file";
397  return "Error with attaching ACL or xattr to local file";
399  return "Unallowed attempt to set an xattr with non-userspace name";
400  case ISO_EXTF_TOO_OFTEN:
401  return "Too many references on a single external filter command";
403  return "Use of zlib was not enabled at compile time";
405  return "File too large. Cannot apply zisofs filter.";
407  return "Filter input differs from previous run";
408  case ISO_ZLIB_COMPR_ERR:
409  return "zlib compression/decompression error";
411  return "Input stream is not in a supported zisofs format";
413  return "Cannot set global zisofs parameters while filters exist";
414  case ISO_ZLIB_EARLY_EOF:
415  return "Premature EOF of zlib input stream";
417  return "Checksum area or checksum tag appear corrupted";
419  return "Checksum mismatch between checksum tag and data blocks";
421  return "Checksum mismatch in System Area, Volume Descriptors, or directory tree";
423  return "Unexpected checksum tag type encountered";
425  return "Misplaced checksum tag type encountered";
427  return "Checksum tag with unexpected address range encountered";
429  return "Detected file content changes while it was written into the image";
431  return "Session does not start at LBA 0. scdbackup checksum tag not written.";
432  case ISO_BOOT_NO_CATALOG:
433  return "No boot catalog created yet";
435  return "Multi-session offset too small for overwrite buffer";
437  return "Partition offset too small for first tree root.";
439  return "The ring buffer is too small for overwrite buffer";
441  return "Use of libjte was not enabled at compile time";
443  return "Failed to start up Jigdo Template Extraction";
445  return "Failed to finish Jigdo Template Extraction";
447  return "Failed to process file for Jigdo Template Extraction";
449  return "Too many MIPS Big Endian boot files given (max. 15)";
451  return "Boot file missing in image";
453  return "Partition number out of range";
455  return "Cannot open data file for appended partition";
457  return "May not combine MBR partition with non-MBR system area";
459  return "Displacement offset leads outside 32 bit range";
461  return "File name cannot be written into ECMA-119 untranslated";
462  case ISO_STREAM_NO_CLONE:
463  return "Data file input stream object offers no cloning method";
464  case ISO_XINFO_NO_CLONE:
465  return "Extended information class offers no cloning method";
466  case ISO_MD5_TAG_COPIED:
467  return "Found copied superblock checksum tag";
469  return "Rock Ridge leaf name too long";
471  return "Reserved Rock Ridge leaf name";
473  return "Rock Ridge path too long";
475  return "Attribute name cannot be represented";
477  return "ACL text contains multiple entries of user::, group::, other::";
478  case ISO_SECT_SCATTERED:
479  return "File sections do not form consecutive array of blocks";
481  return "Too many Apple Partition Map entries requested";
483  return "Overlapping Apple Partition Map entries requested";
485  return "Too many GPT entries requested";
487  return "Overlapping GPT entries requested";
489  return "Too many MBR partition entries requested";
491  return "Overlapping MBR partition entries requested";
493  return "Attempt to use an MBR partition entry twice";
495  return "No suitable El Torito EFI boot image for exposure as GPT partition";
497  return "Not a supported HFS+ or APM block size";
499  return "APM block size prevents coexistence with GPT";
500  case ISO_HFSP_NO_MANGLE:
501  return "Name collision in HFS+, mangling not possible";
502  case ISO_DEAD_SYMLINK:
503  return "Symbolic link cannot be resolved";
504  case ISO_DEEP_SYMLINK:
505  return "Too many chained symbolic links";
507  return "Unrecognized file type in ISO image";
508  case ISO_NAME_NOT_UCS2:
509  return "Filename not suitable for character set UCS-2";
511  return "File name collision during ISO image import";
513  return "Incomplete HP-PA PALO boot parameters";
514  case ISO_HPPA_PALO_OFLOW:
515  return "HP-PA PALO boot address exceeds 2 GB";
517  return "HP-PA PALO file is not a data file";
519  return "HP-PA PALO command line too long";
521  return "Problems encountered during inspection of System Area";
523  return "Unrecognized inquiry for system area property";
525  return "DEC Alpha Boot Loader file is not a data file";
527  return "No data source of imported ISO image available";
529  return "Malformed description string for interval reader";
531  return "Unreadable file, premature EOF, or failure to seek for interval reader";
533  return "Cannot arrange content of data files in surely reproducible way";
535  return "May not write boot info into filtered stream of boot image";
537  return "Boot image to large to buffer for writing boot info";
539  return "File name had to be truncated and MD5 marked";
541  return "File name truncation length changed by loaded image info";
542  case ISO_GENERAL_NOTE:
543  return "A general note message was issued";
545  return "Unrecognized file type of IsoFileSrc object";
546  case ISO_GPT_NO_VOL_UUID:
547  return "Cannot derive GPT GUID from undefined pseudo-UUID volume timestamp";
549  return "Unrecognized GPT disk GUID setup mode";
550  case ISO_NO_ROOT_DIR:
551  return "Unable to obtain root directory";
553  return "Zero sized, oversized, or mislocated SUSP CE area found";
555  return "Multi-session would overwrite imported_iso interval";
556  case ISO_ELTO_EFI_HIDDEN:
557  return "El-Torito EFI image is hidden";
559  return "Too many files in HFS+ directory tree";
561  return "Too many zisofs block pointers needed overall";
563  return "Prevented zisofs block pointer counter underrun";
565  return "Cannot obtain size of zisofs compressed stream";
566  default:
567  return "Unknown error";
568  }
569 }
570 
571 int iso_msg_is_abort(int errcode)
572 {
573  if (ISO_ERR_SEV(errcode) >= abort_threshold)
574  return 1;
575  return 0;
576 }
577 
578 
579 int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...)
580 {
581  char msg[MAX_MSG_LEN];
582  va_list ap;
583 
584  /* when called with ISO_CANCELED, we don't need to submit any message */
585  if (errcode == (int) ISO_CANCELED && fmt == NULL) {
586  return ISO_CANCELED;
587  }
588 
589  if (fmt) {
590  va_start(ap, fmt);
591  vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
592  va_end(ap);
593  } else {
594  strncpy(msg, iso_error_to_msg(errcode), MAX_MSG_LEN - 1);
595  msg[MAX_MSG_LEN - 1] = 0;
596  }
597 
599  ISO_ERR_SEV(errcode), ISO_ERR_PRIO(errcode), msg, 0, 0);
600  if (causedby != 0) {
601  snprintf(msg, MAX_MSG_LEN, " > Caused by: %s",
602  iso_error_to_msg(causedby));
603  libiso_msgs_submit(libiso_msgr, imgid, ISO_ERR_CODE(causedby),
605  if (ISO_ERR_SEV(causedby) == LIBISO_MSGS_SEV_FATAL) {
606  return ISO_CANCELED;
607  }
608  }
609 
610  if (iso_msg_is_abort(errcode)) {
611  return ISO_CANCELED;
612  } else {
613  return 0;
614  }
615 }
616 
617 /**
618  * Control queueing and stderr printing of messages from libisofs.
619  * Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
620  * "NOTE", "UPDATE", "DEBUG", "ALL".
621  *
622  * @param queue_severity Gives the minimum limit for messages to be queued.
623  * Default: "NEVER". If you queue messages then you
624  * must consume them by iso_msgs_obtain().
625  * @param print_severity Does the same for messages to be printed directly
626  * to stderr.
627  * @param print_id A text prefix to be printed before the message.
628  * @return >0 for success, <=0 for error
629  */
630 int iso_set_msgs_severities(char *queue_severity, char *print_severity,
631  char *print_id)
632 {
633  int ret, queue_sevno, print_sevno;
634 
635  ret = libiso_msgs__text_to_sev(queue_severity, &queue_sevno, 0);
636  if (ret <= 0)
637  return 0;
638  ret = libiso_msgs__text_to_sev(print_severity, &print_sevno, 0);
639  if (ret <= 0)
640  return 0;
641  ret = libiso_msgs_set_severities(libiso_msgr, queue_sevno, print_sevno,
642  print_id, 0);
643  if (ret <= 0)
644  return 0;
645  return 1;
646 }
647 
648 /**
649  * Obtain the oldest pending libisofs message from the queue which has at
650  * least the given minimum_severity. This message and any older message of
651  * lower severity will get discarded from the queue and is then lost forever.
652  *
653  * Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
654  * "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER"
655  * will discard the whole queue.
656  *
657  * @param error_code Will become a unique error code as listed in messages.h
658  * @param imgid Id of the image that was issued the message.
659  * @param msg_text Must provide at least ISO_MSGS_MESSAGE_LEN bytes.
660  * @param severity Will become the severity related to the message and
661  * should provide at least 80 bytes.
662  * @return 1 if a matching item was found, 0 if not, <0 for severe errors
663  */
664 int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid,
665  char msg_text[], char severity[])
666 {
667  int ret, minimum_sevno, sevno, priority, os_errno;
668  double timestamp;
669  pid_t pid;
670  char *textpt, *sev_name;
671  struct libiso_msgs_item *item= NULL;
672 
673  ret = libiso_msgs__text_to_sev(minimum_severity, &minimum_sevno, 0);
674  if (ret <= 0)
675  return 0;
676  ret = libiso_msgs_obtain(libiso_msgr, &item, minimum_sevno,
678  if (ret <= 0)
679  goto ex;
680  ret = libiso_msgs_item_get_msg(item, error_code, &textpt, &os_errno, 0);
681  if (ret <= 0)
682  goto ex;
683  strncpy(msg_text, textpt, ISO_MSGS_MESSAGE_LEN-1);
684  if (strlen(textpt) >= ISO_MSGS_MESSAGE_LEN)
685  msg_text[ISO_MSGS_MESSAGE_LEN-1] = 0;
686 
687  ret = libiso_msgs_item_get_origin(item, &timestamp, &pid, imgid, 0);
688  if (ret <= 0)
689  goto ex;
690 
691  severity[0]= 0;
692  ret = libiso_msgs_item_get_rank(item, &sevno, &priority, 0);
693  if (ret <= 0)
694  goto ex;
695  ret = libiso_msgs__sev_to_text(sevno, &sev_name, 0);
696  if (ret <= 0)
697  goto ex;
698  strcpy(severity, sev_name);
699 
700  ret = 1;
701  ex: ;
703  return ret;
704 }
705 
706 
707 int iso_msgs_submit(int error_code, char msg_text[], int os_errno,
708  char severity[], int origin)
709 {
710  int ret, sevno;
711 
712  ret = libiso_msgs__text_to_sev(severity, &sevno, 0);
713  if (ret <= 0)
714  sevno = LIBISO_MSGS_SEV_ALL;
715  if (error_code <= 0) {
716  switch(sevno) {
717  case LIBISO_MSGS_SEV_ABORT: error_code = 0x00040000;
718  break; case LIBISO_MSGS_SEV_FATAL: error_code = 0x00040001;
719  break; case LIBISO_MSGS_SEV_SORRY: error_code = 0x00040002;
720  break; case LIBISO_MSGS_SEV_WARNING: error_code = 0x00040003;
721  break; case LIBISO_MSGS_SEV_HINT: error_code = 0x00040004;
722  break; case LIBISO_MSGS_SEV_NOTE: error_code = 0x00040005;
723  break; case LIBISO_MSGS_SEV_UPDATE: error_code = 0x00040006;
724  break; case LIBISO_MSGS_SEV_DEBUG: error_code = 0x00040007;
725  break; default: error_code = 0x00040008;
726  }
727  }
728  ret = libiso_msgs_submit(libiso_msgr, origin, error_code,
729  sevno, LIBISO_MSGS_PRIO_HIGH, msg_text, os_errno, 0);
730  return ret;
731 }
732 
733 
734 int iso_text_to_sev(char *severity_name, int *sevno)
735 {
736  int ret;
737 
738  ret = libiso_msgs__text_to_sev(severity_name, sevno, 0);
739  if (ret <= 0)
740  *sevno = LIBISO_MSGS_SEV_FATAL;
741  return ret;
742 }
743 
744 
745 int iso_sev_to_text(int severity_number, char **severity_name)
746 {
747  int ret;
748 
749  ret = libiso_msgs__sev_to_text(severity_number, severity_name, 0);
750  return ret;
751 }
752 
753 
754 /**
755  * Return the messenger object handle used by libisofs. This handle
756  * may be used by related libraries to their own compatible
757  * messenger objects and thus to direct their messages to the libisofs
758  * message queue. See also: libburn, API function burn_set_messenger().
759  *
760  * @return the handle. Do only use with compatible
761  */
763 {
764  return libiso_msgr;
765 }
766 
768 {
769  return ISO_ERR_SEV(e);
770 }
771 
773 {
774  return ISO_ERR_PRIO(e);
775 }
776 
778 {
779  return ISO_ERR_CODE(e);
780 }
781 
782 
783 int iso_report_errfile(char *path, int error_code, int os_errno, int flag)
784 {
785  libiso_msgs_submit(libiso_msgr, 0, error_code,
787  path, os_errno, 0);
788  return(1);
789 }
790 
791 
792 int iso_libjte_forward_msgs(void *libjte_handle,
793  int imgid, int errcode, int flag)
794 {
795 
796 #ifdef Libisofs_with_libjtE
797 
798  char *msg = NULL;
799  int res;
800  struct libjte_env *handle = (struct libjte_env *) libjte_handle;
801 
802  res = ISO_SUCCESS;
803  while(1) {
804  msg= libjte_get_next_message(handle);
805  if(msg == NULL)
806  break;
807  res = iso_msg_submit(imgid, errcode, 0, msg);
808  free(msg);
809  }
810  return res;
811 
812 #else /* Libisofs_with_libjtE */
813 
814  return ISO_SUCCESS;
815 
816 #endif /* ! Libisofs_with_libjtE */
817 
818 }
819 
int iso_hfsplus_xinfo_func(void *data, int flag)
Definition: hfsplus.c:1841
int iso_hfsplus_xinfo_cloner(void *old_data, void **new_data, int flag)
Definition: hfsplus.c:1864
int libiso_msgs_submit(struct libiso_msgs *m, int origin, int error_code, int severity, int priority, char *msg_text, int os_errno, int flag)
Definition: libiso_msgs.c:328
int libiso_msgs_destroy(struct libiso_msgs **m, int flag)
Definition: libiso_msgs.c:190
int libiso_msgs_destroy_item(struct libiso_msgs *m, struct libiso_msgs_item **item, int flag)
Definition: libiso_msgs.c:430
int libiso_msgs_item_get_origin(struct libiso_msgs_item *item, double *timestamp, pid_t *process_id, int *origin, int flag)
Definition: libiso_msgs.c:114
int libiso_msgs_new(struct libiso_msgs **m, int flag)
Definition: libiso_msgs.c:137
int libiso_msgs__sev_to_text(int severity, char **severity_name, int flag)
Definition: libiso_msgs.c:286
int libiso_msgs_item_get_rank(struct libiso_msgs_item *item, int *severity, int *priority, int flag)
Definition: libiso_msgs.c:125
int libiso_msgs_set_severities(struct libiso_msgs *m, int queue_severity, int print_severity, char *print_id, int flag)
Definition: libiso_msgs.c:235
int libiso_msgs_item_get_msg(struct libiso_msgs_item *item, int *error_code, char **msg_text, int *os_errno, int flag)
Definition: libiso_msgs.c:103
int libiso_msgs_obtain(struct libiso_msgs *m, struct libiso_msgs_item **item, int severity, int priority, int flag)
Definition: libiso_msgs.c:396
int libiso_msgs__text_to_sev(char *severity_name, int *severity, int flag)
Definition: libiso_msgs.c:249
#define LIBISO_MSGS_SEV_FATAL
Definition: libiso_msgs.h:222
#define LIBISO_MSGS_PRIO_LOW
Definition: libiso_msgs.h:240
#define LIBISO_MSGS_PRIO_HIGH
Definition: libiso_msgs.h:242
#define LIBISO_MSGS_SEV_ABORT
Definition: libiso_msgs.h:227
#define LIBISO_MSGS_SEV_FAILURE
Definition: libiso_msgs.h:210
#define LIBISO_MSGS_SEV_ALL
Definition: libiso_msgs.h:126
#define LIBISO_MSGS_PRIO_ZERO
Definition: libiso_msgs.h:239
#define LIBISO_MSGS_SEV_ERRFILE
Definition: libiso_msgs.h:138
#define LIBISO_MSGS_SEV_UPDATE
Definition: libiso_msgs.h:147
#define LIBISO_MSGS_SEV_SORRY
Definition: libiso_msgs.h:181
#define LIBISO_MSGS_SEV_WARNING
Definition: libiso_msgs.h:159
#define LIBISO_MSGS_SEV_NOTE
Definition: libiso_msgs.h:151
#define LIBISO_MSGS_SEV_HINT
Definition: libiso_msgs.h:155
#define LIBISO_MSGS_SEV_DEBUG
Definition: libiso_msgs.h:143
#define LIBISO_MSGS_SEV_NEVER
Definition: libiso_msgs.h:232
#define LIBISO_MSGS_ORIGIN_IMAGE_BASE
Definition: libiso_msgs.h:254
int checksum_md5_xinfo_cloner(void *old_data, void **new_data, int flag)
Definition: md5.c:459
int checksum_cx_xinfo_func(void *data, int flag)
Definition: md5.c:421
int checksum_cx_xinfo_cloner(void *old_data, void **new_data, int flag)
Definition: md5.c:431
int checksum_md5_xinfo_func(void *data, int flag)
Definition: md5.c:447
int iso_init_locale(int flag)
Definition: util.c:2038
#define LIBISO_FREE_MEM(pt)
Definition: util.h:627
#define LIBISO_ALLOC_MEM_VOID(pt, typ, count)
Definition: util.h:621
#define ISO_FILE_ACCESS_DENIED
Definition: libisofs.h:8802
#define ISO_DEEP_SYMLINK
Definition: libisofs.h:9156
#define ISO_THREAD_ERROR
Definition: libisofs.h:8754
#define ISO_BUF_READ_ERROR
Definition: libisofs.h:8760
#define ISO_FILENAME_WRONG_CHARSET_OLD
Definition: libisofs.h:8843
#define ISO_MD5_TAG_UNEXPECTED
Definition: libisofs.h:9001
#define ISO_ZLIB_NOT_ENABLED
Definition: libisofs.h:8956
#define ISO_BOOT_TOO_MANY_MBR
Definition: libisofs.h:9131
#define ISO_ZISOFS_BPT_UNDERRUN
Definition: libisofs.h:9252
#define ISO_FILE_CANT_WRITE
Definition: libisofs.h:8838
#define ISO_MD5_TAG_MISMATCH
Definition: libisofs.h:8988
#define ISO_AAIP_BAD_ACL
Definition: libisofs.h:8929
#define ISO_IMAGE_ALREADY_BOOTABLE
Definition: libisofs.h:8777
#define ISO_BOOT_HFSP_BAD_BSIZE
Definition: libisofs.h:9144
#define ISO_UNSUPPORTED_ECMA119
Definition: libisofs.h:8888
#define ISO_ZLIB_EARLY_EOF
Definition: libisofs.h:8975
#define ISO_ZISOFS_TOO_MANY_PTR
Definition: libisofs.h:9249
#define ISO_BOOT_IMAGE_OVERFLOW
Definition: libisofs.h:8783
#define ISO_OVWRT_FIFO_TOO_SMALL
Definition: libisofs.h:9049
#define ISO_BAD_PARTITION_NO
Definition: libisofs.h:9071
#define ISO_BOOT_MBR_OVERLAP
Definition: libisofs.h:9134
#define ISO_PATCH_FILTERED_BOOT
Definition: libisofs.h:9204
#define ISO_CANCELED
Definition: libisofs.h:8728
#define ISO_BOOT_IMAGE_NOT_VALID
Definition: libisofs.h:8780
#define ISO_EL_TORITO_WARN
Definition: libisofs.h:8915
#define ISO_ZISOFS_PARAM_LOCK
Definition: libisofs.h:8972
#define ISO_OVWRT_MS_TOO_SMALL
Definition: libisofs.h:9036
int aaip_xinfo_cloner(void *old_data, void **new_data, int flag)
Definition: rockridge.c:1127
#define ISO_SUCCESS
Definition: libisofs.h:8719
#define ISO_MD5_STREAM_CHANGE
Definition: libisofs.h:9021
#define ISO_MD5_AREA_CORRUPTED
Definition: libisofs.h:8981
#define ISO_DEAD_SYMLINK
Definition: libisofs.h:9153
#define ISO_STREAM_NO_CLONE
Definition: libisofs.h:9089
#define ISO_WRITE_ERROR
Definition: libisofs.h:8757
#define ISO_BOOT_FILE_MISSING
Definition: libisofs.h:9068
#define ISO_SYSAREA_PROBLEMS
Definition: libisofs.h:9180
#define ISO_INTVL_READ_PROBLEM
Definition: libisofs.h:9196
#define ISO_DISPLACE_ROLLOVER
Definition: libisofs.h:9081
#define ISO_FATAL_ERROR
Definition: libisofs.h:8731
#define ISO_HFSP_NO_MANGLE
Definition: libisofs.h:9150
#define ISO_DATA_SOURCE_FATAL
Definition: libisofs.h:9277
#define ISO_FILE_SEEK_ERROR
Definition: libisofs.h:8829
#define ISO_BOOT_GPT_OVERLAP
Definition: libisofs.h:9128
#define ISO_MALFORMED_READ_INTVL
Definition: libisofs.h:9192
#define ISO_BOOT_APM_OVERLAP
Definition: libisofs.h:9122
#define ISO_NAME_NOT_UCS2
Definition: libisofs.h:9162
#define ISO_DATA_SOURCE_MISHAP
Definition: libisofs.h:9271
#define ISO_AAIP_NON_USER_NAME
Definition: libisofs.h:8949
#define ISO_HPPA_PALO_OFLOW
Definition: libisofs.h:9171
#define ISO_BOOT_TOO_MANY_GPT
Definition: libisofs.h:9125
#define ISO_DATA_SOURCE_SORRY
Definition: libisofs.h:9268
#define ISO_FILE_NOT_OPENED
Definition: libisofs.h:8811
#define ISO_WRONG_ECMA119
Definition: libisofs.h:8885
#define ISO_MD5_TAG_COPIED
Definition: libisofs.h:9096
#define ISO_PATCH_OVERSIZED_BOOT
Definition: libisofs.h:9208
#define ISO_UNSUPPORTED_RR
Definition: libisofs.h:8882
#define ISO_BAD_FSRC_FILETYPE
Definition: libisofs.h:9221
#define ISO_WRONG_RR
Definition: libisofs.h:8879
#define ISO_FILE_DOESNT_EXIST
Definition: libisofs.h:8808
#define ISO_OUT_OF_MEM
Definition: libisofs.h:8745
int(* iso_node_xinfo_func)(void *data, int flag)
Definition: libisofs.h:4838
#define ISO_UNSUPPORTED_EL_TORITO
Definition: libisofs.h:8894
#define ISO_NO_KEPT_DATA_SRC
Definition: libisofs.h:9189
#define ISO_SCDBACKUP_TAG_NOT_0
Definition: libisofs.h:9028
#define ISO_WRONG_EL_TORITO
Definition: libisofs.h:8891
#define ISO_BAD_GPT_GUID_MODE
Definition: libisofs.h:9229
#define ISO_HPPA_PALO_INCOMPL
Definition: libisofs.h:9168
#define ISO_NODE_DOESNT_EXIST
Definition: libisofs.h:8772
#define ISO_GPT_NO_VOL_UUID
Definition: libisofs.h:9225
#define ISO_NOT_REPRODUCIBLE
Definition: libisofs.h:9200
#define ISO_XINFO_NO_CLONE
Definition: libisofs.h:9093
#define ISO_HPPA_PALO_NOTREG
Definition: libisofs.h:9174
#define ISO_FILE_IS_NOT_DIR
Definition: libisofs.h:8823
#define ISO_UNSUPPORTED_SUSP
Definition: libisofs.h:8900
#define ISO_NO_ROOT_DIR
Definition: libisofs.h:9232
#define ISO_RR_PATH_TOO_LONG
Definition: libisofs.h:9105
#define ISO_BAD_PARTITION_FILE
Definition: libisofs.h:9074
#define ISO_HPPA_PALO_CMDLEN
Definition: libisofs.h:9177
#define ISO_AAIP_NO_GET_LOCAL
Definition: libisofs.h:8942
#define ISO_AAIP_IGNORED
Definition: libisofs.h:8926
#define ISO_EXTF_TOO_OFTEN
Definition: libisofs.h:8953
#define ISO_SUSP_WRONG_CE_SIZE
Definition: libisofs.h:9236
#define ISO_BOOT_MBR_COLLISION
Definition: libisofs.h:9137
#define ISO_WRONG_PVD
Definition: libisofs.h:8876
#define ISO_FILE_IMGPATH_WRONG
Definition: libisofs.h:8852
#define ISO_ZISOFS_TOO_LARGE
Definition: libisofs.h:8959
#define ISO_GENERAL_NOTE
Definition: libisofs.h:9218
#define ISO_TRUNCATE_ISOFSNT
Definition: libisofs.h:9215
#define ISO_FILE_READ_ERROR
Definition: libisofs.h:8820
#define ISO_AAIP_NOT_ENABLED
Definition: libisofs.h:8936
#define ISO_FILE_TOO_BIG
Definition: libisofs.h:8835
#define ISO_UNSUPPORTED_VD
Definition: libisofs.h:8912
#define ISO_IMPORT_COLLISION
Definition: libisofs.h:9165
#define ISO_SECT_SCATTERED
Definition: libisofs.h:9116
#define ISO_MD5_TAG_MISPLACED
Definition: libisofs.h:9007
#define ISO_ELTO_EFI_HIDDEN
Definition: libisofs.h:9243
#define ISO_FILE_IS_DIR
Definition: libisofs.h:8817
#define ISO_LIBJTE_END_FAILED
Definition: libisofs.h:9058
#define ISO_FILE_CANT_ADD
Definition: libisofs.h:8846
#define ISO_MSGS_MESSAGE_LEN
Definition: libisofs.h:6645
#define ISO_WRONG_ARG_VALUE
Definition: libisofs.h:8751
#define ISO_PART_OFFST_TOO_SMALL
Definition: libisofs.h:9043
#define ISO_FILE_IGNORED
Definition: libisofs.h:8832
#define ISO_AAIP_BAD_AASTRING
Definition: libisofs.h:8939
int aaip_xinfo_func(void *data, int flag)
Definition: rockridge.c:1118
#define ISO_INTERRUPTED
Definition: libisofs.h:8748
#define ISO_RR_NAME_TRUNCATED
Definition: libisofs.h:9211
#define ISO_AAIP_BAD_ACL_TEXT
Definition: libisofs.h:8932
int(* iso_node_xinfo_cloner)(void *old_data, void **new_data, int flag)
Definition: libisofs.h:4968
#define ISO_BOOT_TOO_MANY_MIPS
Definition: libisofs.h:9065
#define ISO_ZISOFS_UNKNOWN_SIZE
Definition: libisofs.h:9255
#define ISO_INQ_SYSAREA_PROP
Definition: libisofs.h:9183
#define ISO_NULL_POINTER
Definition: libisofs.h:8742
#define ISO_AAIP_ACL_MULT_OBJ
Definition: libisofs.h:9112
#define ISO_MULTI_OVER_IMPORTED
Definition: libisofs.h:9240
#define ISO_AAIP_NO_SET_LOCAL
Definition: libisofs.h:8945
#define ISO_SB_TREE_CORRUPTED
Definition: libisofs.h:8995
#define ISO_BOOT_TOO_MANY_APM
Definition: libisofs.h:9119
#define ISO_LIBJTE_NOT_ENABLED
Definition: libisofs.h:9052
#define ISO_RR_NAME_RESERVED
Definition: libisofs.h:9102
#define ISO_BOOT_APM_GPT_BSIZE
Definition: libisofs.h:9147
#define ISO_SUSP_UNHANDLED
Definition: libisofs.h:8906
#define ISO_ERROR
Definition: libisofs.h:8734
#define ISO_NODE_NOT_ADDED_TO_DIR
Definition: libisofs.h:8769
#define ISO_LIBJTE_START_FAILED
Definition: libisofs.h:9055
#define ISO_NAME_NEEDS_TRANSL
Definition: libisofs.h:9085
#define ISO_ISOLINUX_CANT_PATCH
Definition: libisofs.h:8897
#define ISO_MD5_TAG_OTHER_RANGE
Definition: libisofs.h:9014
#define ISO_HFSPLUS_TOO_MANY_FILES
Definition: libisofs.h:9246
#define ISO_LIBJTE_FILE_FAILED
Definition: libisofs.h:9062
#define ISO_SUSP_MULTIPLE_ER
Definition: libisofs.h:8909
#define ISO_EL_TORITO_HIDDEN
Definition: libisofs.h:8921
#define ISO_NON_MBR_SYS_AREA
Definition: libisofs.h:9078
#define ISO_CHARSET_CONV_ERROR
Definition: libisofs.h:8862
#define ISO_AAIP_BAD_ATTR_NAME
Definition: libisofs.h:9108
#define ISO_FILE_BAD_PATH
Definition: libisofs.h:8805
#define ISO_FILENAME_WRONG_CHARSET
Definition: libisofs.h:8841
#define ISO_ZISOFS_WRONG_INPUT
Definition: libisofs.h:8968
#define ISO_RR_NAME_TOO_LONG
Definition: libisofs.h:9099
#define ISO_WRONG_RR_WARN
Definition: libisofs.h:8903
#define ISO_BOOT_NO_CATALOG
Definition: libisofs.h:8786
#define ISO_BOOT_NO_EFI_ELTO
Definition: libisofs.h:9141
#define ISO_FILTER_WRONG_INPUT
Definition: libisofs.h:8962
#define ISO_MANGLE_TOO_MUCH_FILES
Definition: libisofs.h:8868
#define ISO_FILE_ALREADY_OPENED
Definition: libisofs.h:8796
#define ISO_NODE_ALREADY_ADDED
Definition: libisofs.h:8763
#define ISO_DATA_SOURCE_FAILURE
Definition: libisofs.h:9274
#define ISO_ZLIB_COMPR_ERR
Definition: libisofs.h:8965
#define ISO_ALPHA_BOOT_NOTREG
Definition: libisofs.h:9186
#define ISO_NODE_NAME_NOT_UNIQUE
Definition: libisofs.h:8766
#define ISO_FILE_ERROR
Definition: libisofs.h:8793
#define ISO_FILE_IS_NOT_SYMLINK
Definition: libisofs.h:8826
#define ISO_IMAGE_WRITE_CANCELED
Definition: libisofs.h:8918
#define ISO_ASSERT_FAILURE
Definition: libisofs.h:8737
#define ISO_BAD_ISO_FILETYPE
Definition: libisofs.h:9159
int libjte__is_compatible(int major, int minor, int micro, int flag)
Definition: libjte.c:68
char * libjte_get_next_message(struct libjte_env *o)
Definition: libjte.c:579
#define LIBJTE_VERSION_MICRO
Definition: libjte.h:31
#define LIBJTE_VERSION_MAJOR
Definition: libjte.h:29
#define LIBJTE_VERSION_MINOR
Definition: libjte.h:30
int iso_report_errfile(char *path, int error_code, int os_errno, int flag)
Definition: messages.c:783
int abort_threshold
Definition: messages.c:78
int iso_sev_to_text(int severity_number, char **severity_name)
Definition: messages.c:745
struct iso_xinfo_cloner_assoc * iso_xinfo_cloner_list
Definition: messages.c:93
const char * iso_error_to_msg(int errcode)
Definition: messages.c:269
int iso_libjte_forward_msgs(void *libjte_handle, int imgid, int errcode, int flag)
Definition: messages.c:792
int iso_set_msgs_severities(char *queue_severity, char *print_severity, char *print_id)
Definition: messages.c:630
int iso_error_get_severity(int e)
Definition: messages.c:767
int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt,...)
Definition: messages.c:579
int iso_init_with_flag(int flag)
Definition: messages.c:153
#define MAX_MSG_LEN
Definition: messages.c:80
int iso_node_xinfo_make_clonable(iso_node_xinfo_func proc, iso_node_xinfo_cloner cloner, int flag)
Definition: messages.c:96
int iso_message_id
Definition: messages.c:73
void iso_finish()
Definition: messages.c:232
int iso_set_abort_severity(char *severity)
Definition: messages.c:239
int iso_error_get_code(int e)
Definition: messages.c:777
int iso_msg_is_abort(int errcode)
Definition: messages.c:571
int iso_error_get_priority(int e)
Definition: messages.c:772
int iso_init()
Definition: messages.c:227
void * iso_get_messenger()
Definition: messages.c:762
int iso_msgs_submit(int error_code, char msg_text[], int os_errno, char severity[], int origin)
Definition: messages.c:707
int iso_text_to_sev(char *severity_name, int *sevno)
Definition: messages.c:734
#define ISO_ERR_SEV(e)
Definition: messages.c:69
#define ISO_ERR_PRIO(e)
Definition: messages.c:70
void iso_msg_debug(int imgid, const char *fmt,...)
Definition: messages.c:253
int iso_node_xinfo_get_cloner(iso_node_xinfo_func proc, iso_node_xinfo_cloner *cloner, int flag)
Definition: messages.c:119
struct libiso_msgs * libiso_msgr
Definition: messages.c:82
static int iso_node_xinfo_dispose_cloners(int flag)
Definition: messages.c:135
int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid, char msg_text[], char severity[])
Definition: messages.c:664
#define ISO_ERR_CODE(e)
Definition: messages.c:71
int iso_px_ino_xinfo_cloner(void *old_data, void **new_data, int flag)
Definition: node.c:2571
int iso_px_ino_xinfo_func(void *data, int flag)
Definition: node.c:2559
int zisofs_zf_xinfo_cloner(void *old_data, void **new_data, int flag)
Definition: node.c:2423
int zisofs_zf_xinfo_func(void *data, int flag)
Definition: node.c:2411
int iso_stream_destroy_cmpranks(int flag)
Definition: stream.c:1028
iso_node_xinfo_cloner cloner
Definition: messages.c:89
struct iso_xinfo_cloner_assoc * next
Definition: messages.c:90
iso_node_xinfo_func proc
Definition: messages.c:88