From 4d2e87b767d1e025699286783c23926ec5eff857 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 10 Jun 2019 22:55:22 +0200 Subject: Rename table.h to highlevel.h The idea is to move various higher level helper functions there. Signed-off-by: David Oberhollenzer --- include/highlevel.h | 43 +++++++++++++++++++++++++++++++++++++++++++ include/table.h | 42 ------------------------------------------ lib/Makemodule.am | 2 +- lib/sqfs/id_table_read.c | 3 +-- lib/sqfs/id_table_write.c | 3 +-- lib/sqfs/serialize_fstree.c | 2 +- lib/sqfs/table.c | 2 +- mkfs/mkfs.h | 2 +- 8 files changed, 49 insertions(+), 50 deletions(-) create mode 100644 include/highlevel.h delete mode 100644 include/table.h diff --git a/include/highlevel.h b/include/highlevel.h new file mode 100644 index 0000000..e69e337 --- /dev/null +++ b/include/highlevel.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +#ifndef HIGHLEVEL_H +#define HIGHLEVEL_H + +#include "squashfs.h" +#include "compress.h" +#include "id_table.h" +#include "fstree.h" + +#include +#include + +/* + Convenience function for writing meta data to a SquashFS image + + This function internally creates a meta data writer and writes 'count' + blocks of data from 'data' to it, each 'entsize' bytes in size. For each + meta data block, it remembers the 64 bit start address, writes out all + addresses to an uncompressed address list and returns the location where + the address list starts. + + Returns 0 on success. Internally prints error messages to stderr. + */ +int sqfs_write_table(int outfd, sqfs_super_t *super, const void *data, + size_t entsize, size_t count, uint64_t *startblock, + compressor_t *cmp); + +/* + High level helper function to serialize an entire file system tree to + a squashfs inode table and directory table. + + The data is written to the given file descriptor and the super block is + update accordingly (inode and directory table start and total size). + + The function internally creates two meta data writers and uses + meta_writer_write_inode to serialize the inode table of the fstree. + + Returns 0 on success. Prints error messages to stderr on failure. + */ +int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs, + compressor_t *cmp, id_table_t *idtbl); + +#endif /* HIGHLEVEL_H */ diff --git a/include/table.h b/include/table.h deleted file mode 100644 index 57d8654..0000000 --- a/include/table.h +++ /dev/null @@ -1,42 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -#ifndef TABLE_H -#define TABLE_H - -#include "squashfs.h" -#include "compress.h" -#include "fstree.h" - -#include -#include - -/* - Convenience function for writing meta data to a SquashFS image - - This function internally creates a meta data writer and writes 'count' - blocks of data from 'data' to it, each 'entsize' bytes in size. For each - meta data block, it remembers the 64 bit start address, writes out all - addresses to an uncompressed address list and returns the location where - the address list starts. - - Returns 0 on success. Internally prints error messages to stderr. - */ -int sqfs_write_table(int outfd, sqfs_super_t *super, const void *data, - size_t entsize, size_t count, uint64_t *startblock, - compressor_t *cmp); - -/* - High level helper function to serialize an entire file system tree to - a squashfs inode table and directory table. - - The data is written to the given file descriptor and the super block is - update accordingly (inode and directory table start and total size). - - The function internally creates two meta data writers and uses - meta_writer_write_inode to serialize the inode table of the fstree. - - Returns 0 on success. Prints error messages to stderr on failure. - */ -int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs, - compressor_t *cmp, id_table_t *idtbl); - -#endif /* TABLE_H */ diff --git a/lib/Makemodule.am b/lib/Makemodule.am index 618fbf2..ff63a7f 100644 --- a/lib/Makemodule.am +++ b/lib/Makemodule.am @@ -13,7 +13,7 @@ libcompress_a_CPPFLAGS = $(AM_CPPFLAGS) libsquashfs_a_SOURCES = include/meta_writer.h include/squashfs.h libsquashfs_a_SOURCES += lib/sqfs/meta_writer.c lib/sqfs/super.c libsquashfs_a_SOURCES += lib/sqfs/id_table.c include/id_table.h -libsquashfs_a_SOURCES += lib/sqfs/table.c include/table.h +libsquashfs_a_SOURCES += lib/sqfs/table.c include/highlevel.h libsquashfs_a_SOURCES += lib/sqfs/read_super.c lib/sqfs/meta_reader.c libsquashfs_a_SOURCES += include/meta_reader.h lib/sqfs/id_table_write.c libsquashfs_a_SOURCES += lib/sqfs/id_table_read.c lib/sqfs/read_inode.c diff --git a/lib/sqfs/id_table_read.c b/lib/sqfs/id_table_read.c index b1305ff..6e1789d 100644 --- a/lib/sqfs/id_table_read.c +++ b/lib/sqfs/id_table_read.c @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ #include "meta_reader.h" -#include "id_table.h" -#include "table.h" +#include "highlevel.h" #include "util.h" #include diff --git a/lib/sqfs/id_table_write.c b/lib/sqfs/id_table_write.c index 9a5aa48..c11895d 100644 --- a/lib/sqfs/id_table_write.c +++ b/lib/sqfs/id_table_write.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ -#include "id_table.h" -#include "table.h" +#include "highlevel.h" int id_table_write(id_table_t *tbl, int outfd, sqfs_super_t *super, compressor_t *cmp) diff --git a/lib/sqfs/serialize_fstree.c b/lib/sqfs/serialize_fstree.c index 95b9144..44aeca4 100644 --- a/lib/sqfs/serialize_fstree.c +++ b/lib/sqfs/serialize_fstree.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ #include "meta_writer.h" -#include "table.h" +#include "highlevel.h" #include "util.h" #include diff --git a/lib/sqfs/table.c b/lib/sqfs/table.c index 4e0f9d1..abc95bd 100644 --- a/lib/sqfs/table.c +++ b/lib/sqfs/table.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ #include "meta_writer.h" -#include "table.h" +#include "highlevel.h" #include "util.h" #include diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h index 5d16c8b..2bcc8e0 100644 --- a/mkfs/mkfs.h +++ b/mkfs/mkfs.h @@ -3,12 +3,12 @@ #define MKFS_H #include "meta_writer.h" +#include "highlevel.h" #include "squashfs.h" #include "compress.h" #include "id_table.h" #include "fstree.h" #include "config.h" -#include "table.h" #include #include -- cgit v1.2.3