<feed xmlns='http://www.w3.org/2005/Atom'>
<title>system_core/libsparse/include, branch replicant-10</title>
<subtitle>Fork of system/core
</subtitle>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/'/>
<entry>
<title>Revert "libsparse: Add sparse typed callback"</title>
<updated>2018-07-26T05:23:45+00:00</updated>
<author>
<name>Tobias Thierer</name>
<email>tobiast@google.com</email>
</author>
<published>2018-07-26T03:13:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=fca4a9c27950a4a4281de0f413280cff9f4da653'/>
<id>fca4a9c27950a4a4281de0f413280cff9f4da653</id>
<content type='text'>
This reverts commit db69f0d47f3ccb3ff656c56fe2b68aaf5ab853f6.

Reason for revert: Broke the build:

In file included from system/core/libsparse/sparse.cpp:26:
system/core/libsparse/output_file.h:34:72: error: unknown type name 'off64_t'; did you mean 'off_t'?
int (*skip_write)(void*, off64_t), void* priv,
^~~~~~~
off_t
/Applications/Xcode6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/_types/_off_t.h:30:25: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
1 error generated.

Bug: 78793464
Change-Id: I0f8bc4e9aa2f74612bfd8721d00d961e3f7e695f
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit db69f0d47f3ccb3ff656c56fe2b68aaf5ab853f6.

Reason for revert: Broke the build:

In file included from system/core/libsparse/sparse.cpp:26:
system/core/libsparse/output_file.h:34:72: error: unknown type name 'off64_t'; did you mean 'off_t'?
int (*skip_write)(void*, off64_t), void* priv,
^~~~~~~
off_t
/Applications/Xcode6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/_types/_off_t.h:30:25: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
1 error generated.

Bug: 78793464
Change-Id: I0f8bc4e9aa2f74612bfd8721d00d961e3f7e695f
</pre>
</div>
</content>
</entry>
<entry>
<title>libsparse: Add sparse typed callback</title>
<updated>2018-07-25T18:04:03+00:00</updated>
<author>
<name>Jerry Zhang</name>
<email>zhangjerry@google.com</email>
</author>
<published>2018-06-14T23:58:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=db69f0d47f3ccb3ff656c56fe2b68aaf5ab853f6'/>
<id>db69f0d47f3ccb3ff656c56fe2b68aaf5ab853f6</id>
<content type='text'>
Currently, sparse_file_callback uses libsparse's
own logic for reading a file into a buffer. However,
a caller may want to use their own logic for doing
this in order to customize the buffer size and parallelize
the reads/writes. Also, a caller may want to implement
fill blocks with their own logic as well. To do this
add sparse_file_typed_callback which calls a different
callback function depending on the type of the sparse
chunk being written.

Test: Use typed callback for fd writes
Bug: 78793464
Change-Id: I75955a464fc05991f806339830fdfa05fda354b9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, sparse_file_callback uses libsparse's
own logic for reading a file into a buffer. However,
a caller may want to use their own logic for doing
this in order to customize the buffer size and parallelize
the reads/writes. Also, a caller may want to implement
fill blocks with their own logic as well. To do this
add sparse_file_typed_callback which calls a different
callback function depending on the type of the sparse
chunk being written.

Test: Use typed callback for fd writes
Bug: 78793464
Change-Id: I75955a464fc05991f806339830fdfa05fda354b9
</pre>
</div>
</content>
</entry>
<entry>
<title>libsparse: Add method to create sparse file from buffer</title>
<updated>2018-06-07T21:33:18+00:00</updated>
<author>
<name>Jerry Zhang</name>
<email>zhangjerry@google.com</email>
</author>
<published>2018-06-05T18:44:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=50e6029a4e4b9c9bd6065548ced523ec5b01e705'/>
<id>50e6029a4e4b9c9bd6065548ced523ec5b01e705</id>
<content type='text'>
Refactor elements of sparse file parsing that depend on
an fd into SparseFileSource class, then create implementations
using both fd and buffer. Add sparse_file_read_buf which
reads the given buffer into a sparse file cookie without
copying.

