From ea901526648c43ef8e961b3d7e051b9ca14b65ca Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Fri, 31 Jul 2009 16:08:09 +0300 Subject: apk: use *at instead of chdir+normal file syscall this way we never change cwd, and relative filenames are always parsed consistently. this also helps filename construction in many places. this patch also changes '--root' to override location of all configuration to be in the new root. previously it depended on the file which one was used. --- src/apk_io.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/apk_io.h') diff --git a/src/apk_io.h b/src/apk_io.h index b76385c..759bec4 100644 --- a/src/apk_io.h +++ b/src/apk_io.h @@ -66,8 +66,8 @@ struct apk_ostream *apk_ostream_gzip(struct apk_ostream *); struct apk_ostream *apk_ostream_counter(off_t *); struct apk_istream *apk_istream_from_fd(int fd); -struct apk_istream *apk_istream_from_file(const char *file); -struct apk_istream *apk_istream_from_file_gz(const char *file); +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_url_gz(const char *url); size_t apk_istream_skip(struct apk_istream *istream, size_t size); @@ -76,20 +76,21 @@ size_t apk_istream_splice(void *stream, int fd, size_t size, struct apk_bstream *apk_bstream_from_istream(struct apk_istream *istream); struct apk_bstream *apk_bstream_from_fd(int fd); -struct apk_bstream *apk_bstream_from_file(const char *file); +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_tee(struct apk_bstream *from, const char *to); +struct apk_bstream *apk_bstream_tee(struct apk_bstream *from, int atfd, const char *to); struct apk_ostream *apk_ostream_to_fd(int fd); -struct apk_ostream *apk_ostream_to_file(const char *file, mode_t mode); -struct apk_ostream *apk_ostream_to_file_gz(const char *file, mode_t mode); +struct apk_ostream *apk_ostream_to_file(int atfd, const char *file, mode_t mode); +struct apk_ostream *apk_ostream_to_file_gz(int atfd, const char *file, mode_t mode); size_t apk_ostream_write_string(struct apk_ostream *ostream, const char *string); apk_blob_t apk_blob_from_istream(struct apk_istream *istream, size_t size); -apk_blob_t apk_blob_from_file(const char *file); +apk_blob_t apk_blob_from_file(int atfd, const char *file); -int apk_file_get_info(const char *filename, int checksum, struct apk_file_info *fi); -int apk_url_download(const char *url, const char *file); +int apk_file_get_info(int atfd, const char *filename, int checksum, + struct apk_file_info *fi); +int apk_url_download(const char *url, int atfd, const char *file); const char *apk_url_local_file(const char *url); #endif -- cgit v1.2.3-60-g2f50