From b01961c0e72ab287520fcd61b47ef8faf141cf3f Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 27 Sep 2019 15:58:27 +0200 Subject: Cleanup: merge data.h into block.h Signed-off-by: David Oberhollenzer --- include/highlevel.h | 1 - include/sqfs/block.h | 31 ++++++++++++++++++++- include/sqfs/data.h | 60 ----------------------------------------- lib/sqfs/Makemodule.am | 2 +- lib/sqfs/comp/internal.h | 2 +- lib/sqfs/data_reader.c | 1 - lib/sqfs/data_writer/internal.h | 1 - lib/sqfs/dir_writer.c | 2 +- lib/sqfs/meta_reader.c | 2 +- lib/sqfs/meta_writer.c | 2 +- lib/sqfs/read_table.c | 2 +- lib/sqfs/write_table.c | 2 +- lib/sqfs/xattr_reader.c | 2 +- mkfs/mkfs.h | 2 +- tar/tar2sqfs.c | 2 +- unpack/rdsquashfs.h | 2 +- 16 files changed, 41 insertions(+), 75 deletions(-) delete mode 100644 include/sqfs/data.h diff --git a/include/highlevel.h b/include/highlevel.h index 77360f0..498cb18 100644 --- a/include/highlevel.h +++ b/include/highlevel.h @@ -12,7 +12,6 @@ #include "sqfs/compress.h" #include "sqfs/id_table.h" #include "sqfs/inode.h" -#include "sqfs/data.h" #include "sqfs/table.h" #include "sqfs/meta_writer.h" #include "sqfs/data_reader.h" diff --git a/include/sqfs/block.h b/include/sqfs/block.h index 15d269d..2a765e0 100644 --- a/include/sqfs/block.h +++ b/include/sqfs/block.h @@ -25,9 +25,38 @@ /** * @file block.h * - * @brief Contains the definition of the @ref sqfs_block_t data structure. + * @brief Contains on-disk data structures for data block management, + * helper macros and the higher level @ref sqfs_block_t structure. */ +#define SQFS_META_BLOCK_SIZE 8192 + +#define SQFS_IS_BLOCK_COMPRESSED(size) (((size) & (1 << 24)) == 0) +#define SQFS_ON_DISK_BLOCK_SIZE(size) ((size) & ((1 << 24) - 1)) +#define SQFS_IS_SPARSE_BLOCK(size) (SQFS_ON_DISK_BLOCK_SIZE(size) == 0) + +/** + * @struct sqfs_fragment_t + * + * @brief Data structure that makes up the fragment table entries. + */ +struct sqfs_fragment_t { + /** + * @brief Location of the fragment block on-disk. + */ + uint64_t start_offset; + + /** + * @brief Size of the fragment block in bytes. + */ + uint32_t size; + + /** + * @brief Unused. Always initialize this to 0. + */ + uint32_t pad0; +}; + /** * @enum E_SQFS_BLK_FLAGS * diff --git a/include/sqfs/data.h b/include/sqfs/data.h deleted file mode 100644 index 70f285f..0000000 --- a/include/sqfs/data.h +++ /dev/null @@ -1,60 +0,0 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ -/* - * data.h - This file is part of libsquashfs - * - * Copyright (C) 2019 David Oberhollenzer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ -#ifndef SQFS_DATA_H -#define SQFS_DATA_H - -#include "sqfs/predef.h" - -/** - * @file data.h - * - * @brief Contains on-disk data structures for data block management - * and helper macros. - */ - -#define SQFS_META_BLOCK_SIZE 8192 - -#define SQFS_IS_BLOCK_COMPRESSED(size) (((size) & (1 << 24)) == 0) -#define SQFS_ON_DISK_BLOCK_SIZE(size) ((size) & ((1 << 24) - 1)) -#define SQFS_IS_SPARSE_BLOCK(size) (SQFS_ON_DISK_BLOCK_SIZE(size) == 0) - -/** - * @struct sqfs_fragment_t - * - * @brief Data structure that makes up the fragment table entries. - */ -struct sqfs_fragment_t { - /** - * @brief Location of the fragment block on-disk. - */ - uint64_t start_offset; - - /** - * @brief Size of the fragment block in bytes. - */ - uint32_t size; - - /** - * @brief Unused. Always initialize this to 0. - */ - uint32_t pad0; -}; - -#endif /* SQFS_DATA_H */ diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am index fe6101a..72e3987 100644 --- a/lib/sqfs/Makemodule.am +++ b/lib/sqfs/Makemodule.am @@ -1,4 +1,4 @@ -LIBSQFS_HEARDS = include/sqfs/data.h include/sqfs/meta_writer.h \ +LIBSQFS_HEARDS = include/sqfs/meta_writer.h \ include/sqfs/meta_reader.h include/sqfs/id_table.h \ include/sqfs/compress.h include/sqfs/data_writer.h \ include/sqfs/super.h include/sqfs/inode.h \ diff --git a/lib/sqfs/comp/internal.h b/lib/sqfs/comp/internal.h index 94b4c8c..fcccd0c 100644 --- a/lib/sqfs/comp/internal.h +++ b/lib/sqfs/comp/internal.h @@ -12,7 +12,7 @@ #include "sqfs/predef.h" #include "sqfs/compress.h" #include "sqfs/error.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "sqfs/io.h" #include "util.h" diff --git a/lib/sqfs/data_reader.c b/lib/sqfs/data_reader.c index d8645d1..862723d 100644 --- a/lib/sqfs/data_reader.c +++ b/lib/sqfs/data_reader.c @@ -13,7 +13,6 @@ #include "sqfs/error.h" #include "sqfs/table.h" #include "sqfs/inode.h" -#include "sqfs/data.h" #include "sqfs/io.h" #include "util.h" diff --git a/lib/sqfs/data_writer/internal.h b/lib/sqfs/data_writer/internal.h index 1aa600b..b1d9d8c 100644 --- a/lib/sqfs/data_writer/internal.h +++ b/lib/sqfs/data_writer/internal.h @@ -15,7 +15,6 @@ #include "sqfs/table.h" #include "sqfs/error.h" #include "sqfs/block.h" -#include "sqfs/data.h" #include "sqfs/io.h" #include "util.h" diff --git a/lib/sqfs/dir_writer.c b/lib/sqfs/dir_writer.c index 4d90c1a..6b38c04 100644 --- a/lib/sqfs/dir_writer.c +++ b/lib/sqfs/dir_writer.c @@ -11,7 +11,7 @@ #include "sqfs/dir_writer.h" #include "sqfs/inode.h" #include "sqfs/error.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "sqfs/dir.h" #include "util.h" diff --git a/lib/sqfs/meta_reader.c b/lib/sqfs/meta_reader.c index 08ac28d..89d698b 100644 --- a/lib/sqfs/meta_reader.c +++ b/lib/sqfs/meta_reader.c @@ -10,7 +10,7 @@ #include "sqfs/meta_reader.h" #include "sqfs/compress.h" #include "sqfs/error.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "sqfs/io.h" #include "util.h" diff --git a/lib/sqfs/meta_writer.c b/lib/sqfs/meta_writer.c index 4dd87a5..2edc91a 100644 --- a/lib/sqfs/meta_writer.c +++ b/lib/sqfs/meta_writer.c @@ -10,7 +10,7 @@ #include "sqfs/meta_writer.h" #include "sqfs/compress.h" #include "sqfs/error.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "sqfs/io.h" #include "util.h" diff --git a/lib/sqfs/read_table.c b/lib/sqfs/read_table.c index e5461a4..239607e 100644 --- a/lib/sqfs/read_table.c +++ b/lib/sqfs/read_table.c @@ -10,7 +10,7 @@ #include "sqfs/meta_reader.h" #include "sqfs/error.h" #include "sqfs/table.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "sqfs/io.h" #include "util.h" diff --git a/lib/sqfs/write_table.c b/lib/sqfs/write_table.c index bef576d..5f11769 100644 --- a/lib/sqfs/write_table.c +++ b/lib/sqfs/write_table.c @@ -11,7 +11,7 @@ #include "sqfs/error.h" #include "sqfs/super.h" #include "sqfs/table.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "sqfs/io.h" #include "util.h" diff --git a/lib/sqfs/xattr_reader.c b/lib/sqfs/xattr_reader.c index d0c8800..4164f66 100644 --- a/lib/sqfs/xattr_reader.c +++ b/lib/sqfs/xattr_reader.c @@ -11,7 +11,7 @@ #include "sqfs/super.h" #include "sqfs/xattr.h" #include "sqfs/error.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "sqfs/io.h" #include "util.h" diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h index bbe5572..0e374dc 100644 --- a/mkfs/mkfs.h +++ b/mkfs/mkfs.h @@ -12,7 +12,7 @@ #include "sqfs/meta_writer.h" #include "sqfs/compress.h" #include "sqfs/id_table.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "sqfs/io.h" #include "highlevel.h" diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 2b5d3b2..2eef4dc 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -9,7 +9,7 @@ #include "sqfs/compress.h" #include "sqfs/id_table.h" #include "sqfs/xattr.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "sqfs/io.h" #include "highlevel.h" diff --git a/unpack/rdsquashfs.h b/unpack/rdsquashfs.h index 44a8675..90e94fe 100644 --- a/unpack/rdsquashfs.h +++ b/unpack/rdsquashfs.h @@ -14,7 +14,7 @@ #include "sqfs/compress.h" #include "sqfs/id_table.h" #include "sqfs/xattr.h" -#include "sqfs/data.h" +#include "sqfs/block.h" #include "highlevel.h" #include "fstree.h" -- cgit v1.2.3