summaryrefslogtreecommitdiffstats
path: root/libsparse/include/sparse
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2012-05-24 17:15:43 -0700
committerColin Cross <ccross@android.com>2012-07-09 22:09:37 -0700
commit317a09e2d47257df5e0972c85f14c2a6ffdbbfd2 (patch)
tree1d16d24323042aa16d0994c05de22e2e043f6668 /libsparse/include/sparse
parentbdc6d39ed6c09199a5d806f29b71b44cbb27c5c2 (diff)
downloadsystem_core-317a09e2d47257df5e0972c85f14c2a6ffdbbfd2.zip
system_core-317a09e2d47257df5e0972c85f14c2a6ffdbbfd2.tar.gz
system_core-317a09e2d47257df5e0972c85f14c2a6ffdbbfd2.tar.bz2
libsparse: add sparse_file_len
Add sparse_file_len, which will compute the size of data that would be produced if sparse_file_write was called. Useful combined with sparse_file_callback. Change-Id: I1a156d1071760f5559483954a5c62ffc20298703
Diffstat (limited to 'libsparse/include/sparse')
-rw-r--r--libsparse/include/sparse/sparse.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libsparse/include/sparse/sparse.h b/libsparse/include/sparse/sparse.h
index fe003f6..17d085c 100644
--- a/libsparse/include/sparse/sparse.h
+++ b/libsparse/include/sparse/sparse.h
@@ -158,6 +158,20 @@ int sparse_file_write(struct sparse_file *s, int fd, bool gz, bool sparse,
bool crc);
/**
+ * sparse_file_len - return the length of a sparse file if written to disk
+ *
+ * @s - sparse file cookie
+ * @sparse - write in the Android sparse file format
+ * @crc - append a crc chunk
+ *
+ * Returns the size a sparse file would be on disk if it were written in the
+ * specified format. If sparse is true, this is the size of the data in the
+ * sparse format. If sparse is false, this is the size of the normal
+ * non-sparse file.
+ */
+int64_t sparse_file_len(struct sparse_file *s, bool sparse, bool crc);
+
+/**
* sparse_file_callback - call a callback for blocks in sparse file
*
* @s - sparse file cookie