diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-06-02 08:14:43 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-06-02 08:14:43 +0000 |
commit | d5f7a83e1b2d795a41b6ee882323609891e65aeb (patch) | |
tree | ff12dd5c58d3d34186f2f2fd2f6c027221d2ebd8 /lib/libarchive/archive_private.h | |
parent | 80d36400edd04b536fd6cab0dae30c9e678e6598 (diff) | |
download | FreeBSD-src-d5f7a83e1b2d795a41b6ee882323609891e65aeb.zip FreeBSD-src-d5f7a83e1b2d795a41b6ee882323609891e65aeb.tar.gz |
Refactor read_data:
* New read_data_block is both sparse-file aware and uses zero-copy semantics
* Push read_data_block down into specific formats (opens door to
various encoded entry bodies, such as zip or gtar -S)
* Reimplement read_data, read_data_skip, read_data_into_fd in terms
of new read_data_block.
* Update documentation
It's unfortunate that I couldn't just call the new interface
archive_read_data, but didn't want to upset the API that much.
Diffstat (limited to 'lib/libarchive/archive_private.h')
-rw-r--r-- | lib/libarchive/archive_private.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/libarchive/archive_private.h b/lib/libarchive/archive_private.h index cd5fc59..ddf50b1 100644 --- a/lib/libarchive/archive_private.h +++ b/lib/libarchive/archive_private.h @@ -54,12 +54,13 @@ struct archive { size_t null_length; /* - * Used to limit reads of entry data. Eventually, each reader - * will be able to register it's own read_data routine and these - * will move into the per-format data for the formats that use them. + * Used by archive_read_data() to track blocks and copy + * data to client buffers, filling gaps with zero bytes. */ - off_t entry_bytes_remaining; - off_t entry_padding; /* Skip this much after entry data. */ + const char *read_data_block; + off_t read_data_offset; + off_t read_data_output_offset; + size_t read_data_remaining; uid_t user_uid; /* UID of current user. */ @@ -151,6 +152,7 @@ struct archive { struct archive_format_descriptor { int (*bid)(struct archive *); int (*read_header)(struct archive *, struct archive_entry *); + int (*read_data)(struct archive *, const void **, size_t *, off_t *); int (*cleanup)(struct archive *); void *format_data; /* Format-specific data for readers. */ } formats[4]; @@ -168,9 +170,8 @@ struct archive { void *format_data; /* Used by writers. */ /* - * Pointers to format-specific functions. On read, these are - * initialized in the bid process. On write, they're initialized by - * archive_write_set_format_XXX() calls. + * Pointers to format-specific functions for writing. They're + * initialized by archive_write_set_format_XXX() calls. */ int (*format_init)(struct archive *); /* Only used on write. */ int (*format_finish)(struct archive *); @@ -220,6 +221,7 @@ int __archive_read_register_format(struct archive *a, void *format_data, int (*bid)(struct archive *), int (*read_header)(struct archive *, struct archive_entry *), + int (*read_data)(struct archive *, const void **, size_t *, off_t *), int (*cleanup)(struct archive *)); int __archive_read_register_compression(struct archive *a, |