aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-10 11:20:33 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-10 11:20:33 +0200
commitb57f3fe97074b2a374e52e9fb4920449bcb6b319 (patch)
tree502178243213567d7eab3a66d92d69bf22c71fcd /include
parent744daf0d3d72e71854f8248dbf2bc0b81fe110ec (diff)
Add a way to keep meta data blocks in memory
Instead of writing meta data blocks directly to disk, the writer can now alternatively keep the blocks in memory until explicitly told to write to disk. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/meta_writer.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/meta_writer.h b/include/meta_writer.h
index df0c70c..c10dd16 100644
--- a/include/meta_writer.h
+++ b/include/meta_writer.h
@@ -22,8 +22,11 @@ typedef struct {
typedef struct meta_writer_t meta_writer_t;
/* Create a meta data reader using a given compressor to compress data.
- Internally prints error message to stderr on failure. */
-meta_writer_t *meta_writer_create(int fd, compressor_t *cmp);
+ Internally prints error message to stderr on failure.
+ If keep_in_mem is true, the blocks are collected in memory and must
+ be explicitly flushed to disk using meta_write_write_to_file.
+*/
+meta_writer_t *meta_writer_create(int fd, compressor_t *cmp, bool keep_in_mem);
void meta_writer_destroy(meta_writer_t *m);
@@ -41,6 +44,11 @@ void meta_writer_get_position(const meta_writer_t *m, uint64_t *block_start,
/* Reset all internal state, including the current block start position. */
void meta_writer_reset(meta_writer_t *m);
+/* If created with keep_in_mem true, write the collected blocks to disk.
+ Does not flush the current block. Writes error messages to stderr and
+ returns non-zero on failure. */
+int meta_write_write_to_file(meta_writer_t *m);
+
/*
High level helper function that writes squashfs directory entries to
a meta data writer.