summaryrefslogtreecommitdiffstats
path: root/libsparse/include/sparse
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2012-05-02 15:18:22 -0700
committerColin Cross <ccross@android.com>2012-07-09 22:09:37 -0700
commitbdc6d39ed6c09199a5d806f29b71b44cbb27c5c2 (patch)
tree63fb3d31d9afc8ccc9c5a6ec96ddfcadb6a96f69 /libsparse/include/sparse
parent1e17b313a6257b7b5081e178e81435c09d60378e (diff)
downloadsystem_core-bdc6d39ed6c09199a5d806f29b71b44cbb27c5c2.zip
system_core-bdc6d39ed6c09199a5d806f29b71b44cbb27c5c2.tar.gz
system_core-bdc6d39ed6c09199a5d806f29b71b44cbb27c5c2.tar.bz2
libsparse: add function to resparse a file and a utility to use it
Add sparse_file_repsarse, which splits chunks in an existing sparse file such that the maximum size of a chunk, plus a header and footer, is smaller than the given size. This will allow multiple smaller sparse files to result in the same data as a large sparse file. Change-Id: I177abdb958a23d5afd394ff265c5b0c6a3ff22fa
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 b215227..fe003f6 100644
--- a/libsparse/include/sparse/sparse.h
+++ b/libsparse/include/sparse/sparse.h
@@ -227,6 +227,20 @@ struct sparse_file *sparse_file_import(int fd, bool verbose, bool crc);
*/
struct sparse_file *sparse_file_import_auto(int fd, bool crc);
+/** sparse_file_resparse - rechunk an existing sparse file into smaller files
+ *
+ * @in_s - sparse file cookie of the existing sparse file
+ * @max_len - maximum file size
+ * @out_s - array of sparse file cookies
+ * @out_s_count - size of out_s array
+ *
+ * Splits chunks of an existing sparse file into smaller sparse files such that
+ * each sparse file is less than max_len. Returns the number of sparse_files
+ * that would have been written to out_s if out_s were big enough.
+ */
+int sparse_file_resparse(struct sparse_file *in_s, unsigned int max_len,
+ struct sparse_file **out_s, int out_s_count);
+
/**
* sparse_file_verbose - set a sparse file cookie to print verbose errors
*