Test: flash system with sparse images
Bug: 78793464
Change-Id: Ice6c8e1ff075d6867e070f80fcf5aa4f530a1b95
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Refactor elements of sparse file parsing that depend on
an fd into SparseFileSource class, then create implementations
using both fd and buffer. Add sparse_file_read_buf which
reads the given buffer into a sparse file cookie without
copying.

Test: flash system with sparse images
Bug: 78793464
Change-Id: Ice6c8e1ff075d6867e070f80fcf5aa4f530a1b95
</pre>
</div>
</content>
</entry>
<entry>
<title>libsparse: Use 'size_t' for the 'len' parameter in callbacks.</title>
<updated>2018-04-25T17:29:22+00:00</updated>
<author>
<name>Tao Bao</name>
<email>tbao@google.com</email>
</author>
<published>2018-04-23T22:15:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=e18c03165b3ea86f563e104f44696d5c53f5b6a5'/>
<id>e18c03165b3ea86f563e104f44696d5c53f5b6a5</id>
<content type='text'>
This CL updates the callback function signature in
sparse_file_callback() and sparse_file_foreach_chunk().

Before:
int sparse_file_callback(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(void *priv, const void *data, int len), void *priv);

int sparse_file_foreach_chunk(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(
        void *priv, const void *data, int len, unsigned int block,
        unsigned int nr_blocks),
    void *priv);

After:
int sparse_file_callback(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(void *priv, const void *data, size_t len), void *priv);

int sparse_file_foreach_chunk(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(
        void *priv, const void *data, size_t len, unsigned int block,
        unsigned int nr_blocks),
    void *priv);

The length (i.e. 'len') comes from the size of a chunk, which could be
legitimately larger than INT_MAX. Prior to this CL, callers (e.g.
write_sparse_data_chunk()) were already passing unsigned int to the
callbacks. When a chunk size exceeds INT_MAX, the callback would see a
negative value, which could lead to undesired behavior. For example,
out_counter_write(), as one of the internal callbacks in libsparse,
gives a wrong sum of chunk sizes, which in turn fails the fastboot
flashing when given a huge sparse image.

It also defines SPARSE_CALLBACK_USES_SIZE_T that allows clients to keep
their codes compatibile with both versions.

Bug: 78432315
Test: `m dist` (with matching changes to all the clients)
Test: Build fastboot and successfully flash a previously failing (huge)
      sparse image.
Change-Id: Iac4bcf7b57039d08af3c57f4be00d75f6b693d93
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This CL updates the callback function signature in
sparse_file_callback() and sparse_file_foreach_chunk().

Before:
int sparse_file_callback(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(void *priv, const void *data, int len), void *priv);

int sparse_file_foreach_chunk(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(
        void *priv, const void *data, int len, unsigned int block,
        unsigned int nr_blocks),
    void *priv);

After:
int sparse_file_callback(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(void *priv, const void *data, size_t len), void *priv);

int sparse_file_foreach_chunk(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(
        void *priv, const void *data, size_t len, unsigned int block,
        unsigned int nr_blocks),
    void *priv);

The length (i.e. 'len') comes from the size of a chunk, which could be
legitimately larger than INT_MAX. Prior to this CL, callers (e.g.
write_sparse_data_chunk()) were already passing unsigned int to the
callbacks. When a chunk size exceeds INT_MAX, the callback would see a
negative value, which could lead to undesired behavior. For example,
out_counter_write(), as one of the internal callbacks in libsparse,
gives a wrong sum of chunk sizes, which in turn fails the fastboot
flashing when given a huge sparse image.

It also defines SPARSE_CALLBACK_USES_SIZE_T that allows clients to keep
their codes compatibile with both versions.

Bug: 78432315
Test: `m dist` (with matching changes to all the clients)
Test: Build fastboot and successfully flash a previously failing (huge)
      sparse image.
