diff options
Diffstat (limited to 'src/apk_io.h')
-rw-r--r-- | src/apk_io.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/apk_io.h b/src/apk_io.h index c61fc6e..82102aa 100644 --- a/src/apk_io.h +++ b/src/apk_io.h @@ -14,6 +14,7 @@ #include <sys/types.h> #include <openssl/evp.h> #include <fcntl.h> +#include <time.h> #include "apk_defines.h" #include "apk_blob.h" @@ -78,7 +79,7 @@ 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_fd_url(int atfd, const char *url); +struct apk_istream *apk_istream_from_fd_url_if_modified(int atfd, const char *url, time_t since); struct apk_istream *apk_istream_from_url_gz(const char *url); size_t apk_istream_skip(struct apk_istream *istream, size_t size); @@ -92,13 +93,21 @@ static inline struct apk_istream *apk_istream_from_fd(int fd) } static inline struct apk_istream *apk_istream_from_url(const char *url) { - return apk_istream_from_fd_url(AT_FDCWD, url); + return apk_istream_from_fd_url_if_modified(AT_FDCWD, url, 0); +} +static inline struct apk_istream *apk_istream_from_fd_url(int atfd, const char *url) +{ + return apk_istream_from_fd_url_if_modified(atfd, url, 0); +} +static inline struct apk_istream *apk_istream_from_url_if_modified(const char *url, time_t since) +{ + return apk_istream_from_fd_url_if_modified(AT_FDCWD, url, since); } 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_fd_url(int atfd, const char *url); +struct apk_bstream *apk_bstream_from_fd_url_if_modified(int atfd, const char *url, time_t since); struct apk_bstream *apk_bstream_tee(struct apk_bstream *from, int atfd, const char *to, apk_progress_cb cb, void *cb_ctx); @@ -109,7 +118,15 @@ static inline struct apk_bstream *apk_bstream_from_fd(int fd) static inline struct apk_bstream *apk_bstream_from_url(const char *url) { - return apk_bstream_from_fd_url(AT_FDCWD, url); + return apk_bstream_from_fd_url_if_modified(AT_FDCWD, url, 0); +} +static inline struct apk_bstream *apk_bstream_from_fd_url(int fd, const char *url) +{ + return apk_bstream_from_fd_url_if_modified(fd, url, 0); +} +static inline struct apk_bstream *apk_bstream_from_url_if_modified(const char *url, time_t since) +{ + return apk_bstream_from_fd_url_if_modified(AT_FDCWD, url, since); } struct apk_ostream *apk_ostream_to_fd(int fd); |