summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-07 01:08:14 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-07 01:08:14 +0200
commit3d9ba1a234d0966de21d8d592bea7b4ffc325586 (patch)
treee53449ca435ec00f0da938d8530f740cffcc1272 /include
parent373ba219aa385678a14f9c17b48ad807858804ce (diff)
Move data structure forward declarations to predef header
This in turn allows for removing most of the header inclusions within the public headers. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/sqfs/block_processor.h9
-rw-r--r--include/sqfs/compress.h6
-rw-r--r--include/sqfs/data.h4
-rw-r--r--include/sqfs/dir.h16
-rw-r--r--include/sqfs/id_table.h3
-rw-r--r--include/sqfs/inode.h50
-rw-r--r--include/sqfs/meta_reader.h4
-rw-r--r--include/sqfs/meta_writer.h5
-rw-r--r--include/sqfs/predef.h28
-rw-r--r--include/sqfs/super.h4
-rw-r--r--include/sqfs/table.h2
-rw-r--r--include/sqfs/xattr.h3
12 files changed, 67 insertions, 67 deletions
diff --git a/include/sqfs/block_processor.h b/include/sqfs/block_processor.h
index b757708..1ec2f7c 100644
--- a/include/sqfs/block_processor.h
+++ b/include/sqfs/block_processor.h
@@ -8,7 +8,6 @@
#define SFQS_BLOCK_PROCESSOR_H
#include "sqfs/predef.h"
-#include "sqfs/compress.h"
enum {
/* only calculate checksum, do NOT compress the data */
@@ -27,9 +26,9 @@ enum {
SQFS_BLK_USER = 0x0080
};
-typedef struct sqfs_block_t {
+struct sqfs_block_t {
/* used internally, ignored and overwritten when enqueueing blocks */
- struct sqfs_block_t *next;
+ sqfs_block_t *next;
uint32_t sequence_number;
/* Size of the data area */
@@ -49,9 +48,7 @@ typedef struct sqfs_block_t {
/* raw data to be processed */
uint8_t data[];
-} sqfs_block_t;
-
-typedef struct sqfs_block_processor_t sqfs_block_processor_t;
+};
/*
Gets called for each processed block. May be called from a different thread
diff --git a/include/sqfs/compress.h b/include/sqfs/compress.h
index 76f323e..f0e3b76 100644
--- a/include/sqfs/compress.h
+++ b/include/sqfs/compress.h
@@ -10,8 +10,6 @@
#include "sqfs/predef.h"
#include "sqfs/super.h"
-typedef struct sqfs_compressor_t sqfs_compressor_t;
-
/* Encapsultes a compressor with a simple interface to compress or
uncompress/extract blocks of data. */
struct sqfs_compressor_t {
@@ -45,7 +43,7 @@ struct sqfs_compressor_t {
sqfs_compressor_t *(*create_copy)(sqfs_compressor_t *cmp);
};
-typedef struct {
+struct sqfs_compressor_config_t {
uint16_t id;
uint16_t flags;
uint32_t block_size;
@@ -69,7 +67,7 @@ typedef struct {
uint32_t dict_size;
} xz;
} opt;
-} sqfs_compressor_config_t;
+};
typedef enum {
SQFS_COMP_FLAG_LZ4_HC = 0x0001,
diff --git a/include/sqfs/data.h b/include/sqfs/data.h
index 914afae..e8efa73 100644
--- a/include/sqfs/data.h
+++ b/include/sqfs/data.h
@@ -15,10 +15,10 @@
#define SQFS_ON_DISK_BLOCK_SIZE(size) ((size) & ((1 << 24) - 1))
#define SQFS_IS_SPARSE_BLOCK(size) (SQFS_ON_DISK_BLOCK_SIZE(size) == 0)
-typedef struct {
+struct sqfs_fragment_t {
uint64_t start_offset;
uint32_t size;
uint32_t pad0;
-} sqfs_fragment_t;
+};
#endif /* SQFS_DATA_H */
diff --git a/include/sqfs/dir.h b/include/sqfs/dir.h
index d993208..0b14cdf 100644
--- a/include/sqfs/dir.h
+++ b/include/sqfs/dir.h
@@ -8,33 +8,29 @@
#define SQFS_DIR_H
#include "sqfs/predef.h"
-#include "sqfs/meta_reader.h"
-#include "sqfs/meta_writer.h"
#define SQFS_MAX_DIR_ENT 256
-typedef struct {
+struct sqfs_dir_header_t {
uint32_t count;
uint32_t start_block;
uint32_t inode_number;
-} sqfs_dir_header_t;
+};
-typedef struct {
+struct sqfs_dir_entry_t {
uint16_t offset;
int16_t inode_diff;
uint16_t type;
uint16_t size;
uint8_t name[];
-} sqfs_dir_entry_t;
+};
-typedef struct {
+struct sqfs_dir_index_t {
uint32_t index;
uint32_t start_block;
uint32_t size;
uint8_t name[];
-} sqfs_dir_index_t;
-
-typedef struct sqfs_dir_writer_t sqfs_dir_writer_t;
+};
#ifdef __cplusplus
extern "C" {
diff --git a/include/sqfs/id_table.h b/include/sqfs/id_table.h
index 01347d9..3610640 100644
--- a/include/sqfs/id_table.h
+++ b/include/sqfs/id_table.h
@@ -8,9 +8,6 @@
#define SQFS_ID_TABLE_H
#include "sqfs/predef.h"
-#include "sqfs/compress.h"
-
-typedef struct sqfs_id_table_t sqfs_id_table_t;
#ifdef __cplusplus
extern "C" {
diff --git a/include/sqfs/inode.h b/include/sqfs/inode.h
index 037a297..3cf1d8c 100644
--- a/include/sqfs/inode.h
+++ b/include/sqfs/inode.h
@@ -8,8 +8,6 @@
#define SQFS_INODE_H
#include "sqfs/predef.h"
-#include "sqfs/meta_reader.h"
-#include "sqfs/meta_writer.h"
typedef enum {
SQFS_INODE_DIR = 1,
@@ -28,57 +26,57 @@ typedef enum {
SQFS_INODE_EXT_SOCKET = 14,
} E_SQFS_INODE_TYPE;
-typedef struct {
+struct sqfs_inode_t {
uint16_t type;
uint16_t mode;
uint16_t uid_idx;
uint16_t gid_idx;
uint32_t mod_time;
uint32_t inode_number;
-} sqfs_inode_t;
+};
-typedef struct {
+struct sqfs_inode_dev_t {
uint32_t nlink;
uint32_t devno;
-} sqfs_inode_dev_t;
+};
-typedef struct {
+struct sqfs_inode_dev_ext_t {
uint32_t nlink;
uint32_t devno;
uint32_t xattr_idx;
-} sqfs_inode_dev_ext_t;
+};
-typedef struct {
+struct sqfs_inode_ipc_t {
uint32_t nlink;
-} sqfs_inode_ipc_t;
+};
-typedef struct {
+struct sqfs_inode_ipc_ext_t {
uint32_t nlink;
uint32_t xattr_idx;
-} sqfs_inode_ipc_ext_t;
+};
-typedef struct {
+struct sqfs_inode_slink_t {
uint32_t nlink;
uint32_t target_size;
/*uint8_t target[];*/
-} sqfs_inode_slink_t;
+};
-typedef struct {
+struct sqfs_inode_slink_ext_t {
uint32_t nlink;
uint32_t target_size;
/*uint8_t target[];*/
uint32_t xattr_idx;
-} sqfs_inode_slink_ext_t;
+};
-typedef struct {
+struct sqfs_inode_file_t {
uint32_t blocks_start;
uint32_t fragment_index;
uint32_t fragment_offset;
uint32_t file_size;
/*uint32_t block_sizes[];*/
-} sqfs_inode_file_t;
+};
-typedef struct {
+struct sqfs_inode_file_ext_t {
uint64_t blocks_start;
uint64_t file_size;
uint64_t sparse;
@@ -87,17 +85,17 @@ typedef struct {
uint32_t fragment_offset;
uint32_t xattr_idx;
/*uint32_t block_sizes[];*/
-} sqfs_inode_file_ext_t;
+};
-typedef struct {
+struct sqfs_inode_dir_t {
uint32_t start_block;
uint32_t nlink;
uint16_t size;
uint16_t offset;
uint32_t parent_inode;
-} sqfs_inode_dir_t;
+};
-typedef struct {
+struct sqfs_inode_dir_ext_t {
uint32_t nlink;
uint32_t size;
uint32_t start_block;
@@ -105,9 +103,9 @@ typedef struct {
uint16_t inodex_count;
uint16_t offset;
uint32_t xattr_idx;
-} sqfs_inode_dir_ext_t;
+};
-typedef struct {
+struct sqfs_inode_generic_t {
sqfs_inode_t base;
char *slink_target;
uint32_t *block_sizes;
@@ -127,7 +125,7 @@ typedef struct {
} data;
uint8_t extra[];
-} sqfs_inode_generic_t;
+};
#ifdef __cplusplus
extern "C" {
diff --git a/include/sqfs/meta_reader.h b/include/sqfs/meta_reader.h
index d587694..eef18b7 100644
--- a/include/sqfs/meta_reader.h
+++ b/include/sqfs/meta_reader.h
@@ -8,10 +8,6 @@
#define SQFS_META_READER_H
#include "sqfs/predef.h"
-#include "sqfs/compress.h"
-#include "sqfs/data.h"
-
-typedef struct sqfs_meta_reader_t sqfs_meta_reader_t;
#ifdef __cplusplus
extern "C" {
diff --git a/include/sqfs/meta_writer.h b/include/sqfs/meta_writer.h
index 55cae7f..669b98e 100644
--- a/include/sqfs/meta_writer.h
+++ b/include/sqfs/meta_writer.h
@@ -8,11 +8,6 @@
#define SQFS_META_WRITER_H
#include "sqfs/predef.h"
-#include "sqfs/compress.h"
-#include "sqfs/id_table.h"
-#include "sqfs/data.h"
-
-typedef struct sqfs_meta_writer_t sqfs_meta_writer_t;
#ifdef __cplusplus
extern "C" {
diff --git a/include/sqfs/predef.h b/include/sqfs/predef.h
index 0fec9e2..6df257c 100644
--- a/include/sqfs/predef.h
+++ b/include/sqfs/predef.h
@@ -38,4 +38,32 @@
#endif
#endif
+typedef struct sqfs_block_t sqfs_block_t;
+typedef struct sqfs_block_processor_t sqfs_block_processor_t;
+typedef struct sqfs_compressor_config_t sqfs_compressor_config_t;
+typedef struct sqfs_compressor_t sqfs_compressor_t;
+typedef struct sqfs_dir_writer_t sqfs_dir_writer_t;
+typedef struct sqfs_id_table_t sqfs_id_table_t;
+typedef struct sqfs_meta_reader_t sqfs_meta_reader_t;
+typedef struct sqfs_meta_writer_t sqfs_meta_writer_t;
+typedef struct sqfs_xattr_reader_t sqfs_xattr_reader_t;
+
+typedef struct sqfs_fragment_t sqfs_fragment_t;
+typedef struct sqfs_dir_header_t sqfs_dir_header_t;
+typedef struct sqfs_dir_entry_t sqfs_dir_entry_t;
+typedef struct sqfs_dir_index_t sqfs_dir_index_t;
+typedef struct sqfs_inode_t sqfs_inode_t;
+typedef struct sqfs_inode_dev_t sqfs_inode_dev_t;
+typedef struct sqfs_inode_dev_ext_t sqfs_inode_dev_ext_t;
+typedef struct sqfs_inode_ipc_t sqfs_inode_ipc_t;
+typedef struct sqfs_inode_ipc_ext_t sqfs_inode_ipc_ext_t;
+typedef struct sqfs_inode_slink_t sqfs_inode_slink_t;
+typedef struct sqfs_inode_slink_ext_t sqfs_inode_slink_ext_t;
+typedef struct sqfs_inode_file_t sqfs_inode_file_t;
+typedef struct sqfs_inode_file_ext_t sqfs_inode_file_ext_t;
+typedef struct sqfs_inode_dir_t sqfs_inode_dir_t;
+typedef struct sqfs_inode_dir_ext_t sqfs_inode_dir_ext_t;
+typedef struct sqfs_inode_generic_t sqfs_inode_generic_t;
+typedef struct sqfs_super_t sqfs_super_t;
+
#endif /* SQFS_PREDEF_H */
diff --git a/include/sqfs/super.h b/include/sqfs/super.h
index 91b1693..b1ce82b 100644
--- a/include/sqfs/super.h
+++ b/include/sqfs/super.h
@@ -15,7 +15,7 @@
#define SQFS_DEVBLK_SIZE 4096
#define SQFS_DEFAULT_BLOCK_SIZE 131072
-typedef struct {
+struct sqfs_super_t {
uint32_t magic;
uint32_t inode_count;
uint32_t modification_time;
@@ -35,7 +35,7 @@ typedef struct {
uint64_t directory_table_start;
uint64_t fragment_table_start;
uint64_t export_table_start;
-} __attribute__((packed)) sqfs_super_t;
+};
typedef enum {
SQFS_COMP_GZIP = 1,
diff --git a/include/sqfs/table.h b/include/sqfs/table.h
index 9ce37fb..70bb437 100644
--- a/include/sqfs/table.h
+++ b/include/sqfs/table.h
@@ -8,8 +8,6 @@
#define SQFS_TABLE_H
#include "sqfs/predef.h"
-#include "sqfs/compress.h"
-#include "sqfs/super.h"
#ifdef __cplusplus
extern "C" {
diff --git a/include/sqfs/xattr.h b/include/sqfs/xattr.h
index 0efd0d4..11976d0 100644
--- a/include/sqfs/xattr.h
+++ b/include/sqfs/xattr.h
@@ -8,7 +8,6 @@
#define SQFS_XATTR_H
#include "sqfs/predef.h"
-#include "sqfs/compress.h"
typedef enum {
SQFS_XATTR_USER = 0,
@@ -42,8 +41,6 @@ typedef struct {
uint32_t unused;
} sqfs_xattr_id_table_t;
-typedef struct sqfs_xattr_reader_t sqfs_xattr_reader_t;
-
#ifdef __cplusplus
extern "C" {
#endif