summaryrefslogtreecommitdiffstats
path: root/src/apk_io.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-17 13:51:49 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-17 14:23:14 +0300
commitdbb642206d2ef73c5428a04cb10bb27e7cdd3b29 (patch)
treea1844d9b309d3d46ab14317ca5c42b9905222452 /src/apk_io.h
parentf79e3946a40bf6beb2a38050a866c0fb1ed4bcf4 (diff)
downloadapk-tools-dbb642206d2ef73c5428a04cb10bb27e7cdd3b29.tar.bz2
apk-tools-dbb642206d2ef73c5428a04cb10bb27e7cdd3b29.tar.xz
io: fix splice for copying unknown lengths
Diffstat (limited to 'src/apk_io.h')
-rw-r--r--src/apk_io.h15
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);