Change-Id: Iac4bcf7b57039d08af3c57f4be00d75f6b693d93
</pre>
</div>
</content>
</entry>
<entry>
<title>libsparse: add a function to retrieve the data blocks</title>
<updated>2016-12-01T03:16:28+00:00</updated>
<author>
<name>Adrien Schildknecht</name>
<email>adriens@google.com</email>
</author>
<published>2016-11-30T19:49:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=a26a6bd6f36d29cdc959f746b495f79f74c7fad7'/>
<id>a26a6bd6f36d29cdc959f746b495f79f74c7fad7</id>
<content type='text'>
Test: m libsparse

Change-Id: I04bd3912bb4364e591b064ec2aab782cf02f6bd7
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Test: m libsparse

Change-Id: I04bd3912bb4364e591b064ec2aab782cf02f6bd7
</pre>
</div>
</content>
</entry>
<entry>
<title>Add verbose param to sparse_file_import_auto</title>
<updated>2015-03-31T19:09:37+00:00</updated>
<author>
<name>Mohamad Ayyash</name>
<email>mkayyash@google.com</email>
</author>
<published>2015-03-31T19:09:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=80cc1f6864288f166b786a61ad57f12081114225'/>
<id>80cc1f6864288f166b786a61ad57f12081114225</id>
<content type='text'>
Change-Id: I0c5607f7aa5e964abc2031bbe71ff5c6e6ef56cc
Signed-off-by: Mohamad Ayyash &lt;mkayyash@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I0c5607f7aa5e964abc2031bbe71ff5c6e6ef56cc
Signed-off-by: Mohamad Ayyash &lt;mkayyash@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libsparse: allow including from C++</title>
<updated>2014-04-18T21:22:22+00:00</updated>
<author>
<name>Colin Cross</name>
<email>ccross@android.com</email>
</author>
<published>2014-04-18T20:54:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=099824cce31853a0680723e70151d866416a5c78'/>
<id>099824cce31853a0680723e70151d866416a5c78</id>
<content type='text'>
Change-Id: I3788fd07e2b52430a410f85fb79dc886c6a07fea
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I3788fd07e2b52430a410f85fb79dc886c6a07fea
</pre>
</div>
</content>
</entry>
<entry>
<title>libsparse: add sparse_file_len</title>
<updated>2012-07-10T05:09:37+00:00</updated>
<author>
<name>Colin Cross</name>
<email>ccross@android.com</email>
</author>
<published>2012-05-25T00:15:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=317a09e2d47257df5e0972c85f14c2a6ffdbbfd2'/>
<id>317a09e2d47257df5e0972c85f14c2a6ffdbbfd2</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>libsparse: add function to resparse a file and a utility to use it</title>
<updated>2012-07-10T05:09:37+00:00</updated>
<author>
<name>Colin Cross</name>
<email>ccross@android.com</email>
</author>
<published>2012-05-02T22:18:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=bdc6d39ed6c09199a5d806f29b71b44cbb27c5c2'/>
<id>bdc6d39ed6c09199a5d806f29b71b44cbb27c5c2</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>libsparse: add callback output file type</title>
<updated>2012-07-10T05:09:37+00:00</updated>
<author>
<name>Colin Cross</name>
<email>ccross@android.com</email>
</author>
<published>2012-05-21T23:35:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=1e17b313a6257b7b5081e178e81435c09d60378e'/>
<id>1e17b313a6257b7b5081e178e81435c09d60378e</id>
<content type='text'>
Add a new output file subclass that will call a callback for
each block as it is written.  Will be used to measure the space
used by each sparse block to allow resparsing files.

Also add sparse_file_callback, which will write out a sparse
file by calling the provided write function.

Change-Id: I18707bd9c357b68da319cc07982e93d1c2b2bee2
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a new output file subclass that will call a callback for
each block as it is written.  Will be used to measure the space
used by each sparse block to allow resparsing files.

Also add sparse_file_callback, which will write out a sparse
file by calling the provided write function.

Change-Id: I18707bd9c357b68da319cc07982e93d1c2b2bee2
</pre>
</div>
</content>
</entry>
</feed>
