diff options
author | kientzle <kientzle@FreeBSD.org> | 2006-07-30 00:29:01 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2006-07-30 00:29:01 +0000 |
commit | f501dbec5fe3a8ec80a115b83f7f07e2671bfc95 (patch) | |
tree | 7a38c3d6e84fc5da7d1e72df478099c6b6a417f6 /lib/libarchive/archive.h.in | |
parent | 61dd143cfb0a5bd3bf9dc7304f3f4126ae2e5acd (diff) | |
download | FreeBSD-src-f501dbec5fe3a8ec80a115b83f7f07e2671bfc95.zip FreeBSD-src-f501dbec5fe3a8ec80a115b83f7f07e2671bfc95.tar.gz |
Use 'skip' when ignoring data in tar archives. This dramatically
increases performance when extracting a single entry from a large
uncompressed archive, especially on slow devices such as USB hard
drives.
Requires a number of changes:
* New archive_read_open2() supports a 'skip' client function
* Old archive_read_open() is implemented as a wrapper now, to
continue supporting the old API/ABI.
* _read_open_fd and _read_open_file sprout new 'skip' functions.
* compression layer gets a new 'skip' operation.
* compression_none passes skip requests through to client.
* compression_{gzip,bzip2,compress} simply ignore skip requests.
Thanks to: Benjamin Lutz, who designed and implemented the whole thing.
I'm just committing it. ;-)
TODO: Need to update the documentation a little bit.
Diffstat (limited to 'lib/libarchive/archive.h.in')
-rw-r--r-- | lib/libarchive/archive.h.in | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libarchive/archive.h.in b/lib/libarchive/archive.h.in index 62c4d52..2ff9a3a 100644 --- a/lib/libarchive/archive.h.in +++ b/lib/libarchive/archive.h.in @@ -100,14 +100,18 @@ struct archive_entry; /* #define ARCHIVE_ERRNO_MISC */ /* - * Callbacks are invoked to automatically read/write/open/close the archive. - * You can provide your own for complex tasks (like breaking archives - * across multiple tapes) or use standard ones built into the library. + * Callbacks are invoked to automatically read/skip/write/open/close the + * archive. You can provide your own for complex tasks (like breaking + * archives across multiple tapes) or use standard ones built into the + * library. */ /* Returns pointer and size of next block of data from archive. */ typedef ssize_t archive_read_callback(struct archive *, void *_client_data, const void **_buffer); +/* Skips at most request bytes from archive and returns the skipped amount */ +typedef ssize_t archive_skip_callback(struct archive *, void *_client_data, + size_t request); /* Returns size actually written, zero on EOF, -1 on error. */ typedef ssize_t archive_write_callback(struct archive *, void *_client_data, void *_buffer, size_t _length); @@ -187,6 +191,9 @@ int archive_read_support_format_zip(struct archive *); int archive_read_open(struct archive *, void *_client_data, archive_open_callback *, archive_read_callback *, archive_close_callback *); +int archive_read_open2(struct archive *, void *_client_data, + archive_open_callback *, archive_read_callback *, + archive_skip_callback *, archive_close_callback *); /* * The archive_read_open_file function is a convenience function built |