summaryrefslogtreecommitdiff
path: root/include/data_writer.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-30 16:41:21 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-30 16:41:21 +0200
commitf439b20706ade4b5630c3d6c57e6a36ce0dc287a (patch)
tree210abf39ac29d7cf7513f667f63495ef1fd43700 /include/data_writer.h
parent3e920038ecd8cc123b0c8dd957f94a8e1a616c0c (diff)
Add support for repacking condensed sparse files
This commit broadly does the following things: - Rename and move the sparse mapping structure to libutil - Add a function to the data writer for writing condensed versions of sparse files, given the mapping. - This shares code with the already existing function for regular files. The shared code is moved to a common helper function. - Add support to tar2sqfs for repacking sparse files. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/data_writer.h')
-rw-r--r--include/data_writer.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/data_writer.h b/include/data_writer.h
index cafe61e..2ace899 100644
--- a/include/data_writer.h
+++ b/include/data_writer.h
@@ -5,6 +5,7 @@
#include "squashfs.h"
#include "compress.h"
#include "fstree.h"
+#include "util.h"
typedef struct data_writer_t data_writer_t;
@@ -42,8 +43,21 @@ int data_writer_flush_fragments(data_writer_t *data);
The file_info_t object is updated accordingly and used to determine the
number of bytes to write and the input file name to report errors.
+ Blocks or fragments that are all zero bytes automatically detected,
+ not written out and the sparse file accounting updated accordingly.
+
Returns 0 on success, prints errors to stderr.
*/
int write_data_from_fd(data_writer_t *data, file_info_t *fi, int infd);
+/*
+ Does the same as write_data_from_fd but the input file is the condensed
+ representation of a sparse file. The layout must be in order and
+ non-overlapping.
+
+ Returns 0 on success, prints errors to stderr.
+ */
+int write_data_from_fd_condensed(data_writer_t *data, file_info_t *fi,
+ int infd, sparse_map_t *map);
+
#endif /* DATA_WRITER_H */