summaryrefslogtreecommitdiff
path: root/src/apk_io.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-06-09 23:12:52 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-06-11 13:35:32 +0300
commit91cb2514e4d2b260817f9fd10cbf0a1839bb9a07 (patch)
tree80f7601d5c861c61a5129a6d11bd92cd83f476cb /src/apk_io.h
parent7ce4cc4b739127c0b4b36ffcabc007e5781b13c9 (diff)
downloadapk-tools-91cb2514e4d2b260817f9fd10cbf0a1839bb9a07.tar.gz
apk-tools-91cb2514e4d2b260817f9fd10cbf0a1839bb9a07.tar.bz2
apk-tools-91cb2514e4d2b260817f9fd10cbf0a1839bb9a07.tar.xz
apk-tools-91cb2514e4d2b260817f9fd10cbf0a1839bb9a07.zip
extract: new applet to extract v2 packages
Diffstat (limited to 'src/apk_io.h')
-rw-r--r--src/apk_io.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/apk_io.h b/src/apk_io.h
index a0025be..64f1efe 100644
--- a/src/apk_io.h
+++ b/src/apk_io.h
@@ -41,10 +41,10 @@ struct apk_file_meta {
void apk_file_meta_to_fd(int fd, struct apk_file_meta *meta);
struct apk_file_info {
- char *name;
- char *link_target;
- char *uname;
- char *gname;
+ const char *name;
+ const char *link_target;
+ const char *uname;
+ const char *gname;
off_t size;
uid_t uid;
gid_t gid;
@@ -77,6 +77,10 @@ struct apk_istream {
const struct apk_istream_ops *ops;
};
+typedef int (*apk_archive_entry_parser)(void *ctx,
+ const struct apk_file_info *ae,
+ struct apk_istream *istream);
+
#define APK_IO_ALL ((size_t)-1)
#define APK_ISTREAM_FORCE_REFRESH ((time_t) -1)
@@ -87,12 +91,12 @@ struct apk_istream *apk_istream_from_fd(int fd);
struct apk_istream *apk_istream_from_fd_url_if_modified(int atfd, const char *url, time_t since);
static inline int apk_istream_error(struct apk_istream *is, int err) { if (!is->err) is->err = err; return err; }
ssize_t apk_istream_read(struct apk_istream *is, void *ptr, size_t size);
-apk_blob_t apk_istream_get(struct apk_istream *is, size_t len);
+void *apk_istream_get(struct apk_istream *is, size_t len);
apk_blob_t apk_istream_get_max(struct apk_istream *is, size_t size);
apk_blob_t apk_istream_get_delim(struct apk_istream *is, apk_blob_t token);
static inline apk_blob_t apk_istream_get_all(struct apk_istream *is) { return apk_istream_get_max(is, APK_IO_ALL); }
ssize_t apk_istream_splice(struct apk_istream *is, int fd, size_t size,
- apk_progress_cb cb, void *cb_ctx);
+ apk_progress_cb cb, void *cb_ctx, struct apk_digest_ctx *dctx);
ssize_t apk_stream_copy(struct apk_istream *is, struct apk_ostream *os, size_t size,
apk_progress_cb cb, void *cb_ctx, struct apk_digest_ctx *dctx);
@@ -172,9 +176,9 @@ int apk_blob_to_file(int atfd, const char *file, apk_blob_t b, unsigned int flag
#define APK_FI_NOFOLLOW 0x80000000
#define APK_FI_XATTR_DIGEST(x) (((x) & 0xff) << 8)
-#define APK_FI_XATTR_CSUM(x) APK_FI_XATTR_DIGEST(apk_digest_alg_from_csum(x))
+#define APK_FI_XATTR_CSUM(x) APK_FI_XATTR_DIGEST(apk_digest_alg_by_len(x))
#define APK_FI_DIGEST(x) (((x) & 0xff))
-#define APK_FI_CSUM(x) APK_FI_DIGEST(apk_digest_alg_from_csum(x))
+#define APK_FI_CSUM(x) APK_FI_DIGEST(apk_digest_alg_by_len(x))
int apk_fileinfo_get(int atfd, const char *filename, unsigned int flags,
struct apk_file_info *fi, struct apk_atom_pool *atoms);
void apk_fileinfo_hash_xattr(struct apk_file_info *fi, uint8_t alg);