From 9ffad2478a04011805132750644eabcb7f0c0e92 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 30 Sep 2019 09:10:44 +0200 Subject: Add flag field to directory writer begin for future expansion Signed-off-by: David Oberhollenzer --- include/sqfs/dir_writer.h | 3 ++- lib/sqfs/dir_writer.c | 5 ++++- lib/sqfshelper/serialize_fstree.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/sqfs/dir_writer.h b/include/sqfs/dir_writer.h index 0679be3..b47628b 100644 --- a/include/sqfs/dir_writer.h +++ b/include/sqfs/dir_writer.h @@ -91,10 +91,11 @@ SQFS_API void sqfs_dir_writer_destroy(sqfs_dir_writer_t *writer); * @memberof sqfs_dir_writer_t * * @param writer A pointer to a directory writer object. + * @param flags A currently unused flag field. Must be set to 0. * * @return Zero on success, a @ref E_SQFS_ERROR value on failure. */ -SQFS_API int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer); +SQFS_API int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer, sqfs_u16 flags); /** * @brief Add add a directory entry. diff --git a/lib/sqfs/dir_writer.c b/lib/sqfs/dir_writer.c index 7c2d30d..5b8f6b1 100644 --- a/lib/sqfs/dir_writer.c +++ b/lib/sqfs/dir_writer.c @@ -105,11 +105,14 @@ void sqfs_dir_writer_destroy(sqfs_dir_writer_t *writer) free(writer); } -int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer) +int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer, sqfs_u16 flags) { sqfs_u32 offset; sqfs_u64 block; + if (flags != 0) + return SQFS_ERROR_UNSUPPORTED; + writer_reset(writer); sqfs_meta_writer_get_position(writer->dm, &block, &offset); diff --git a/lib/sqfshelper/serialize_fstree.c b/lib/sqfshelper/serialize_fstree.c index 54157ac..88305e7 100644 --- a/lib/sqfshelper/serialize_fstree.c +++ b/lib/sqfshelper/serialize_fstree.c @@ -23,7 +23,7 @@ static sqfs_inode_generic_t *write_dir_entries(sqfs_dir_writer_t *dirw, tree_node_t *it; int ret; - if (sqfs_dir_writer_begin(dirw)) + if (sqfs_dir_writer_begin(dirw, 0)) return NULL; for (it = node->data.dir.children; it != NULL; it = it->next) { -- cgit v1.2.3