2007-12-02 19:11:44 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Vreixo Formoso
|
2023-01-22 15:03:44 +00:00
|
|
|
* Copyright (c) 2009 - 2023 Thomas Schmitt
|
2008-08-19 22:05:27 +00:00
|
|
|
*
|
|
|
|
* This file is part of the libisofs project; you can redistribute it and/or
|
2010-01-27 05:48:59 +00:00
|
|
|
* modify it under the terms of the GNU General Public License version 2
|
|
|
|
* or later as published by the Free Software Foundation.
|
|
|
|
* See COPYING file for details.
|
2007-12-02 19:11:44 +00:00
|
|
|
*/
|
2010-05-16 08:20:12 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
2008-08-19 22:05:27 +00:00
|
|
|
#include <stdlib.h>
|
2008-11-25 11:49:44 +00:00
|
|
|
#include <sys/types.h>
|
2007-12-02 19:11:44 +00:00
|
|
|
#include <string.h>
|
2007-12-17 20:12:51 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
2007-12-02 19:11:44 +00:00
|
|
|
|
2010-10-15 12:24:31 +00:00
|
|
|
#ifdef Xorriso_standalonE
|
2010-10-07 11:43:57 +00:00
|
|
|
|
|
|
|
#ifdef Xorriso_with_libjtE
|
|
|
|
#include "../libjte/libjte.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2010-10-04 11:18:06 +00:00
|
|
|
#ifdef Libisofs_with_libjtE
|
|
|
|
#include <libjte/libjte.h>
|
|
|
|
#endif
|
|
|
|
|
2010-10-15 12:24:31 +00:00
|
|
|
#endif /* ! Xorriso_standalonE */
|
2010-10-07 11:43:57 +00:00
|
|
|
|
2008-02-04 01:16:12 +00:00
|
|
|
#include "libiso_msgs.h"
|
2007-12-02 19:11:44 +00:00
|
|
|
#include "libisofs.h"
|
|
|
|
#include "messages.h"
|
2008-01-19 01:48:12 +00:00
|
|
|
|
2009-03-19 11:56:25 +00:00
|
|
|
#include "util.h"
|
2011-02-01 18:16:45 +00:00
|
|
|
#include "node.h"
|
2015-07-27 11:50:57 +00:00
|
|
|
#include "stream.h"
|
2009-03-19 11:56:25 +00:00
|
|
|
|
|
|
|
|
2008-08-19 22:05:27 +00:00
|
|
|
/*
|
2008-02-04 01:16:12 +00:00
|
|
|
* error codes are 32 bit numbers, that follow the following conventions:
|
2008-08-19 22:05:27 +00:00
|
|
|
*
|
2008-02-04 01:16:12 +00:00
|
|
|
* bit 31 (MSB) -> 1 (to make the value always negative)
|
|
|
|
* bits 30-24 -> Encoded severity (Use ISO_ERR_SEV to translate an error code
|
|
|
|
* to a LIBISO_MSGS_SEV_* constant)
|
|
|
|
* = 0x10 -> DEBUG
|
|
|
|
* = 0x20 -> UPDATE
|
|
|
|
* = 0x30 -> NOTE
|
|
|
|
* = 0x40 -> HINT
|
|
|
|
* = 0x50 -> WARNING
|
|
|
|
* = 0x60 -> SORRY
|
2008-02-13 14:13:24 +00:00
|
|
|
* = 0x64 -> MISHAP
|
2008-02-04 01:16:12 +00:00
|
|
|
* = 0x68 -> FAILURE
|
|
|
|
* = 0x70 -> FATAL
|
|
|
|
* = 0x71 -> ABORT
|
|
|
|
* bits 23-20 -> Encoded priority (Use ISO_ERR_PRIO to translate an error code
|
|
|
|
* to a LIBISO_MSGS_PRIO_* constant)
|
|
|
|
* = 0x0 -> ZERO
|
|
|
|
* = 0x1 -> LOW
|
|
|
|
* = 0x2 -> MEDIUM
|
|
|
|
* = 0x3 -> HIGH
|
|
|
|
* bits 19-16 -> Reserved for future usage (maybe message ranges)
|
|
|
|
* bits 15-0 -> Error code
|
|
|
|
*/
|
|
|
|
#define ISO_ERR_SEV(e) (e & 0x7F000000)
|
2008-08-19 22:05:27 +00:00
|
|
|
#define ISO_ERR_PRIO(e) ((e & 0x00700000) << 8)
|
2008-02-05 11:55:29 +00:00
|
|
|
#define ISO_ERR_CODE(e) ((e & 0x0000FFFF) | 0x00030000)
|
2008-02-04 01:16:12 +00:00
|
|
|
|
2008-01-19 01:48:12 +00:00
|
|
|
int iso_message_id = LIBISO_MSGS_ORIGIN_IMAGE_BASE;
|
2007-12-02 19:11:44 +00:00
|
|
|
|
2008-01-22 20:12:27 +00:00
|
|
|
/**
|
|
|
|
* Threshold for aborting.
|
|
|
|
*/
|
2008-01-24 10:39:43 +00:00
|
|
|
int abort_threshold = LIBISO_MSGS_SEV_FAILURE;
|
2008-01-22 20:12:27 +00:00
|
|
|
|
2007-12-17 20:12:51 +00:00
|
|
|
#define MAX_MSG_LEN 4096
|
|
|
|
|
2008-01-19 01:48:12 +00:00
|
|
|
struct libiso_msgs *libiso_msgr = NULL;
|
|
|
|
|
2009-03-19 11:56:25 +00:00
|
|
|
|
2011-02-01 18:16:45 +00:00
|
|
|
/* ------------- List of xinfo clone functions ----------- */
|
|
|
|
|
|
|
|
struct iso_xinfo_cloner_assoc {
|
|
|
|
iso_node_xinfo_func proc;
|
|
|
|
iso_node_xinfo_cloner cloner;
|
|
|
|
struct iso_xinfo_cloner_assoc *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct iso_xinfo_cloner_assoc *iso_xinfo_cloner_list = NULL;
|
|
|
|
|
|
|
|
/* API */
|
|
|
|
int iso_node_xinfo_make_clonable(iso_node_xinfo_func proc,
|
|
|
|
iso_node_xinfo_cloner cloner, int flag)
|
|
|
|
{
|
|
|
|
struct iso_xinfo_cloner_assoc *assoc;
|
|
|
|
|
2011-02-12 13:48:31 +00:00
|
|
|
/* Look for existing assoc of proc */
|
|
|
|
for (assoc = iso_xinfo_cloner_list; assoc != NULL; assoc = assoc->next)
|
|
|
|
if (assoc->proc == proc)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (assoc == NULL) {
|
|
|
|
assoc = calloc(1, sizeof(struct iso_xinfo_cloner_assoc));
|
|
|
|
if (assoc == NULL)
|
|
|
|
return ISO_OUT_OF_MEM;
|
|
|
|
assoc->proc = proc;
|
|
|
|
assoc->next = iso_xinfo_cloner_list;
|
|
|
|
iso_xinfo_cloner_list = assoc;
|
|
|
|
}
|
2011-02-01 18:16:45 +00:00
|
|
|
assoc->cloner = cloner;
|
|
|
|
return ISO_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* API */
|
|
|
|
int iso_node_xinfo_get_cloner(iso_node_xinfo_func proc,
|
|
|
|
iso_node_xinfo_cloner *cloner, int flag)
|
|
|
|
{
|
|
|
|
struct iso_xinfo_cloner_assoc *assoc;
|
|
|
|
|
|
|
|
*cloner = NULL;
|
|
|
|
for (assoc = iso_xinfo_cloner_list; assoc != NULL; assoc = assoc->next) {
|
|
|
|
if (assoc->proc != proc)
|
|
|
|
continue;
|
|
|
|
*cloner = assoc->cloner;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
int iso_node_xinfo_dispose_cloners(int flag)
|
|
|
|
{
|
|
|
|
struct iso_xinfo_cloner_assoc *assoc, *next;
|
|
|
|
|
|
|
|
for (assoc = iso_xinfo_cloner_list; assoc != NULL; assoc = next) {
|
|
|
|
next = assoc->next;
|
|
|
|
free((char *) assoc);
|
|
|
|
}
|
2013-07-31 07:53:43 +00:00
|
|
|
iso_xinfo_cloner_list= NULL;
|
2011-02-01 18:16:45 +00:00
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------- End of xinfo clone functions list ----------- */
|
|
|
|
|
|
|
|
|
2009-03-19 11:56:25 +00:00
|
|
|
/*
|
|
|
|
@param flag bit0= do not set up locale by LC_* environment variables
|
|
|
|
*/
|
|
|
|
int iso_init_with_flag(int flag)
|
2008-01-19 01:48:12 +00:00
|
|
|
{
|
2011-02-01 18:16:45 +00:00
|
|
|
int ret;
|
2009-03-20 16:48:42 +00:00
|
|
|
|
2010-10-04 12:56:24 +00:00
|
|
|
#ifdef Libisofs_with_libjtE
|
|
|
|
|
|
|
|
/* Ugly compile time check for header version compatibility.
|
2016-07-22 14:03:51 +00:00
|
|
|
If everything matches, then it produces no C code. In case of mismatch,
|
2010-10-04 12:56:24 +00:00
|
|
|
intentionally faulty C code will be inserted.
|
|
|
|
*/
|
2019-10-28 14:56:58 +00:00
|
|
|
/* The indentation is an advise of man gcc to help old compilers ignoring */
|
2010-10-04 12:56:24 +00:00
|
|
|
#if iso_libjte_req_major > LIBJTE_VERSION_MAJOR
|
|
|
|
#define Libisofs_libjte_dot_h_too_olD 1
|
|
|
|
#endif
|
|
|
|
#if iso_libjte_req_major == LIBJTE_VERSION_MAJOR && iso_libjte_req_minor > LIBJTE_VERSION_MINOR
|
|
|
|
#define Libisofs_libjte_dot_h_too_olD 1
|
|
|
|
#endif
|
|
|
|
#if iso_libjte_req_minor == LIBJTE_VERSION_MINOR && iso_libjte_req_micro > LIBJTE_VERSION_MICRO
|
|
|
|
#define Libisofs_libjte_dot_h_too_olD 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef Libisofs_libjte_dot_h_too_olD
|
|
|
|
LIBJTE_MISCONFIGURATION = 0;
|
|
|
|
INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libjte_dot_h_TOO_OLD__SEE_libisofs_dot_h_AND_messages_c = 0;
|
|
|
|
LIBJTE_MISCONFIGURATION_ = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (! libjte__is_compatible(LIBJTE_VERSION_MAJOR, LIBJTE_VERSION_MINOR,
|
|
|
|
LIBJTE_VERSION_MICRO, 0)) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"\nlibisofs: libjte TOO OLD ! Need at least libjte-%d.%d.%d\n\n",
|
|
|
|
LIBJTE_VERSION_MAJOR, LIBJTE_VERSION_MINOR,
|
|
|
|
LIBJTE_VERSION_MICRO);
|
|
|
|
return ISO_FATAL_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Libisofs_with_libjtE */
|
|
|
|
|
2009-03-19 11:56:25 +00:00
|
|
|
if (! (flag & 1)) {
|
|
|
|
iso_init_locale(0);
|
|
|
|
}
|
2008-01-19 01:48:12 +00:00
|
|
|
if (libiso_msgr == NULL) {
|
|
|
|
if (libiso_msgs_new(&libiso_msgr, 0) <= 0)
|
2008-01-20 21:28:27 +00:00
|
|
|
return ISO_FATAL_ERROR;
|
2008-01-19 01:48:12 +00:00
|
|
|
}
|
|
|
|
libiso_msgs_set_severities(libiso_msgr, LIBISO_MSGS_SEV_NEVER,
|
|
|
|
LIBISO_MSGS_SEV_FATAL, "libisofs: ", 0);
|
2011-02-01 18:16:45 +00:00
|
|
|
|
|
|
|
ret = iso_node_xinfo_make_clonable(aaip_xinfo_func, aaip_xinfo_cloner, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
ret = iso_node_xinfo_make_clonable(checksum_cx_xinfo_func,
|
|
|
|
checksum_cx_xinfo_cloner, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
ret = iso_node_xinfo_make_clonable(checksum_md5_xinfo_func,
|
|
|
|
checksum_md5_xinfo_cloner, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
ret = iso_node_xinfo_make_clonable(zisofs_zf_xinfo_func,
|
|
|
|
zisofs_zf_xinfo_cloner, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
ret = iso_node_xinfo_make_clonable(iso_px_ino_xinfo_func,
|
|
|
|
iso_px_ino_xinfo_cloner, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2012-05-25 08:42:26 +00:00
|
|
|
ret = iso_node_xinfo_make_clonable(iso_hfsplus_xinfo_func,
|
|
|
|
iso_hfsplus_xinfo_cloner, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2008-01-19 01:48:12 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-03-19 11:56:25 +00:00
|
|
|
int iso_init()
|
|
|
|
{
|
|
|
|
return iso_init_with_flag(0);
|
|
|
|
}
|
|
|
|
|
2008-01-19 01:48:12 +00:00
|
|
|
void iso_finish()
|
|
|
|
{
|
|
|
|
libiso_msgs_destroy(&libiso_msgr, 0);
|
2011-02-01 18:16:45 +00:00
|
|
|
iso_node_xinfo_dispose_cloners(0);
|
2015-07-27 11:50:57 +00:00
|
|
|
iso_stream_destroy_cmpranks(0);
|
2008-01-19 01:48:12 +00:00
|
|
|
}
|
|
|
|
|
2008-01-22 21:24:33 +00:00
|
|
|
int iso_set_abort_severity(char *severity)
|
|
|
|
{
|
|
|
|
int ret, sevno;
|
|
|
|
|
|
|
|
ret = libiso_msgs__text_to_sev(severity, &sevno, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
return ISO_WRONG_ARG_VALUE;
|
2008-08-19 22:05:27 +00:00
|
|
|
if (sevno > LIBISO_MSGS_SEV_FAILURE || sevno < LIBISO_MSGS_SEV_NOTE)
|
2008-01-22 21:24:33 +00:00
|
|
|
return ISO_WRONG_ARG_VALUE;
|
|
|
|
ret = abort_threshold;
|
|
|
|
abort_threshold = sevno;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-01-19 01:48:12 +00:00
|
|
|
void iso_msg_debug(int imgid, const char *fmt, ...)
|
2007-12-02 19:11:44 +00:00
|
|
|
{
|
2011-06-11 20:23:44 +00:00
|
|
|
char *msg = NULL;
|
2007-12-17 20:12:51 +00:00
|
|
|
va_list ap;
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2011-07-04 13:56:26 +00:00
|
|
|
LIBISO_ALLOC_MEM_VOID(msg, char, MAX_MSG_LEN);
|
2007-12-17 20:12:51 +00:00
|
|
|
va_start(ap, fmt);
|
|
|
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
|
|
|
va_end(ap);
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2008-01-19 01:48:12 +00:00
|
|
|
libiso_msgs_submit(libiso_msgr, imgid, 0x00000002, LIBISO_MSGS_SEV_DEBUG,
|
2007-12-17 20:12:51 +00:00
|
|
|
LIBISO_MSGS_PRIO_ZERO, msg, 0, 0);
|
2011-06-11 20:23:44 +00:00
|
|
|
ex:;
|
|
|
|
LIBISO_FREE_MEM(msg);
|
2007-12-02 19:11:44 +00:00
|
|
|
}
|
|
|
|
|
2008-01-22 20:12:27 +00:00
|
|
|
const char *iso_error_to_msg(int errcode)
|
2007-12-02 19:11:44 +00:00
|
|
|
{
|
2008-01-22 21:00:28 +00:00
|
|
|
switch(errcode) {
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_CANCELED:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Operation canceled";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FATAL_ERROR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Unknown or unexpected fatal error";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_ERROR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Unknown or unexpected error";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_ASSERT_FAILURE:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Internal programming error. Please report this bug";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_NULL_POINTER:
|
2008-11-25 11:05:03 +00:00
|
|
|
return "NULL pointer as value for an arg. that does not allow NULL";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_OUT_OF_MEM:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Memory allocation error";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_INTERRUPTED:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Interrupted by a signal";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_WRONG_ARG_VALUE:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Invalid parameter value";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_THREAD_ERROR:
|
2008-11-25 11:05:03 +00:00
|
|
|
return "Cannot create a needed thread";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_WRITE_ERROR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Write error";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_BUF_READ_ERROR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Buffer read error";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_NODE_ALREADY_ADDED:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Trying to add to a dir a node already added to a dir";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_NODE_NAME_NOT_UNIQUE:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Node with same name already exists";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_NODE_NOT_ADDED_TO_DIR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Trying to remove a node that was not added to dir";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_NODE_DOESNT_EXIST:
|
2008-02-05 11:55:29 +00:00
|
|
|
return "A requested node does not exist";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_IMAGE_ALREADY_BOOTABLE:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Try to set the boot image of an already bootable image";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_BOOT_IMAGE_NOT_VALID:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Trying to use an invalid file as boot image";
|
2010-04-22 12:04:51 +00:00
|
|
|
case ISO_BOOT_IMAGE_OVERFLOW:
|
|
|
|
return "Too many boot images added";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_ERROR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Error on file operation";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_ALREADY_OPENED:
|
2008-03-01 16:12:44 +00:00
|
|
|
return "Trying to open an already opened file";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_ACCESS_DENIED:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Access to file is not allowed";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_BAD_PATH:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Incorrect path to file";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_DOESNT_EXIST:
|
2008-02-05 11:55:29 +00:00
|
|
|
return "The file does not exist in the filesystem";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_NOT_OPENED:
|
2008-03-01 16:12:44 +00:00
|
|
|
return "Trying to read or close a file not opened";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_IS_DIR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Directory used where no dir is expected";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_READ_ERROR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Read error";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_IS_NOT_DIR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Not dir used where a dir is expected";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_IS_NOT_SYMLINK:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Not symlink used where a symlink is expected";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_SEEK_ERROR:
|
2008-11-25 11:05:03 +00:00
|
|
|
return "Cannot seek to specified location";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_IGNORED:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "File not supported in ECMA-119 tree and thus ignored";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_TOO_BIG:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "A file is bigger than supported by used standard";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_CANT_WRITE:
|
2008-02-05 11:55:29 +00:00
|
|
|
return "File read error during image creation";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILENAME_WRONG_CHARSET:
|
2009-03-03 15:47:53 +00:00
|
|
|
case ISO_FILENAME_WRONG_CHARSET_OLD:
|
2008-11-25 11:05:03 +00:00
|
|
|
return "Cannot convert filename to requested charset";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_CANT_ADD:
|
2008-11-25 11:05:03 +00:00
|
|
|
return "File cannot be added to the tree";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_FILE_IMGPATH_WRONG:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "File path break specification constraints and will be ignored";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_CHARSET_CONV_ERROR:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Charset conversion error";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_MANGLE_TOO_MUCH_FILES:
|
2008-11-25 11:05:03 +00:00
|
|
|
return "Too much files to mangle, cannot guarantee unique file names";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_WRONG_PVD:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Wrong or damaged Primary Volume Descriptor";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_WRONG_RR:
|
2013-04-10 11:32:09 +00:00
|
|
|
return "Wrong or damaged Rock Ridge entry";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_UNSUPPORTED_RR:
|
2013-04-10 11:32:09 +00:00
|
|
|
return "Unsupported Rock Ridge feature";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_WRONG_ECMA119:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Wrong or damaged ECMA-119";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_UNSUPPORTED_ECMA119:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Unsupported ECMA-119 feature";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_WRONG_EL_TORITO:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Wrong or damaged El-Torito catalog";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_UNSUPPORTED_EL_TORITO:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Unsupported El-Torito feature";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_ISOLINUX_CANT_PATCH:
|
2008-11-25 11:05:03 +00:00
|
|
|
return "Cannot patch isolinux boot image";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_UNSUPPORTED_SUSP:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Unsupported SUSP feature";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_WRONG_RR_WARN:
|
2013-04-10 11:32:09 +00:00
|
|
|
return "Error on a Rock Ridge entry that can be ignored";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_SUSP_UNHANDLED:
|
2013-04-10 11:32:09 +00:00
|
|
|
return "Unhandled SUSP entry";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_SUSP_MULTIPLE_ER:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Multiple ER SUSP entries found";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_UNSUPPORTED_VD:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "Unsupported volume descriptor found";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_EL_TORITO_WARN:
|
2008-01-22 21:00:28 +00:00
|
|
|
return "El-Torito related warning";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_IMAGE_WRITE_CANCELED:
|
2008-02-04 00:41:08 +00:00
|
|
|
return "Image write cancelled";
|
2008-08-19 22:05:27 +00:00
|
|
|
case ISO_EL_TORITO_HIDDEN:
|
2008-02-09 19:02:57 +00:00
|
|
|
return "El-Torito image is hidden";
|
2008-08-26 14:09:04 +00:00
|
|
|
case ISO_DATA_SOURCE_SORRY:
|
|
|
|
case ISO_DATA_SOURCE_MISHAP:
|
|
|
|
case ISO_DATA_SOURCE_FAILURE:
|
|
|
|
case ISO_DATA_SOURCE_FATAL:
|
2016-02-05 12:52:26 +00:00
|
|
|
return "Read error occurred with IsoDataSource";
|
2009-01-30 14:37:48 +00:00
|
|
|
case ISO_AAIP_IGNORED:
|
2009-02-06 10:41:24 +00:00
|
|
|
return "AAIP info with ACL or xattr in ISO image will be ignored";
|
2009-01-30 14:37:48 +00:00
|
|
|
case ISO_AAIP_BAD_ACL:
|
|
|
|
return "Error with decoding ACL from AAIP info";
|
2009-02-06 10:41:24 +00:00
|
|
|
case ISO_AAIP_BAD_ACL_TEXT:
|
|
|
|
return "Error with encoding ACL for AAIP";
|
|
|
|
case ISO_AAIP_NOT_ENABLED:
|
2009-02-09 16:46:35 +00:00
|
|
|
return "AAIP processing for ACL or xattr not enabled at compile time";
|
2009-02-06 10:41:24 +00:00
|
|
|
case ISO_AAIP_BAD_AASTRING:
|
|
|
|
return "Error with decoding AAIP info for ACL or xattr";
|
|
|
|
case ISO_AAIP_NO_GET_LOCAL:
|
2022-09-20 07:51:39 +00:00
|
|
|
case ISO_AAIP_NO_GET_LOCAL_S:
|
2009-02-06 10:41:24 +00:00
|
|
|
return "Error with reading ACL or xattr from local file";
|
|
|
|
case ISO_AAIP_NO_SET_LOCAL:
|
2022-09-20 07:51:39 +00:00
|
|
|
case ISO_AAIP_NO_SET_LOCAL_S:
|
2009-02-06 10:41:24 +00:00
|
|
|
return "Error with attaching ACL or xattr to local file";
|
|
|
|
case ISO_AAIP_NON_USER_NAME:
|
2009-02-09 16:46:35 +00:00
|
|
|
return "Unallowed attempt to set an xattr with non-userspace name";
|
2009-03-26 16:34:38 +00:00
|
|
|
case ISO_EXTF_TOO_OFTEN:
|
|
|
|
return "Too many references on a single external filter command";
|
2009-04-09 14:18:50 +00:00
|
|
|
case ISO_ZLIB_NOT_ENABLED:
|
|
|
|
return "Use of zlib was not enabled at compile time";
|
|
|
|
case ISO_ZISOFS_TOO_LARGE:
|
2020-10-14 18:19:11 +00:00
|
|
|
return "File too large. Cannot apply zisofs filter.";
|
2009-04-10 10:16:41 +00:00
|
|
|
case ISO_FILTER_WRONG_INPUT:
|
|
|
|
return "Filter input differs from previous run";
|
|
|
|
case ISO_ZLIB_COMPR_ERR:
|
|
|
|
return "zlib compression/decompression error";
|
|
|
|
case ISO_ZISOFS_WRONG_INPUT:
|
2020-10-14 18:19:11 +00:00
|
|
|
return "Input stream is not in a supported zisofs format";
|
2009-04-11 17:10:37 +00:00
|
|
|
case ISO_ZISOFS_PARAM_LOCK:
|
|
|
|
return "Cannot set global zisofs parameters while filters exist";
|
2009-04-15 11:22:20 +00:00
|
|
|
case ISO_ZLIB_EARLY_EOF:
|
|
|
|
return "Premature EOF of zlib input stream";
|
2009-08-14 14:32:10 +00:00
|
|
|
case ISO_MD5_AREA_CORRUPTED:
|
2009-08-18 15:03:33 +00:00
|
|
|
return "Checksum area or checksum tag appear corrupted";
|
|
|
|
case ISO_MD5_TAG_MISMATCH:
|
|
|
|
return "Checksum mismatch between checksum tag and data blocks";
|
|
|
|
case ISO_SB_TREE_CORRUPTED:
|
|
|
|
return "Checksum mismatch in System Area, Volume Descriptors, or directory tree";
|
|
|
|
case ISO_MD5_TAG_UNEXPECTED:
|
|
|
|
return "Unexpected checksum tag type encountered";
|
|
|
|
case ISO_MD5_TAG_MISPLACED:
|
|
|
|
return "Misplaced checksum tag type encountered";
|
|
|
|
case ISO_MD5_TAG_OTHER_RANGE:
|
|
|
|
return "Checksum tag with unexpected address range encountered";
|
2009-08-19 20:26:18 +00:00
|
|
|
case ISO_MD5_STREAM_CHANGE:
|
|
|
|
return "Detected file content changes while it was written into the image";
|
2009-08-31 21:09:16 +00:00
|
|
|
case ISO_SCDBACKUP_TAG_NOT_0:
|
|
|
|
return "Session does not start at LBA 0. scdbackup checksum tag not written.";
|
2010-06-23 17:54:51 +00:00
|
|
|
case ISO_BOOT_NO_CATALOG:
|
|
|
|
return "No boot catalog created yet";
|
2010-09-05 10:43:48 +00:00
|
|
|
case ISO_OVWRT_MS_TOO_SMALL:
|
|
|
|
return "Multi-session offset too small for overwrite buffer";
|
|
|
|
case ISO_PART_OFFST_TOO_SMALL:
|
|
|
|
return "Partition offset too small for first tree root.";
|
|
|
|
case ISO_OVWRT_FIFO_TOO_SMALL:
|
|
|
|
return "The ring buffer is too small for overwrite buffer";
|
2010-09-27 16:22:05 +00:00
|
|
|
case ISO_LIBJTE_NOT_ENABLED:
|
|
|
|
return "Use of libjte was not enabled at compile time";
|
|
|
|
case ISO_LIBJTE_START_FAILED:
|
|
|
|
return "Failed to start up Jigdo Template Extraction";
|
|
|
|
case ISO_LIBJTE_END_FAILED:
|
|
|
|
return "Failed to finish Jigdo Template Extraction";
|
|
|
|
case ISO_LIBJTE_FILE_FAILED:
|
2010-10-02 20:57:09 +00:00
|
|
|
return "Failed to process file for Jigdo Template Extraction";
|
2010-10-12 18:24:17 +00:00
|
|
|
case ISO_BOOT_TOO_MANY_MIPS:
|
|
|
|
return "Too many MIPS Big Endian boot files given (max. 15)";
|
2010-10-14 20:34:32 +00:00
|
|
|
case ISO_BOOT_FILE_MISSING:
|
|
|
|
return "Boot file missing in image";
|
2010-10-18 14:56:00 +00:00
|
|
|
case ISO_BAD_PARTITION_NO:
|
|
|
|
return "Partition number out of range";
|
|
|
|
case ISO_BAD_PARTITION_FILE:
|
|
|
|
return "Cannot open data file for appended partition";
|
2010-10-19 08:14:26 +00:00
|
|
|
case ISO_NON_MBR_SYS_AREA:
|
2012-06-12 11:24:50 +00:00
|
|
|
return "May not combine MBR partition with non-MBR system area";
|
2010-11-30 08:47:22 +00:00
|
|
|
case ISO_DISPLACE_ROLLOVER:
|
|
|
|
return "Displacement offset leads outside 32 bit range";
|
2010-12-22 13:21:00 +00:00
|
|
|
case ISO_NAME_NEEDS_TRANSL:
|
|
|
|
return "File name cannot be written into ECMA-119 untranslated";
|
2011-01-25 09:50:37 +00:00
|
|
|
case ISO_STREAM_NO_CLONE:
|
|
|
|
return "Data file input stream object offers no cloning method";
|
2011-02-01 18:16:45 +00:00
|
|
|
case ISO_XINFO_NO_CLONE:
|
|
|
|
return "Extended information class offers no cloning method";
|
2011-03-08 18:37:52 +00:00
|
|
|
case ISO_MD5_TAG_COPIED:
|
|
|
|
return "Found copied superblock checksum tag";
|
2011-03-26 19:54:20 +00:00
|
|
|
case ISO_RR_NAME_TOO_LONG:
|
|
|
|
return "Rock Ridge leaf name too long";
|
|
|
|
case ISO_RR_NAME_RESERVED:
|
|
|
|
return "Reserved Rock Ridge leaf name";
|
2011-03-28 13:00:44 +00:00
|
|
|
case ISO_RR_PATH_TOO_LONG:
|
|
|
|
return "Rock Ridge path too long";
|
2011-08-22 15:10:13 +00:00
|
|
|
case ISO_AAIP_BAD_ATTR_NAME:
|
|
|
|
return "Attribute name cannot be represented";
|
2011-08-24 07:23:02 +00:00
|
|
|
case ISO_AAIP_ACL_MULT_OBJ:
|
|
|
|
return "ACL text contains multiple entries of user::, group::, other::";
|
2012-05-24 11:06:49 +00:00
|
|
|
case ISO_SECT_SCATTERED:
|
|
|
|
return "File sections do not form consecutive array of blocks";
|
2012-05-26 21:04:42 +00:00
|
|
|
case ISO_BOOT_TOO_MANY_APM:
|
|
|
|
return "Too many Apple Partition Map entries requested";
|
2012-05-28 07:17:17 +00:00
|
|
|
case ISO_BOOT_APM_OVERLAP:
|
|
|
|
return "Overlapping Apple Partition Map entries requested";
|
2012-06-02 17:32:22 +00:00
|
|
|
case ISO_BOOT_TOO_MANY_GPT:
|
|
|
|
return "Too many GPT entries requested";
|
|
|
|
case ISO_BOOT_GPT_OVERLAP:
|
|
|
|
return "Overlapping GPT entries requested";
|
2012-06-11 11:05:46 +00:00
|
|
|
case ISO_BOOT_TOO_MANY_MBR:
|
|
|
|
return "Too many MBR partition entries requested";
|
|
|
|
case ISO_BOOT_MBR_OVERLAP:
|
2012-06-12 11:24:50 +00:00
|
|
|
return "Overlapping MBR partition entries requested";
|
|
|
|
case ISO_BOOT_MBR_COLLISION:
|
|
|
|
return "Attempt to use an MBR partition entry twice";
|
2012-06-18 08:06:16 +00:00
|
|
|
case ISO_BOOT_NO_EFI_ELTO:
|
|
|
|
return "No suitable El Torito EFI boot image for exposure as GPT partition";
|
2012-06-27 18:39:57 +00:00
|
|
|
case ISO_BOOT_HFSP_BAD_BSIZE:
|
|
|
|
return "Not a supported HFS+ or APM block size";
|
|
|
|
case ISO_BOOT_APM_GPT_BSIZE:
|
|
|
|
return "APM block size prevents coexistence with GPT";
|
2012-06-30 19:48:42 +00:00
|
|
|
case ISO_HFSP_NO_MANGLE:
|
|
|
|
return "Name collision in HFS+, mangling not possible";
|
2012-07-01 16:41:54 +00:00
|
|
|
case ISO_DEAD_SYMLINK:
|
|
|
|
return "Symbolic link cannot be resolved";
|
|
|
|
case ISO_DEEP_SYMLINK:
|
|
|
|
return "Too many chained symbolic links";
|
2013-01-11 15:22:14 +00:00
|
|
|
case ISO_BAD_ISO_FILETYPE:
|
|
|
|
return "Unrecognized file type in ISO image";
|
2013-12-17 20:45:52 +00:00
|
|
|
case ISO_NAME_NOT_UCS2:
|
2014-01-14 08:43:28 +00:00
|
|
|
return "Filename not suitable for character set UCS-2";
|
2014-01-03 17:29:29 +00:00
|
|
|
case ISO_IMPORT_COLLISION:
|
2014-01-14 08:43:28 +00:00
|
|
|
return "File name collision during ISO image import";
|
|
|
|
case ISO_HPPA_PALO_INCOMPL:
|
|
|
|
return "Incomplete HP-PA PALO boot parameters";
|
|
|
|
case ISO_HPPA_PALO_OFLOW:
|
2014-01-16 10:59:58 +00:00
|
|
|
return "HP-PA PALO boot address exceeds 2 GB";
|
2014-01-14 08:43:28 +00:00
|
|
|
case ISO_HPPA_PALO_NOTREG:
|
|
|
|
return "HP-PA PALO file is not a data file";
|
|
|
|
case ISO_HPPA_PALO_CMDLEN:
|
|
|
|
return "HP-PA PALO command line too long";
|
2014-04-11 13:39:45 +00:00
|
|
|
case ISO_SYSAREA_PROBLEMS:
|
|
|
|
return "Problems encountered during inspection of System Area";
|
2014-04-12 12:54:54 +00:00
|
|
|
case ISO_INQ_SYSAREA_PROP:
|
|
|
|
return "Unrecognized inquiry for system area property";
|
2015-02-28 14:13:38 +00:00
|
|
|
case ISO_ALPHA_BOOT_NOTREG:
|
|
|
|
return "DEC Alpha Boot Loader file is not a data file";
|
2015-04-23 13:46:04 +00:00
|
|
|
case ISO_NO_KEPT_DATA_SRC:
|
|
|
|
return "No data source of imported ISO image available";
|
|
|
|
case ISO_MALFORMED_READ_INTVL:
|
|
|
|
return "Malformed description string for interval reader";
|
|
|
|
case ISO_INTVL_READ_PROBLEM:
|
|
|
|
return "Unreadable file, premature EOF, or failure to seek for interval reader";
|
2015-07-27 11:50:57 +00:00
|
|
|
case ISO_NOT_REPRODUCIBLE:
|
|
|
|
return "Cannot arrange content of data files in surely reproducible way";
|
2015-08-11 10:02:26 +00:00
|
|
|
case ISO_PATCH_FILTERED_BOOT:
|
|
|
|
return "May not write boot info into filtered stream of boot image";
|
|
|
|
case ISO_PATCH_OVERSIZED_BOOT:
|
|
|
|
return "Boot image to large to buffer for writing boot info";
|
Rectified handling of oversized filenames by new API calls:
iso_image_set_truncate_mode, iso_image_get_truncate_mode,
iso_truncate_leaf_name, iso_image_set_node_name, iso_image_tree_clone,
iso_image_add_new_dir, iso_image_add_new_file, iso_image_add_new_special,
iso_image_add_new_symlink, iso_image_dir_get_node, iso_image_path_to_node,
2015-09-17 11:59:05 +00:00
|
|
|
case ISO_RR_NAME_TRUNCATED:
|
|
|
|
return "File name had to be truncated and MD5 marked";
|
2015-09-25 17:07:53 +00:00
|
|
|
case ISO_TRUNCATE_ISOFSNT:
|
2015-09-27 16:03:18 +00:00
|
|
|
return "File name truncation length changed by loaded image info";
|
|
|
|
case ISO_GENERAL_NOTE:
|
|
|
|
return "A general note message was issued";
|
2015-10-11 15:36:30 +00:00
|
|
|
case ISO_BAD_FSRC_FILETYPE:
|
|
|
|
return "Unrecognized file type of IsoFileSrc object";
|
2016-08-12 16:18:47 +00:00
|
|
|
case ISO_GPT_NO_VOL_UUID:
|
|
|
|
return "Cannot derive GPT GUID from undefined pseudo-UUID volume timestamp";
|
|
|
|
case ISO_BAD_GPT_GUID_MODE:
|
|
|
|
return "Unrecognized GPT disk GUID setup mode";
|
2017-08-17 06:49:28 +00:00
|
|
|
case ISO_NO_ROOT_DIR:
|
|
|
|
return "Unable to obtain root directory";
|
2017-08-19 09:08:02 +00:00
|
|
|
case ISO_SUSP_WRONG_CE_SIZE:
|
2017-08-19 14:55:08 +00:00
|
|
|
return "Zero sized, oversized, or mislocated SUSP CE area found";
|
2017-08-26 09:47:14 +00:00
|
|
|
case ISO_MULTI_OVER_IMPORTED:
|
|
|
|
return "Multi-session would overwrite imported_iso interval";
|
2018-06-10 17:51:47 +00:00
|
|
|
case ISO_ELTO_EFI_HIDDEN:
|
|
|
|
return "El-Torito EFI image is hidden";
|
2020-06-13 08:17:32 +00:00
|
|
|
case ISO_HFSPLUS_TOO_MANY_FILES:
|
|
|
|
return "Too many files in HFS+ directory tree";
|
2020-10-14 18:19:11 +00:00
|
|
|
case ISO_ZISOFS_TOO_MANY_PTR:
|
|
|
|
return "Too many zisofs block pointers needed overall";
|
|
|
|
case ISO_ZISOFS_BPT_UNDERRUN:
|
|
|
|
return "Prevented zisofs block pointer counter underrun";
|
2020-10-17 12:40:24 +00:00
|
|
|
case ISO_ZISOFS_UNKNOWN_SIZE:
|
|
|
|
return "Cannot obtain size of zisofs compressed stream";
|
2022-09-20 07:51:39 +00:00
|
|
|
case ISO_UNDEF_READ_FEATURE:
|
|
|
|
return "Undefined IsoReadImageFeatures name";
|
2023-01-22 15:03:44 +00:00
|
|
|
case ISO_TOO_MANY_CE:
|
|
|
|
return "Too many CE entries for single file";
|
|
|
|
case ISO_TOO_MANY_CE_FOR_LINUX:
|
|
|
|
return "Too many CE entries for single file when mounted by Linux";
|
|
|
|
case ISO_CE_REMOVING_ATTR:
|
|
|
|
return "Too many CE entries for single file, removing attributes";
|
2008-01-22 21:00:28 +00:00
|
|
|
default:
|
|
|
|
return "Unknown error";
|
|
|
|
}
|
2007-12-02 19:11:44 +00:00
|
|
|
}
|
|
|
|
|
2009-08-18 16:38:29 +00:00
|
|
|
int iso_msg_is_abort(int errcode)
|
|
|
|
{
|
|
|
|
if (ISO_ERR_SEV(errcode) >= abort_threshold)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-22 20:36:24 +00:00
|
|
|
int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...)
|
2007-12-02 19:11:44 +00:00
|
|
|
{
|
2007-12-28 21:10:17 +00:00
|
|
|
char msg[MAX_MSG_LEN];
|
2007-12-17 20:12:51 +00:00
|
|
|
va_list ap;
|
2008-08-19 22:05:27 +00:00
|
|
|
|
2008-01-22 20:12:27 +00:00
|
|
|
/* when called with ISO_CANCELED, we don't need to submit any message */
|
2011-05-21 21:16:10 +00:00
|
|
|
if (errcode == (int) ISO_CANCELED && fmt == NULL) {
|
2008-01-22 20:12:27 +00:00
|
|
|
return ISO_CANCELED;
|
|
|
|
}
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2008-01-22 20:12:27 +00:00
|
|
|
if (fmt) {
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
} else {
|
2015-10-08 21:02:06 +00:00
|
|
|
strncpy(msg, iso_error_to_msg(errcode), MAX_MSG_LEN - 1);
|
|
|
|
msg[MAX_MSG_LEN - 1] = 0;
|
2008-01-22 20:12:27 +00:00
|
|
|
}
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2008-08-19 22:05:27 +00:00
|
|
|
libiso_msgs_submit(libiso_msgr, imgid, ISO_ERR_CODE(errcode),
|
2008-02-05 11:55:29 +00:00
|
|
|
ISO_ERR_SEV(errcode), ISO_ERR_PRIO(errcode), msg, 0, 0);
|
2008-01-22 20:36:24 +00:00
|
|
|
if (causedby != 0) {
|
2008-08-19 22:05:27 +00:00
|
|
|
snprintf(msg, MAX_MSG_LEN, " > Caused by: %s",
|
2008-02-06 16:40:06 +00:00
|
|
|
iso_error_to_msg(causedby));
|
2008-08-19 22:05:27 +00:00
|
|
|
libiso_msgs_submit(libiso_msgr, imgid, ISO_ERR_CODE(causedby),
|
2008-02-06 16:40:06 +00:00
|
|
|
LIBISO_MSGS_SEV_NOTE, LIBISO_MSGS_PRIO_LOW, msg, 0, 0);
|
2008-01-22 20:36:24 +00:00
|
|
|
if (ISO_ERR_SEV(causedby) == LIBISO_MSGS_SEV_FATAL) {
|
|
|
|
return ISO_CANCELED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-18 16:38:29 +00:00
|
|
|
if (iso_msg_is_abort(errcode)) {
|
2008-01-22 20:12:27 +00:00
|
|
|
return ISO_CANCELED;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2007-12-02 19:11:44 +00:00
|
|
|
}
|
|
|
|
|
2008-08-19 22:05:27 +00:00
|
|
|
/**
|
2007-12-02 19:11:44 +00:00
|
|
|
* Control queueing and stderr printing of messages from libisofs.
|
|
|
|
* Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
|
|
|
|
* "NOTE", "UPDATE", "DEBUG", "ALL".
|
2008-08-19 22:05:27 +00:00
|
|
|
*
|
2007-12-02 19:11:44 +00:00
|
|
|
* @param queue_severity Gives the minimum limit for messages to be queued.
|
|
|
|
* Default: "NEVER". If you queue messages then you
|
|
|
|
* must consume them by iso_msgs_obtain().
|
|
|
|
* @param print_severity Does the same for messages to be printed directly
|
|
|
|
* to stderr.
|
|
|
|
* @param print_id A text prefix to be printed before the message.
|
|
|
|
* @return >0 for success, <=0 for error
|
|
|
|
*/
|
2008-08-19 22:05:27 +00:00
|
|
|
int iso_set_msgs_severities(char *queue_severity, char *print_severity,
|
2008-01-19 01:48:12 +00:00
|
|
|
char *print_id)
|
2007-12-02 19:11:44 +00:00
|
|
|
{
|
2007-12-28 21:10:17 +00:00
|
|
|
int ret, queue_sevno, print_sevno;
|
|
|
|
|
|
|
|
ret = libiso_msgs__text_to_sev(queue_severity, &queue_sevno, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
return 0;
|
|
|
|
ret = libiso_msgs__text_to_sev(print_severity, &print_sevno, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
return 0;
|
2008-01-19 01:48:12 +00:00
|
|
|
ret = libiso_msgs_set_severities(libiso_msgr, queue_sevno, print_sevno,
|
2007-12-28 21:10:17 +00:00
|
|
|
print_id, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
return 0;
|
|
|
|
return 1;
|
2007-12-02 19:11:44 +00:00
|
|
|
}
|
|
|
|
|
2008-08-19 22:05:27 +00:00
|
|
|
/**
|
2007-12-02 19:11:44 +00:00
|
|
|
* Obtain the oldest pending libisofs message from the queue which has at
|
|
|
|
* least the given minimum_severity. This message and any older message of
|
|
|
|
* lower severity will get discarded from the queue and is then lost forever.
|
2008-08-19 22:05:27 +00:00
|
|
|
*
|
2007-12-02 19:11:44 +00:00
|
|
|
* Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
|
|
|
|
* "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER"
|
|
|
|
* will discard the whole queue.
|
2008-08-19 22:05:27 +00:00
|
|
|
*
|
2007-12-02 19:11:44 +00:00
|
|
|
* @param error_code Will become a unique error code as listed in messages.h
|
2008-01-27 17:38:55 +00:00
|
|
|
* @param imgid Id of the image that was issued the message.
|
2007-12-02 19:11:44 +00:00
|
|
|
* @param msg_text Must provide at least ISO_MSGS_MESSAGE_LEN bytes.
|
|
|
|
* @param severity Will become the severity related to the message and
|
|
|
|
* should provide at least 80 bytes.
|
|
|
|
* @return 1 if a matching item was found, 0 if not, <0 for severe errors
|
|
|
|
*/
|
2008-01-27 02:56:37 +00:00
|
|
|
int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid,
|
2008-01-27 17:38:55 +00:00
|
|
|
char msg_text[], char severity[])
|
2007-12-02 19:11:44 +00:00
|
|
|
{
|
2008-01-27 17:38:55 +00:00
|
|
|
int ret, minimum_sevno, sevno, priority, os_errno;
|
2008-01-27 02:56:37 +00:00
|
|
|
double timestamp;
|
|
|
|
pid_t pid;
|
2007-12-28 21:10:17 +00:00
|
|
|
char *textpt, *sev_name;
|
|
|
|
struct libiso_msgs_item *item= NULL;
|
|
|
|
|
|
|
|
ret = libiso_msgs__text_to_sev(minimum_severity, &minimum_sevno, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
return 0;
|
2008-08-19 22:05:27 +00:00
|
|
|
ret = libiso_msgs_obtain(libiso_msgr, &item, minimum_sevno,
|
2007-12-28 21:10:17 +00:00
|
|
|
LIBISO_MSGS_PRIO_ZERO, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
goto ex;
|
2008-01-27 17:38:55 +00:00
|
|
|
ret = libiso_msgs_item_get_msg(item, error_code, &textpt, &os_errno, 0);
|
2007-12-28 21:10:17 +00:00
|
|
|
if (ret <= 0)
|
|
|
|
goto ex;
|
|
|
|
strncpy(msg_text, textpt, ISO_MSGS_MESSAGE_LEN-1);
|
|
|
|
if (strlen(textpt) >= ISO_MSGS_MESSAGE_LEN)
|
|
|
|
msg_text[ISO_MSGS_MESSAGE_LEN-1] = 0;
|
|
|
|
|
2008-01-27 02:56:37 +00:00
|
|
|
ret = libiso_msgs_item_get_origin(item, ×tamp, &pid, imgid, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
goto ex;
|
2008-08-19 22:05:27 +00:00
|
|
|
|
2007-12-28 21:10:17 +00:00
|
|
|
severity[0]= 0;
|
|
|
|
ret = libiso_msgs_item_get_rank(item, &sevno, &priority, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
goto ex;
|
|
|
|
ret = libiso_msgs__sev_to_text(sevno, &sev_name, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
goto ex;
|
|
|
|
strcpy(severity, sev_name);
|
|
|
|
|
|
|
|
ret = 1;
|
|
|
|
ex: ;
|
2008-01-19 01:48:12 +00:00
|
|
|
libiso_msgs_destroy_item(libiso_msgr, &item, 0);
|
2007-12-28 21:10:17 +00:00
|
|
|
return ret;
|
2007-12-02 19:11:44 +00:00
|
|
|
}
|
|
|
|
|
2008-02-22 14:39:35 +00:00
|
|
|
|
|
|
|
int iso_msgs_submit(int error_code, char msg_text[], int os_errno,
|
|
|
|
char severity[], int origin)
|
|
|
|
{
|
2008-02-22 20:42:17 +00:00
|
|
|
int ret, sevno;
|
2008-02-22 14:39:35 +00:00
|
|
|
|
|
|
|
ret = libiso_msgs__text_to_sev(severity, &sevno, 0);
|
|
|
|
if (ret <= 0)
|
2008-02-22 21:43:30 +00:00
|
|
|
sevno = LIBISO_MSGS_SEV_ALL;
|
2008-02-22 14:39:35 +00:00
|
|
|
if (error_code <= 0) {
|
|
|
|
switch(sevno) {
|
|
|
|
case LIBISO_MSGS_SEV_ABORT: error_code = 0x00040000;
|
|
|
|
break; case LIBISO_MSGS_SEV_FATAL: error_code = 0x00040001;
|
|
|
|
break; case LIBISO_MSGS_SEV_SORRY: error_code = 0x00040002;
|
|
|
|
break; case LIBISO_MSGS_SEV_WARNING: error_code = 0x00040003;
|
|
|
|
break; case LIBISO_MSGS_SEV_HINT: error_code = 0x00040004;
|
|
|
|
break; case LIBISO_MSGS_SEV_NOTE: error_code = 0x00040005;
|
|
|
|
break; case LIBISO_MSGS_SEV_UPDATE: error_code = 0x00040006;
|
|
|
|
break; case LIBISO_MSGS_SEV_DEBUG: error_code = 0x00040007;
|
|
|
|
break; default: error_code = 0x00040008;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret = libiso_msgs_submit(libiso_msgr, origin, error_code,
|
|
|
|
sevno, LIBISO_MSGS_PRIO_HIGH, msg_text, os_errno, 0);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-22 20:42:17 +00:00
|
|
|
int iso_text_to_sev(char *severity_name, int *sevno)
|
2008-02-22 14:39:35 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = libiso_msgs__text_to_sev(severity_name, sevno, 0);
|
|
|
|
if (ret <= 0)
|
|
|
|
*sevno = LIBISO_MSGS_SEV_FATAL;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-22 20:42:17 +00:00
|
|
|
int iso_sev_to_text(int severity_number, char **severity_name)
|
2008-02-22 14:39:35 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = libiso_msgs__sev_to_text(severity_number, severity_name, 0);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-19 01:48:12 +00:00
|
|
|
/**
|
|
|
|
* Return the messenger object handle used by libisofs. This handle
|
|
|
|
* may be used by related libraries to their own compatible
|
|
|
|
* messenger objects and thus to direct their messages to the libisofs
|
|
|
|
* message queue. See also: libburn, API function burn_set_messenger().
|
2008-08-19 22:05:27 +00:00
|
|
|
*
|
2008-01-19 01:48:12 +00:00
|
|
|
* @return the handle. Do only use with compatible
|
|
|
|
*/
|
|
|
|
void *iso_get_messenger()
|
2007-12-02 19:11:44 +00:00
|
|
|
{
|
2008-01-19 01:48:12 +00:00
|
|
|
return libiso_msgr;
|
2007-12-02 19:11:44 +00:00
|
|
|
}
|
2008-02-04 01:16:12 +00:00
|
|
|
|
|
|
|
int iso_error_get_severity(int e)
|
|
|
|
{
|
|
|
|
return ISO_ERR_SEV(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
int iso_error_get_priority(int e)
|
|
|
|
{
|
|
|
|
return ISO_ERR_PRIO(e);
|
|
|
|
}
|
2008-02-05 11:55:29 +00:00
|
|
|
|
|
|
|
int iso_error_get_code(int e)
|
|
|
|
{
|
|
|
|
return ISO_ERR_CODE(e);
|
|
|
|
}
|
2008-02-22 18:39:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
int iso_report_errfile(char *path, int error_code, int os_errno, int flag)
|
|
|
|
{
|
|
|
|
libiso_msgs_submit(libiso_msgr, 0, error_code,
|
|
|
|
LIBISO_MSGS_SEV_ERRFILE, LIBISO_MSGS_PRIO_HIGH,
|
|
|
|
path, os_errno, 0);
|
|
|
|
return(1);
|
|
|
|
}
|
2010-10-04 11:18:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
int iso_libjte_forward_msgs(void *libjte_handle,
|
|
|
|
int imgid, int errcode, int flag)
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef Libisofs_with_libjtE
|
|
|
|
|
|
|
|
char *msg = NULL;
|
|
|
|
int res;
|
|
|
|
struct libjte_env *handle = (struct libjte_env *) libjte_handle;
|
|
|
|
|
|
|
|
res = ISO_SUCCESS;
|
|
|
|
while(1) {
|
|
|
|
msg= libjte_get_next_message(handle);
|
|
|
|
if(msg == NULL)
|
|
|
|
break;
|
|
|
|
res = iso_msg_submit(imgid, errcode, 0, msg);
|
|
|
|
free(msg);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
|
|
|
|
#else /* Libisofs_with_libjtE */
|
|
|
|
|
|
|
|
return ISO_SUCCESS;
|
|
|
|
|
|
|
|
#endif /* ! Libisofs_with_libjtE */
|
|
|
|
|
|
|
|
}
|
|
|
|
|