Several improves in error codes.
- Code severity and priority in error codes. - Added ERROR severity, suitable for function failures. - Review libisofs errors and its severity.
This commit is contained in:
parent
a076ae9df2
commit
1070fe4cc6
@ -84,14 +84,14 @@ int iso_ring_buffer_new(size_t size, IsoRingBuffer **rbuf)
|
||||
|
||||
buffer = malloc(sizeof(IsoRingBuffer));
|
||||
if (buffer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
buffer->cap = (size > 32 ? size : 32) * BLOCK_SIZE;
|
||||
buffer->buf = malloc(buffer->cap);
|
||||
if (buffer->buf == NULL) {
|
||||
free(buffer);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
buffer->size = 0;
|
||||
|
@ -58,7 +58,7 @@ int default_create_file(IsoNodeBuilder *builder, IsoImage *image,
|
||||
/* the stream has taken our ref to src, so we need to add one */
|
||||
iso_file_source_ref(src);
|
||||
iso_stream_unref(stream);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* fill node fields */
|
||||
@ -125,7 +125,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
if (file == NULL) {
|
||||
free(name);
|
||||
iso_stream_unref(stream);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
file->msblock = 0;
|
||||
file->sort_weight = 0;
|
||||
@ -140,7 +140,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
new = calloc(1, sizeof(IsoDir));
|
||||
if (new == NULL) {
|
||||
free(name);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
new->type = LIBISO_DIR;
|
||||
}
|
||||
@ -159,7 +159,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
link = malloc(sizeof(IsoSymlink));
|
||||
if (link == NULL) {
|
||||
free(name);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
link->dest = strdup(dest);
|
||||
link->node.type = LIBISO_SYMLINK;
|
||||
@ -176,7 +176,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
special = malloc(sizeof(IsoSpecial));
|
||||
if (special == NULL) {
|
||||
free(name);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
special->dev = info.st_rdev;
|
||||
special->node.type = LIBISO_SPECIAL;
|
||||
@ -220,7 +220,7 @@ int iso_node_basic_builder_new(IsoNodeBuilder **builder)
|
||||
|
||||
b = malloc(sizeof(IsoNodeBuilder));
|
||||
if (b == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
b->refcount = 1;
|
||||
|
@ -164,13 +164,13 @@ int iso_data_source_new_from_file(const char *path, IsoDataSource **src)
|
||||
|
||||
data = malloc(sizeof(struct file_data_src));
|
||||
if (data == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
ds = malloc(sizeof(IsoDataSource));
|
||||
if (ds == NULL) {
|
||||
free(data);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* fill data fields */
|
||||
@ -178,7 +178,7 @@ int iso_data_source_new_from_file(const char *path, IsoDataSource **src)
|
||||
if (data->path == NULL) {
|
||||
free(data);
|
||||
free(ds);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
data->fd = -1;
|
||||
|
@ -197,7 +197,7 @@ int ecma119_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
uint32_t path_table_size;
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
target = writer->target;
|
||||
@ -307,7 +307,7 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer)
|
||||
char *abstract_file_id, *biblio_file_id;
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
t = writer->target;
|
||||
@ -555,7 +555,7 @@ int write_path_tables(Ecma119Image *t)
|
||||
/* allocate temporal pathlist */
|
||||
pathlist = malloc(sizeof(void*) * t->ndirs);
|
||||
if (pathlist == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
pathlist[0] = t->root;
|
||||
cur = 1;
|
||||
@ -625,7 +625,7 @@ int ecma119_writer_create(Ecma119Image *target)
|
||||
|
||||
writer = malloc(sizeof(IsoImageWriter));
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
writer->compute_data_blocks = ecma119_writer_compute_data_blocks;
|
||||
@ -656,7 +656,7 @@ int pad_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
Ecma119Image *target;
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
target = writer->target;
|
||||
@ -682,7 +682,7 @@ int pad_writer_write_data(IsoImageWriter *writer)
|
||||
size_t i;
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
t = writer->target;
|
||||
|
||||
@ -715,7 +715,7 @@ int pad_writer_create(Ecma119Image *target)
|
||||
|
||||
writer = malloc(sizeof(IsoImageWriter));
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
writer->compute_data_blocks = pad_writer_compute_data_blocks;
|
||||
@ -806,7 +806,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
|
||||
/* 1. Allocate target and copy opts there */
|
||||
target = calloc(1, sizeof(Ecma119Image));
|
||||
if (target == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* create the tree for file caching */
|
||||
@ -859,7 +859,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
|
||||
if (target->input_charset == NULL) {
|
||||
iso_image_unref(src);
|
||||
free(target);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
if (opts->output_charset != NULL) {
|
||||
@ -870,7 +870,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
|
||||
if (target->output_charset == NULL) {
|
||||
iso_image_unref(src);
|
||||
free(target);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -900,7 +900,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
|
||||
if (target->writers == NULL) {
|
||||
iso_image_unref(src);
|
||||
free(target);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* create writer for ECMA-119 structure */
|
||||
@ -1130,7 +1130,7 @@ int iso_image_create_burn_source(IsoImage *image, Ecma119WriteOpts *opts,
|
||||
|
||||
source = calloc(1, sizeof(struct burn_source));
|
||||
if (source == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
ret = ecma119_image_new(image, opts, &target);
|
||||
@ -1157,7 +1157,7 @@ int iso_write(Ecma119Image *target, void *buf, size_t count)
|
||||
ret = iso_ring_buffer_write(target->buffer, buf, count);
|
||||
if (ret == 0) {
|
||||
/* reader cancelled */
|
||||
return ISO_WRITE_ERROR;
|
||||
return ISO_CANCELED;
|
||||
}
|
||||
|
||||
/* total size is 0 when writing the overwrite buffer */
|
||||
|
@ -89,7 +89,7 @@ int get_iso_name(Ecma119Image *img, IsoNode *iso, char **name)
|
||||
* only possible if mem error, as check for empty names is done
|
||||
* in public tree
|
||||
*/
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ int create_ecma119_node(Ecma119Image *img, IsoNode *iso, Ecma119Node **node)
|
||||
|
||||
ecma = calloc(1, sizeof(Ecma119Node));
|
||||
if (ecma == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* take a ref to the IsoNode */
|
||||
@ -128,13 +128,13 @@ int create_dir(Ecma119Image *img, IsoDir *iso, Ecma119Node **node)
|
||||
|
||||
children = calloc(1, sizeof(void*) * iso->nchildren);
|
||||
if (children == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
dir_info = calloc(1, sizeof(struct ecma119_dir_info));
|
||||
if (dir_info == NULL) {
|
||||
free(children);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
ret = create_ecma119_node(img, (IsoNode*)iso, node);
|
||||
@ -379,7 +379,7 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
||||
break;
|
||||
default:
|
||||
/* should never happen */
|
||||
return ISO_ERROR;
|
||||
return ISO_ASSERT_FAILURE;
|
||||
}
|
||||
if (ret <= 0) {
|
||||
free(iso_name);
|
||||
@ -568,7 +568,7 @@ int mangle_single_dir(Ecma119Image *img, Ecma119Node *dir, int max_file_len,
|
||||
if (ok) {
|
||||
char *new = strdup(tmp);
|
||||
if (new == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto mangle_cleanup;
|
||||
}
|
||||
iso_msg_debug(img->image->id,
|
||||
@ -677,7 +677,7 @@ int create_placeholder(Ecma119Node *parent, Ecma119Node *real,
|
||||
|
||||
ret = calloc(1, sizeof(Ecma119Node));
|
||||
if (ret == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -688,7 +688,7 @@ int create_placeholder(Ecma119Node *parent, Ecma119Node *real,
|
||||
ret->iso_name = strdup(real->iso_name);
|
||||
if (ret->iso_name == NULL) {
|
||||
free(ret);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* take a ref to the IsoNode */
|
||||
@ -742,7 +742,7 @@ int reparent(Ecma119Node *child, Ecma119Node *parent)
|
||||
|
||||
/* just for debug, this should never happen... */
|
||||
if (i == child->parent->info.dir->nchildren) {
|
||||
return ISO_ERROR;
|
||||
return ISO_ASSERT_FAILURE;
|
||||
}
|
||||
|
||||
/* keep track of the real parent */
|
||||
@ -816,7 +816,7 @@ int ecma119_tree_create(Ecma119Image *img)
|
||||
if (ret <= 0) {
|
||||
if (ret == 0) {
|
||||
/* unexpected error, root ignored!! This can't happen */
|
||||
ret = ISO_ERROR;
|
||||
ret = ISO_ASSERT_FAILURE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ int iso_tree_add_boot_node(IsoDir *parent, const char *name, IsoBoot **boot)
|
||||
|
||||
node = calloc(1, sizeof(IsoBoot));
|
||||
if (node == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
node->node.refcount = 1;
|
||||
@ -136,7 +136,7 @@ int iso_tree_add_boot_node(IsoDir *parent, const char *name, IsoBoot **boot)
|
||||
node->node.name = strdup(name);
|
||||
if (node->node.name == NULL) {
|
||||
free(node);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* atributes from parent */
|
||||
@ -181,7 +181,7 @@ int create_image(IsoImage *image, const char *image_path,
|
||||
return ret;
|
||||
}
|
||||
if (ret == 0) {
|
||||
return ISO_FILE_DOESNT_EXIST;
|
||||
return ISO_NODE_DOESNT_EXIST;
|
||||
}
|
||||
|
||||
if (imgfile->type != LIBISO_FILE) {
|
||||
@ -274,7 +274,7 @@ int create_image(IsoImage *image, const char *image_path,
|
||||
|
||||
boot = calloc(1, sizeof(struct el_torito_boot_image));
|
||||
if (boot == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
boot->image = (IsoFile*)imgfile;
|
||||
iso_node_ref(imgfile); /* get our ref */
|
||||
@ -313,7 +313,7 @@ int iso_image_set_boot_image(IsoImage *image, const char *image_path,
|
||||
char *catdir = NULL, *catname = NULL;
|
||||
catdir = strdup(catalog_path);
|
||||
if (catdir == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* get both the dir and the name */
|
||||
@ -331,7 +331,7 @@ int iso_image_set_boot_image(IsoImage *image, const char *image_path,
|
||||
ret = iso_tree_path_to_node(image, catdir, &p);
|
||||
if (ret <= 0) {
|
||||
free(catdir);
|
||||
return ret < 0 ? ret : ISO_FILE_DOESNT_EXIST;
|
||||
return ret < 0 ? ret : ISO_NODE_DOESNT_EXIST;
|
||||
}
|
||||
if (p->type != LIBISO_DIR) {
|
||||
free(catdir);
|
||||
@ -356,7 +356,7 @@ int iso_image_set_boot_image(IsoImage *image, const char *image_path,
|
||||
/* creates the catalog with the given image */
|
||||
catalog = malloc(sizeof(struct el_torito_boot_catalog));
|
||||
if (catalog == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto boot_image_cleanup;
|
||||
}
|
||||
catalog->image = boot_image;
|
||||
@ -657,12 +657,12 @@ int catalog_stream_new(Ecma119Image *target, IsoStream **stream)
|
||||
|
||||
str = malloc(sizeof(IsoStream));
|
||||
if (str == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
data = malloc(sizeof(struct catalog_stream));
|
||||
if (str == NULL) {
|
||||
free(str);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* fill data */
|
||||
@ -684,7 +684,7 @@ int el_torito_catalog_file_src_create(Ecma119Image *target, IsoFileSrc **src)
|
||||
IsoStream *stream;
|
||||
|
||||
if (target == NULL || src == NULL || target->catalog == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
if (target->cat != NULL) {
|
||||
@ -695,7 +695,7 @@ int el_torito_catalog_file_src_create(Ecma119Image *target, IsoFileSrc **src)
|
||||
|
||||
file = malloc(sizeof(IsoFileSrc));
|
||||
if (file == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
ret = catalog_stream_new(target, &stream);
|
||||
@ -825,7 +825,7 @@ int eltorito_writer_write_data(IsoImageWriter *writer)
|
||||
size = (size_t) iso_stream_get_size(original);
|
||||
buf = malloc(size);
|
||||
if (buf == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
ret = iso_stream_open(original);
|
||||
if (ret < 0) {
|
||||
@ -868,7 +868,7 @@ int eltorito_writer_create(Ecma119Image *target)
|
||||
|
||||
writer = malloc(sizeof(IsoImageWriter));
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
writer->compute_data_blocks = eltorito_writer_compute_data_blocks;
|
||||
|
188
src/error.h
188
src/error.h
@ -9,56 +9,168 @@
|
||||
#define LIBISO_ERROR_H_
|
||||
|
||||
/*
|
||||
* Return values for libisofs functions, mainly error codes
|
||||
* Error codes and return values for libisofs.
|
||||
* TODO #00003 make this header public
|
||||
*/
|
||||
|
||||
/*
|
||||
* error codes are 32 bit numbers, that follow the following conventions:
|
||||
*
|
||||
* 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
|
||||
* = 0x6A -> ERROR
|
||||
* = 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
|
||||
* = 0x7 -> TOP
|
||||
* bits 19-16 -> Reserved for future usage (maybe message ranges)
|
||||
* bits 15-0 -> Error code
|
||||
*/
|
||||
|
||||
#define ISO_ERR_SEV(e) (e & 0x7F000000)
|
||||
#define ISO_ERR_PRIO(e) ((e & 0x00F00000) << 8)
|
||||
#define ISO_ERR_CODE(e) (e & 0x0000FFFF)
|
||||
|
||||
/** successfully execution */
|
||||
#define ISO_SUCCESS 1
|
||||
#define ISO_ERROR -1
|
||||
#define ISO_NULL_POINTER -2
|
||||
#define ISO_OUT_OF_MEM -3
|
||||
#define ISO_MEM_ERROR -4
|
||||
#define ISO_INTERRUPTED -5
|
||||
#define ISO_WRONG_ARG_VALUE -6
|
||||
|
||||
/* canceled by user */
|
||||
#define ISO_ABORT -7
|
||||
/**
|
||||
* special return value, it could be or not an error depending on the
|
||||
* context.
|
||||
*/
|
||||
#define ISO_NONE 0
|
||||
|
||||
#define ISO_WRITE_ERROR -10
|
||||
#define ISO_THREAD_ERROR -11
|
||||
/** Operation canceled (ERROR,TOP, -1) */
|
||||
#define ISO_CANCELED 0xEA70FFFF
|
||||
|
||||
#define ISO_NODE_ALREADY_ADDED -50
|
||||
#define ISO_NODE_NAME_NOT_UNIQUE -51
|
||||
#define ISO_NODE_NOT_ADDED_TO_DIR -52
|
||||
/** Unknown or unexpected fatal error (FATAL,HIGH, -2) */
|
||||
#define ISO_FATAL_ERROR 0xF030FFFE
|
||||
|
||||
#define ISO_FILE_ERROR -100
|
||||
#define ISO_FILE_ALREADY_OPENNED -101
|
||||
#define ISO_FILE_ACCESS_DENIED -102
|
||||
#define ISO_FILE_BAD_PATH -103
|
||||
#define ISO_FILE_DOESNT_EXIST -104
|
||||
#define ISO_FILE_NOT_OPENNED -105
|
||||
#define ISO_FILE_IS_DIR -106
|
||||
#define ISO_FILE_READ_ERROR -107
|
||||
#define ISO_FILE_IS_NOT_DIR -108
|
||||
#define ISO_FILE_IS_NOT_SYMLINK -109
|
||||
#define ISO_FILE_TOO_BIG -110
|
||||
#define ISO_FILE_SEEK_ERROR -111
|
||||
/** Unknown or unexpected error (ERROR,HIGH, -3) */
|
||||
#define ISO_ERROR 0xEA30FFFD
|
||||
|
||||
#define ISO_CHARSET_CONV_ERROR -150
|
||||
/** Internal programming error. Please report this bug (FATAL,HIGH, -4) */
|
||||
#define ISO_ASSERT_FAILURE 0xF030FFFC
|
||||
|
||||
#define ISO_MANGLE_TOO_MUCH_FILES -200
|
||||
/**
|
||||
* NULL pointer as value for an arg. that doesn't allow NULL (ERROR,HIGH, -5)
|
||||
*/
|
||||
#define ISO_NULL_POINTER 0xEA30FFFB
|
||||
|
||||
/* image read errors */
|
||||
#define ISO_WRONG_PVD -300
|
||||
#define ISO_WRONG_RR -301
|
||||
#define ISO_UNSUPPORTED_RR -302
|
||||
#define ISO_WRONG_ECMA119 -303
|
||||
#define ISO_UNSUPPORTED_ECMA119 -304
|
||||
#define ISO_WRONG_EL_TORITO -305
|
||||
/** Memory allocation error (FATAL,HIGH, -6) */
|
||||
#define ISO_OUT_OF_MEM 0xF030FFFA
|
||||
|
||||
/* el-torito errors */
|
||||
#define ISO_IMAGE_ALREADY_BOOTABLE -350
|
||||
#define ISO_BOOT_IMAGE_NOT_VALID -351
|
||||
/** Interrupted by a signal (FATAL,HIGH, -7) */
|
||||
#define ISO_INTERRUPTED 0xF030FFF9
|
||||
|
||||
/** Invalid parameter value (ERROR,HIGH, -8) */
|
||||
#define ISO_WRONG_ARG_VALUE 0xF030FFF8
|
||||
|
||||
/** Can't create a needed thread (FATAL,HIGH, -9) */
|
||||
#define ISO_THREAD_ERROR 0xF030FFF7
|
||||
|
||||
/** Trying to add to a dir a node already added to a dir (ERROR,HIGH, -64) */
|
||||
#define ISO_NODE_ALREADY_ADDED 0xEA30FFC0
|
||||
|
||||
/** Node with same name already exists (ERROR,HIGH, -65) */
|
||||
#define ISO_NODE_NAME_NOT_UNIQUE 0xEA30FFBF
|
||||
|
||||
/** Trying to remove a node that was not added to dir (ERROR,HIGH, -65) */
|
||||
#define ISO_NODE_NOT_ADDED_TO_DIR 0xEA30FFBE
|
||||
|
||||
/** A requested node does not exists (ERROR,HIGH, -66) */
|
||||
#define ISO_NODE_DOESNT_EXIST 0xEA30FFBD
|
||||
|
||||
/** Try to set the boot image of an already bootable image (ERROR,HIGH, -67) */
|
||||
#define ISO_IMAGE_ALREADY_BOOTABLE 0xEA30FFBC
|
||||
|
||||
/** Trying to use an invalid file as boot image (ERROR,HIGH, -68) */
|
||||
#define ISO_BOOT_IMAGE_NOT_VALID 0xEA30FFBB
|
||||
|
||||
/**
|
||||
* Error on file operation (ERROR,HIGH, -128)
|
||||
* (take a look at more specified error codes below)
|
||||
*/
|
||||
#define ISO_FILE_ERROR 0xEA30FF80
|
||||
|
||||
/** Trying to open an already openned file (ERROR,HIGH, -129) */
|
||||
#define ISO_FILE_ALREADY_OPENNED 0xEA30FF7F
|
||||
|
||||
/** Access to file is not allowed (ERROR,HIGH, -130) */
|
||||
#define ISO_FILE_ACCESS_DENIED 0xEA30FF7E
|
||||
|
||||
/** Incorrect path to file (ERROR,HIGH, -131) */
|
||||
#define ISO_FILE_BAD_PATH 0xEA30FF7D
|
||||
|
||||
/** The file does not exists in the filesystem (ERROR,HIGH, -132) */
|
||||
#define ISO_FILE_DOESNT_EXIST 0xEA30FF7C
|
||||
|
||||
/** Trying to read or close a file not openned (ERROR,HIGH, -133) */
|
||||
#define ISO_FILE_NOT_OPENNED 0xEA30FF7B
|
||||
|
||||
/** Directory used where no dir is expected (ERROR,HIGH, -134) */
|
||||
#define ISO_FILE_IS_DIR 0xEA30FF7A
|
||||
|
||||
/** Read error (ERROR,HIGH, -135) */
|
||||
#define ISO_FILE_READ_ERROR 0xEA30FF79
|
||||
|
||||
/** Not dir used where a dir is expected (ERROR,HIGH, -136) */
|
||||
#define ISO_FILE_IS_NOT_DIR 0xEA30FF78
|
||||
|
||||
/** Not symlink used where a symlink is expected (ERROR,HIGH, -137) */
|
||||
#define ISO_FILE_IS_NOT_SYMLINK 0xEA30FF77
|
||||
|
||||
/** Can't seek to specified location (ERROR,HIGH, -138) */
|
||||
#define ISO_FILE_SEEK_ERROR 0xEA30FF76
|
||||
|
||||
/* will be a NOTE message */
|
||||
/* #define ISO_FILE_TOO_BIG -139 */
|
||||
|
||||
/** Charset conversion error (ERROR,HIGH, -256) */
|
||||
#define ISO_CHARSET_CONV_ERROR 0xEA30FF00
|
||||
|
||||
/**
|
||||
* Too much files to mangle, i.e. we cannot guarantee unique file names
|
||||
* (ERROR,HIGH, -257)
|
||||
*/
|
||||
#define ISO_MANGLE_TOO_MUCH_FILES 0xEA30FEFF
|
||||
|
||||
/* image related errors */
|
||||
|
||||
/**
|
||||
* Wrong or damaged Primary Volume Descriptor (ERROR,HIGH, -320)
|
||||
* This could mean that the file is not a valid ISO image.
|
||||
*/
|
||||
#define ISO_WRONG_PVD 0xEA30FEC0
|
||||
|
||||
/** Wrong or damaged RR entry (SORRY,HIGH, -321) */
|
||||
#define ISO_WRONG_RR 0xE030FEBF
|
||||
|
||||
/** Unsupported RR feature (SORRY,HIGH, -322) */
|
||||
#define ISO_UNSUPPORTED_RR 0xE030FEBE
|
||||
|
||||
/** Wrong or damaged ECMA-119 (ERROR,HIGH, -323) */
|
||||
#define ISO_WRONG_ECMA119 0xEA30FEBD
|
||||
|
||||
/** Unsupported ECMA-119 feature (ERROR,HIGH, -324) */
|
||||
#define ISO_UNSUPPORTED_ECMA119 0xEA30FEBC
|
||||
|
||||
/** Wrong or damaged El-Torito catalog (SORRY,HIGH, -325) */
|
||||
#define ISO_WRONG_EL_TORITO 0xEA30FEBB
|
||||
|
||||
/** Unsupported El-Torito feature (SORRY,HIGH, -326) */
|
||||
#define ISO_UNSUPPORTED_EL_TORITO 0xEA30FEBA
|
||||
|
||||
#endif /*LIBISO_ERROR_H_*/
|
||||
|
@ -63,7 +63,7 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
||||
|
||||
fsrc = malloc(sizeof(IsoFileSrc));
|
||||
if (fsrc == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* fill key and other atts */
|
||||
@ -149,7 +149,7 @@ int filesrc_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
int (*inc_item)(void *);
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
t = writer->target;
|
||||
@ -164,7 +164,7 @@ int filesrc_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
/* store the filesrcs in a array */
|
||||
filelist = (IsoFileSrc**)iso_rbtree_to_array(t->files, inc_item, &size);
|
||||
if (filelist == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* sort files by weight, if needed */
|
||||
@ -247,7 +247,7 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
||||
char buffer[BLOCK_SIZE];
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
t = writer->target;
|
||||
@ -344,7 +344,7 @@ int iso_file_src_writer_create(Ecma119Image *target)
|
||||
|
||||
writer = malloc(sizeof(IsoImageWriter));
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
writer->compute_data_blocks = filesrc_writer_compute_data_blocks;
|
||||
|
@ -253,7 +253,7 @@ int ifs_stat(IsoFileSource *src, struct stat *info)
|
||||
data = (ImageFileSourceData*)src->data;
|
||||
|
||||
if (S_ISLNK(data->info.st_mode)) {
|
||||
/* TODO #00012 : support follow symlinks on imafe filesystem */
|
||||
/* TODO #00012 : support follow symlinks on image filesystem */
|
||||
return ISO_FILE_BAD_PATH;
|
||||
}
|
||||
*info = data->info;
|
||||
@ -364,7 +364,7 @@ int read_dir(ImageFileSourceData *data)
|
||||
node = malloc(sizeof(struct child_list));
|
||||
if (node == NULL) {
|
||||
iso_file_source_unref(child);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
/*
|
||||
* Note that we insert in reverse order. This leads to faster
|
||||
@ -429,7 +429,7 @@ int ifs_open(IsoFileSource *src)
|
||||
}
|
||||
data->data.content = malloc(BLOCK_SIZE);
|
||||
if (data->data.content == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
data->data.offset = 0;
|
||||
data->opened = 1;
|
||||
@ -492,7 +492,7 @@ int ifs_close(IsoFileSource *src)
|
||||
* ISO_NULL_POINTER
|
||||
* ISO_FILE_NOT_OPENNED
|
||||
* ISO_FILE_IS_DIR
|
||||
* ISO_MEM_ERROR
|
||||
* ISO_OUT_OF_MEM
|
||||
* ISO_INTERRUPTED
|
||||
*/
|
||||
static
|
||||
@ -607,7 +607,7 @@ int ifs_readdir(IsoFileSource *src, IsoFileSource **child)
|
||||
* ISO_NULL_POINTER
|
||||
* ISO_WRONG_ARG_VALUE -> if bufsiz <= 0
|
||||
* ISO_FILE_IS_NOT_SYMLINK
|
||||
* ISO_MEM_ERROR
|
||||
* ISO_OUT_OF_MEM
|
||||
* ISO_FILE_BAD_PATH
|
||||
* ISO_FILE_DOESNT_EXIST
|
||||
*
|
||||
@ -818,7 +818,7 @@ int iso_file_source_new_ifs(IsoImageFilesystem *fs, IsoFileSource *parent,
|
||||
iter = susp_iter_new(fsdata->src, record, fsdata->len_skp,
|
||||
fsdata->msgid);
|
||||
if (iter == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
while ((ret = susp_iter_next(iter, &sue)) > 0) {
|
||||
@ -1123,12 +1123,12 @@ int iso_file_source_new_ifs(IsoImageFilesystem *fs, IsoFileSource *parent,
|
||||
/* ok, we can now create the file source */
|
||||
ifsdata = calloc(1, sizeof(ImageFileSourceData));
|
||||
if (ifsdata == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto ifs_cleanup;
|
||||
}
|
||||
ifsrc = calloc(1, sizeof(IsoFileSource));
|
||||
if (ifsrc == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto ifs_cleanup;
|
||||
}
|
||||
|
||||
@ -1268,7 +1268,7 @@ int ifs_get_by_path(IsoFilesystem *fs, const char *path, IsoFileSource **file)
|
||||
ptr = strdup(path);
|
||||
if (ptr == NULL) {
|
||||
iso_file_source_unref(src);
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto get_path_exit;
|
||||
}
|
||||
|
||||
@ -1415,7 +1415,7 @@ int read_root_susp_entries(_ImageFsData *data, uint32_t block)
|
||||
|
||||
iter = susp_iter_new(data->src, record, data->len_skp, data->msgid);
|
||||
if (iter == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* first entry must be an SP system use entry */
|
||||
@ -1597,7 +1597,7 @@ int read_el_torito_boot_catalog(_ImageFsData *data, uint32_t block)
|
||||
iso_msg_hint(data->msgid, LIBISO_EL_TORITO_UNHANLED,
|
||||
"Unsupported El-Torito platform. Only 80x86 is "
|
||||
"supported. El-Torito info will be ignored.");
|
||||
return ISO_WRONG_EL_TORITO;
|
||||
return ISO_UNSUPPORTED_EL_TORITO;
|
||||
}
|
||||
|
||||
/* ok, once we are here we assume it is a valid catalog */
|
||||
@ -1633,13 +1633,13 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
||||
|
||||
data = calloc(1, sizeof(_ImageFsData));
|
||||
if (data == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
ifs = calloc(1, sizeof(IsoImageFilesystem));
|
||||
if (ifs == NULL) {
|
||||
free(data);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* get our ref to IsoDataSource */
|
||||
@ -1659,7 +1659,7 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
||||
setlocale(LC_CTYPE, "");
|
||||
data->local_charset = strdup(nl_langinfo(CODESET));
|
||||
if (data->local_charset == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto fs_cleanup;
|
||||
}
|
||||
|
||||
@ -1819,7 +1819,7 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
||||
}
|
||||
}
|
||||
if (data->input_charset == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto fs_cleanup;
|
||||
}
|
||||
|
||||
@ -1879,7 +1879,7 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
* a regular file */
|
||||
new = calloc(1, sizeof(IsoBoot));
|
||||
if (new == NULL) {
|
||||
result = ISO_MEM_ERROR;
|
||||
result = ISO_OUT_OF_MEM;
|
||||
free(name);
|
||||
return result;
|
||||
}
|
||||
@ -1904,7 +1904,7 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
if (file == NULL) {
|
||||
free(name);
|
||||
iso_stream_unref(stream);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* the msblock is taken from the image */
|
||||
@ -1941,7 +1941,7 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
new = calloc(1, sizeof(IsoDir));
|
||||
if (new == NULL) {
|
||||
free(name);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
new->type = LIBISO_DIR;
|
||||
new->refcount = 0;
|
||||
@ -1961,7 +1961,7 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
link = malloc(sizeof(IsoSymlink));
|
||||
if (link == NULL) {
|
||||
free(name);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
link->dest = strdup(dest);
|
||||
link->node.type = LIBISO_SYMLINK;
|
||||
@ -1979,7 +1979,7 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
special = malloc(sizeof(IsoSpecial));
|
||||
if (special == NULL) {
|
||||
free(name);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
special->dev = info.st_rdev;
|
||||
special->node.type = LIBISO_SPECIAL;
|
||||
@ -2023,7 +2023,7 @@ int iso_image_builder_new(IsoNodeBuilder *old, IsoNodeBuilder **builder)
|
||||
|
||||
b = malloc(sizeof(IsoNodeBuilder));
|
||||
if (b == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
b->refcount = 1;
|
||||
@ -2077,12 +2077,12 @@ int create_boot_img_filesrc(IsoImageFilesystem *fs, IsoFileSource **src)
|
||||
/* ok, we can now create the file source */
|
||||
ifsdata = calloc(1, sizeof(ImageFileSourceData));
|
||||
if (ifsdata == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto boot_fs_cleanup;
|
||||
}
|
||||
ifsrc = calloc(1, sizeof(IsoFileSource));
|
||||
if (ifsrc == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto boot_fs_cleanup;
|
||||
}
|
||||
|
||||
@ -2178,7 +2178,7 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
||||
|
||||
boot_image = calloc(1, sizeof(ElToritoBootImage));
|
||||
if (boot_image == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto import_revert;
|
||||
}
|
||||
boot_image->bootable = data->bootable;
|
||||
@ -2189,7 +2189,7 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
||||
|
||||
catalog = calloc(1, sizeof(struct el_torito_boot_catalog));
|
||||
if (catalog == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto import_revert;
|
||||
}
|
||||
catalog->image = boot_image;
|
||||
@ -2225,7 +2225,7 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
||||
if (image->bootcat->node == NULL) {
|
||||
IsoNode *node = calloc(1, sizeof(IsoBoot));
|
||||
if (node == NULL) {
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
goto import_revert;
|
||||
}
|
||||
node->mode = S_IFREG;
|
||||
|
@ -105,7 +105,7 @@ int lfs_lstat(IsoFileSource *src, struct stat *info)
|
||||
break;
|
||||
case EFAULT:
|
||||
case ENOMEM:
|
||||
err = ISO_MEM_ERROR;
|
||||
err = ISO_OUT_OF_MEM;
|
||||
break;
|
||||
default:
|
||||
err = ISO_FILE_ERROR;
|
||||
@ -147,7 +147,7 @@ int lfs_stat(IsoFileSource *src, struct stat *info)
|
||||
break;
|
||||
case EFAULT:
|
||||
case ENOMEM:
|
||||
err = ISO_MEM_ERROR;
|
||||
err = ISO_OUT_OF_MEM;
|
||||
break;
|
||||
default:
|
||||
err = ISO_FILE_ERROR;
|
||||
@ -221,7 +221,7 @@ int lfs_open(IsoFileSource *src)
|
||||
break;
|
||||
case EFAULT:
|
||||
case ENOMEM:
|
||||
err = ISO_MEM_ERROR;
|
||||
err = ISO_OUT_OF_MEM;
|
||||
break;
|
||||
default:
|
||||
err = ISO_FILE_ERROR;
|
||||
@ -286,7 +286,7 @@ int lfs_read(IsoFileSource *src, void *buf, size_t count)
|
||||
ret = ISO_INTERRUPTED;
|
||||
break;
|
||||
case EFAULT:
|
||||
ret = ISO_MEM_ERROR;
|
||||
ret = ISO_OUT_OF_MEM;
|
||||
break;
|
||||
case EIO:
|
||||
ret = ISO_FILE_READ_ERROR;
|
||||
@ -385,7 +385,7 @@ int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||
return ISO_FILE_IS_NOT_SYMLINK;
|
||||
case EFAULT:
|
||||
case ENOMEM:
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
default:
|
||||
return ISO_FILE_ERROR;
|
||||
}
|
||||
@ -454,7 +454,7 @@ int iso_file_source_new_lfs(IsoFileSource *parent, const char *name,
|
||||
|
||||
if (lfs == NULL) {
|
||||
/* this should never happen */
|
||||
return ISO_ERROR;
|
||||
return ISO_ASSERT_FAILURE;
|
||||
}
|
||||
|
||||
/* allocate memory */
|
||||
@ -532,7 +532,7 @@ int lfs_get_by_path(IsoFilesystem *fs, const char *path, IsoFileSource **file)
|
||||
break;
|
||||
case EFAULT:
|
||||
case ENOMEM:
|
||||
err = ISO_MEM_ERROR;
|
||||
err = ISO_OUT_OF_MEM;
|
||||
break;
|
||||
default:
|
||||
err = ISO_FILE_ERROR;
|
||||
@ -555,7 +555,7 @@ int lfs_get_by_path(IsoFilesystem *fs, const char *path, IsoFileSource **file)
|
||||
ptr = strdup(path);
|
||||
if (ptr == NULL) {
|
||||
iso_file_source_unref(src);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
component = strtok_r(ptr, "/", &brk_info);
|
||||
|
@ -39,14 +39,14 @@ int iso_image_new(const char *name, IsoImage **image)
|
||||
|
||||
img = calloc(1, sizeof(IsoImage));
|
||||
if (img == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* local filesystem will be used by default */
|
||||
res = iso_local_filesystem_new(&(img->fs));
|
||||
if (res < 0) {
|
||||
free(img);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* use basic builder as default */
|
||||
@ -54,7 +54,7 @@ int iso_image_new(const char *name, IsoImage **image)
|
||||
if (res < 0) {
|
||||
iso_filesystem_unref(img->fs);
|
||||
free(img);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
/* fill image fields */
|
||||
|
@ -83,7 +83,7 @@ int create_node(Ecma119Image *t, IsoNode *iso, Iso1999Node **node)
|
||||
|
||||
n = calloc(1, sizeof(Iso1999Node));
|
||||
if (n == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
if (iso->type == LIBISO_DIR) {
|
||||
@ -91,13 +91,13 @@ int create_node(Ecma119Image *t, IsoNode *iso, Iso1999Node **node)
|
||||
n->info.dir = calloc(1, sizeof(struct iso1999_dir_info));
|
||||
if (n->info.dir == NULL) {
|
||||
free(n);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
n->info.dir->children = calloc(sizeof(void*), dir->nchildren);
|
||||
if (n->info.dir->children == NULL) {
|
||||
free(n->info.dir);
|
||||
free(n);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
n->type = ISO1999_DIR;
|
||||
} else if (iso->type == LIBISO_FILE) {
|
||||
@ -136,7 +136,7 @@ int create_node(Ecma119Image *t, IsoNode *iso, Iso1999Node **node)
|
||||
} else {
|
||||
/* should never happen */
|
||||
free(n);
|
||||
return ISO_ERROR;
|
||||
return ISO_ASSERT_FAILURE;
|
||||
}
|
||||
|
||||
/* take a ref to the IsoNode */
|
||||
@ -232,7 +232,7 @@ int create_tree(Ecma119Image *t, IsoNode *iso, Iso1999Node **tree, int pathlen)
|
||||
break;
|
||||
default:
|
||||
/* should never happen */
|
||||
return ISO_ERROR;
|
||||
return ISO_ASSERT_FAILURE;
|
||||
}
|
||||
if (ret <= 0) {
|
||||
free(iso_name);
|
||||
@ -289,7 +289,7 @@ int iso1999_tree_create(Ecma119Image *t)
|
||||
if (ret <= 0) {
|
||||
if (ret == 0) {
|
||||
/* unexpected error, root ignored!! This can't happen */
|
||||
ret = ISO_ERROR;
|
||||
ret = ISO_ASSERT_FAILURE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -406,7 +406,7 @@ int iso1999_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
uint32_t path_table_size;
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
t = writer->target;
|
||||
@ -504,7 +504,7 @@ int iso1999_writer_write_vol_desc(IsoImageWriter *writer)
|
||||
char *biblio_file_id = NULL;
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
t = writer->target;
|
||||
@ -708,7 +708,7 @@ int write_path_tables(Ecma119Image *t)
|
||||
/* allocate temporal pathlist */
|
||||
pathlist = malloc(sizeof(void*) * t->iso1999_ndirs);
|
||||
if (pathlist == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
pathlist[0] = t->iso1999_root;
|
||||
cur = 1;
|
||||
@ -776,7 +776,7 @@ int iso1999_writer_create(Ecma119Image *target)
|
||||
|
||||
writer = malloc(sizeof(IsoImageWriter));
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
writer->compute_data_blocks = iso1999_writer_compute_data_blocks;
|
||||
|
22
src/joliet.c
22
src/joliet.c
@ -51,7 +51,7 @@ int get_joliet_name(Ecma119Image *t, IsoNode *iso, uint16_t **name)
|
||||
* only possible if mem error, as check for empty names is done
|
||||
* in public tree
|
||||
*/
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ int create_node(Ecma119Image *t, IsoNode *iso, JolietNode **node)
|
||||
|
||||
joliet = calloc(1, sizeof(JolietNode));
|
||||
if (joliet == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
if (iso->type == LIBISO_DIR) {
|
||||
@ -95,13 +95,13 @@ int create_node(Ecma119Image *t, IsoNode *iso, JolietNode **node)
|
||||
joliet->info.dir = calloc(1, sizeof(struct joliet_dir_info));
|
||||
if (joliet->info.dir == NULL) {
|
||||
free(joliet);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
joliet->info.dir->children = calloc(sizeof(void*), dir->nchildren);
|
||||
if (joliet->info.dir->children == NULL) {
|
||||
free(joliet->info.dir);
|
||||
free(joliet);
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
joliet->type = JOLIET_DIR;
|
||||
} else if (iso->type == LIBISO_FILE) {
|
||||
@ -140,7 +140,7 @@ int create_node(Ecma119Image *t, IsoNode *iso, JolietNode **node)
|
||||
} else {
|
||||
/* should never happen */
|
||||
free(joliet);
|
||||
return ISO_ERROR;
|
||||
return ISO_ASSERT_FAILURE;
|
||||
}
|
||||
|
||||
/* take a ref to the IsoNode */
|
||||
@ -242,7 +242,7 @@ int create_tree(Ecma119Image *t, IsoNode *iso, JolietNode **tree, int pathlen)
|
||||
break;
|
||||
default:
|
||||
/* should never happen */
|
||||
return ISO_ERROR;
|
||||
return ISO_ASSERT_FAILURE;
|
||||
}
|
||||
if (ret <= 0) {
|
||||
free(jname);
|
||||
@ -289,7 +289,7 @@ int joliet_tree_create(Ecma119Image *t)
|
||||
if (ret <= 0) {
|
||||
if (ret == 0) {
|
||||
/* unexpected error, root ignored!! This can't happen */
|
||||
ret = ISO_ERROR;
|
||||
ret = ISO_ASSERT_FAILURE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -409,7 +409,7 @@ int joliet_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
uint32_t path_table_size;
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
t = writer->target;
|
||||
@ -539,7 +539,7 @@ int joliet_writer_write_vol_desc(IsoImageWriter *writer)
|
||||
uint16_t *biblio_file_id = NULL;
|
||||
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
t = writer->target;
|
||||
@ -747,7 +747,7 @@ int write_path_tables(Ecma119Image *t)
|
||||
/* allocate temporal pathlist */
|
||||
pathlist = malloc(sizeof(void*) * t->joliet_ndirs);
|
||||
if (pathlist == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
pathlist[0] = t->joliet_root;
|
||||
cur = 1;
|
||||
@ -815,7 +815,7 @@ int joliet_writer_create(Ecma119Image *target)
|
||||
|
||||
writer = malloc(sizeof(IsoImageWriter));
|
||||
if (writer == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
writer->compute_data_blocks = joliet_writer_compute_data_blocks;
|
||||
|
@ -145,6 +145,11 @@ struct libiso_msgs_item;
|
||||
*/
|
||||
#define LIBISO_MSGS_SEV_SORRY 0x60000000
|
||||
|
||||
/** error messages indicating that the operation has failed, but you can
|
||||
still continue using the library and even retry the operation
|
||||
*/
|
||||
#define LIBISO_MSGS_SEV_ERROR 0x6A000000
|
||||
|
||||
/** An error message which puts the whole operation of the program in question
|
||||
*/
|
||||
#define LIBISO_MSGS_SEV_FATAL 0x70000000
|
||||
@ -167,7 +172,7 @@ struct libiso_msgs_item;
|
||||
#define LIBISO_MSGS_PRIO_LOW 0x10000000
|
||||
#define LIBISO_MSGS_PRIO_MEDIUM 0x20000000
|
||||
#define LIBISO_MSGS_PRIO_HIGH 0x30000000
|
||||
#define LIBISO_MSGS_PRIO_TOP 0x7ffffffe
|
||||
#define LIBISO_MSGS_PRIO_TOP 0x70000000
|
||||
|
||||
/* Do not use this priority for submitting */
|
||||
#define LIBISO_MSGS_PRIO_NEVER 0x7fffffff
|
||||
|
@ -24,7 +24,7 @@ int iso_init()
|
||||
{
|
||||
if (libiso_msgr == NULL) {
|
||||
if (libiso_msgs_new(&libiso_msgr, 0) <= 0)
|
||||
|