diff options
Diffstat (limited to 'src/apk_io.h')
-rw-r--r-- | src/apk_io.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/apk_io.h b/src/apk_io.h index 4790d80..2a6db5a 100644 --- a/src/apk_io.h +++ b/src/apk_io.h @@ -77,9 +77,11 @@ struct apk_ostream *apk_ostream_counter(off_t *); struct apk_istream *apk_istream_from_fd_pid(int fd, pid_t pid, int (*translate_status)(int)); struct apk_istream *apk_istream_from_file(int atfd, const char *file); struct apk_istream *apk_istream_from_file_gz(int atfd, const char *file); -struct apk_istream *apk_istream_from_url(const char *url); +struct apk_istream *apk_istream_from_fd_url(int atfd, const char *url); struct apk_istream *apk_istream_from_url_gz(const char *url); size_t apk_istream_skip(struct apk_istream *istream, size_t size); + +#define APK_SPLICE_ALL 0xffffffff size_t apk_istream_splice(void *stream, int fd, size_t size, apk_progress_cb cb, void *cb_ctx); @@ -87,11 +89,15 @@ static inline struct apk_istream *apk_istream_from_fd(int fd) { return apk_istream_from_fd_pid(fd, 0, NULL); } +static inline struct apk_istream *apk_istream_from_url(const char *url) +{ + return apk_istream_from_fd_url(-1, url); +} struct apk_bstream *apk_bstream_from_istream(struct apk_istream *istream); struct apk_bstream *apk_bstream_from_fd_pid(int fd, pid_t pid, int (*translate_status)(int)); struct apk_bstream *apk_bstream_from_file(int atfd, const char *file); -struct apk_bstream *apk_bstream_from_url(const char *url); +struct apk_bstream *apk_bstream_from_fd_url(int atfd, const char *url); struct apk_bstream *apk_bstream_tee(struct apk_bstream *from, int atfd, const char *to); static inline struct apk_bstream *apk_bstream_from_fd(int fd) @@ -99,6 +105,11 @@ static inline struct apk_bstream *apk_bstream_from_fd(int fd) return apk_bstream_from_fd_pid(fd, 0, NULL); } +static inline struct apk_bstream *apk_bstream_from_url(const char *url) +{ + return apk_bstream_from_fd_url(-1, url); +} + struct apk_ostream *apk_ostream_to_fd(int fd); struct apk_ostream *apk_ostream_to_file(int atfd, const char *file, const char *tmpfile, mode_t mode); struct apk_ostream *apk_ostream_to_file_gz(int atfd, const char *file, const char *tmpfile, mode_t mode); |