summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sqfs/error.h25
-rw-r--r--include/sqfs/meta_reader.h10
-rw-r--r--include/sqfs/table.h7
-rw-r--r--include/sqfs/xattr.h10
4 files changed, 41 insertions, 11 deletions
diff --git a/include/sqfs/error.h b/include/sqfs/error.h
new file mode 100644
index 0000000..5bbf26c
--- /dev/null
+++ b/include/sqfs/error.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * error.h
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#ifndef SQFS_ERROR_H
+#define SQFS_ERROR_H
+
+typedef enum {
+ SQFS_ERROR_ALLOC = -1,
+ SQFS_ERROR_IO = -2,
+ SQFS_ERROR_COMRPESSOR = -3,
+ SQFS_ERROR_INTERNAL = -4,
+ SQFS_ERROR_CORRUPTED = -5,
+ SQFS_ERROR_UNSUPPORTED = -6,
+ SQFS_ERROR_OVERFLOW = -7,
+ SQFS_ERROR_OUT_OF_BOUNDS = -8,
+
+ SFQS_ERROR_SUPER_MAGIC = -9,
+ SFQS_ERROR_SUPER_VERSION = -10,
+ SQFS_ERROR_SUPER_BLOCK_SIZE = -11,
+} E_SQFS_ERROR;
+
+#endif /* SQFS_ERROR_H */
diff --git a/include/sqfs/meta_reader.h b/include/sqfs/meta_reader.h
index a529dba..f5008d4 100644
--- a/include/sqfs/meta_reader.h
+++ b/include/sqfs/meta_reader.h
@@ -44,15 +44,15 @@ SQFS_API int sqfs_meta_reader_read_dir_header(sqfs_meta_reader_t *m,
/* Entry can be freed with a single free() call.
The function internally prints to stderr on failure */
-SQFS_API sqfs_dir_entry_t *sqfs_meta_reader_read_dir_ent(sqfs_meta_reader_t *m);
+SQFS_API int sqfs_meta_reader_read_dir_ent(sqfs_meta_reader_t *m,
+ sqfs_dir_entry_t **ent);
/* Inode can be freed with a single free() call.
The function internally prints error message to stderr on failure. */
SQFS_API
-sqfs_inode_generic_t *sqfs_meta_reader_read_inode(sqfs_meta_reader_t *ir,
- sqfs_super_t *super,
- uint64_t block_start,
- size_t offset);
+int sqfs_meta_reader_read_inode(sqfs_meta_reader_t *ir, sqfs_super_t *super,
+ uint64_t block_start, size_t offset,
+ sqfs_inode_generic_t **out);
#ifdef __cplusplus
}
diff --git a/include/sqfs/table.h b/include/sqfs/table.h
index 70bb437..f837f6b 100644
--- a/include/sqfs/table.h
+++ b/include/sqfs/table.h
@@ -29,9 +29,10 @@ SQFS_API int sqfs_write_table(int outfd, sqfs_super_t *super,
const void *data, size_t table_size,
uint64_t *start);
-SQFS_API void *sqfs_read_table(int fd, sqfs_compressor_t *cmp,
- size_t table_size, uint64_t location,
- uint64_t lower_limit, uint64_t upper_limit);
+SQFS_API int sqfs_read_table(int fd, sqfs_compressor_t *cmp,
+ size_t table_size, uint64_t location,
+ uint64_t lower_limit, uint64_t upper_limit,
+ void **out);
#ifdef __cplusplus
}
diff --git a/include/sqfs/xattr.h b/include/sqfs/xattr.h
index 11976d0..0f9cf32 100644
--- a/include/sqfs/xattr.h
+++ b/include/sqfs/xattr.h
@@ -54,6 +54,8 @@ SQFS_API int sqfs_get_xattr_prefix_id(const char *key);
/* Check if a given xattr key can be encoded in squashfs at all. */
SQFS_API bool sqfs_has_xattr(const char *key);
+SQFS_API int sqfs_xattr_reader_load_locations(sqfs_xattr_reader_t *xr);
+
SQFS_API void sqfs_xattr_reader_destroy(sqfs_xattr_reader_t *xr);
SQFS_API sqfs_xattr_reader_t *sqfs_xattr_reader_create(int sqfsfd,
@@ -67,11 +69,13 @@ SQFS_API int sqfs_xattr_reader_seek_kv(sqfs_xattr_reader_t *xr,
const sqfs_xattr_id_t *desc);
SQFS_API
-sqfs_xattr_value_t *sqfs_xattr_reader_read_value(sqfs_xattr_reader_t *xr,
- const sqfs_xattr_entry_t *key);
+int sqfs_xattr_reader_read_value(sqfs_xattr_reader_t *xr,
+ const sqfs_xattr_entry_t *key,
+ sqfs_xattr_value_t **val_out);
SQFS_API
-sqfs_xattr_entry_t *sqfs_xattr_reader_read_key(sqfs_xattr_reader_t *xr);
+int sqfs_xattr_reader_read_key(sqfs_xattr_reader_t *xr,
+ sqfs_xattr_entry_t **key_out);
#ifdef __cplusplus
}