From 007f90a1238acc862953957460d78ccdf497aeaa Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 24 Jun 2014 20:13:33 -0500 Subject: [PATCH] Remove begin_stream callback flags These aren't used for anything anymore. --- include/wimlib/resource.h | 13 ------------- src/extract.c | 11 ++++------- src/ntfs-3g_apply.c | 3 +-- src/resource.c | 13 +++---------- src/unix_apply.c | 3 +-- src/win32_apply.c | 3 +-- src/write.c | 5 +---- 7 files changed, 11 insertions(+), 40 deletions(-) diff --git a/include/wimlib/resource.h b/include/wimlib/resource.h index ae077553..7861f871 100644 --- a/include/wimlib/resource.h +++ b/include/wimlib/resource.h @@ -216,10 +216,6 @@ skip_wim_stream(struct wim_lookup_table_entry *lte); * @lte: * Stream that is about to be read. * - * @flags: - * Bitwise OR of BEGIN_STREAM_FLAG_PARTIAL_RESOURCE and/or - * BEGIN_STREAM_FLAG_WHOLE_STREAM. - * * @ctx: * User-provided context. * @@ -229,17 +225,8 @@ skip_wim_stream(struct wim_lookup_table_entry *lte); * (without calling @consume_chunk or @end_stream). */ typedef int (*read_stream_list_begin_stream_t)(struct wim_lookup_table_entry *lte, - u32 flags, void *ctx); -/* Set to true if the stream is just one of several being read from a single - * pack and therefore would be extra expensive to read independently. */ -#define BEGIN_STREAM_FLAG_PARTIAL_RESOURCE 0x00000001 - -/* This is purely advisory and indicates that the entire stream data will be - * provided in one call to consume_chunk(). */ -#define BEGIN_STREAM_FLAG_WHOLE_STREAM 0x00000002 - #define BEGIN_STREAM_STATUS_SKIP_STREAM -1 /* diff --git a/src/extract.c b/src/extract.c index 3cc9959d..bbd0a5ed 100644 --- a/src/extract.c +++ b/src/extract.c @@ -217,7 +217,7 @@ load_streams_from_pipe(struct apply_ctx *ctx, lte_unbind_wim_resource_spec(found_lte); lte_bind_wim_resource_spec(needed_lte, rspec); - ret = (*cbs->begin_stream)(needed_lte, 0, + ret = (*cbs->begin_stream)(needed_lte, cbs->begin_stream_ctx); if (ret) { lte_unbind_wim_resource_spec(needed_lte); @@ -306,8 +306,7 @@ retry: } static int -begin_extract_stream_wrapper(struct wim_lookup_table_entry *lte, - u32 flags, void *_ctx) +begin_extract_stream_wrapper(struct wim_lookup_table_entry *lte, void *_ctx) { struct apply_ctx *ctx = _ctx; @@ -316,8 +315,7 @@ begin_extract_stream_wrapper(struct wim_lookup_table_entry *lte, if (unlikely(lte->out_refcnt > MAX_OPEN_STREAMS)) return create_temporary_file(&ctx->tmpfile_fd, &ctx->tmpfile_name); else - return (*ctx->saved_cbs->begin_stream)(lte, flags, - ctx->saved_cbs->begin_stream_ctx); + return (*ctx->saved_cbs->begin_stream)(lte, ctx->saved_cbs->begin_stream_ctx); } static int @@ -424,8 +422,7 @@ extract_from_tmpfile(const tchar *tmpfile_name, struct apply_ctx *ctx) * because it needs the original stream location in order to * create the external backing reference. */ - ret = (*cbs->begin_stream)(orig_lte, 0, - cbs->begin_stream_ctx); + ret = (*cbs->begin_stream)(orig_lte, cbs->begin_stream_ctx); if (ret) return ret; diff --git a/src/ntfs-3g_apply.c b/src/ntfs-3g_apply.c index d075d3d1..306daa5b 100644 --- a/src/ntfs-3g_apply.c +++ b/src/ntfs-3g_apply.c @@ -791,8 +791,7 @@ ntfs_3g_open_inode(struct wim_inode *inode, struct ntfs_3g_apply_ctx *ctx) } static int -ntfs_3g_begin_extract_stream(struct wim_lookup_table_entry *stream, - u32 flags, void *_ctx) +ntfs_3g_begin_extract_stream(struct wim_lookup_table_entry *stream, void *_ctx) { struct ntfs_3g_apply_ctx *ctx = _ctx; const struct stream_owner *owners = stream_owners(stream); diff --git a/src/resource.c b/src/resource.c index 300aec8f..53283f2c 100644 --- a/src/resource.c +++ b/src/resource.c @@ -1017,17 +1017,12 @@ streamifier_cb(const void *chunk, size_t size, void *_ctx) wimlib_assert(size <= ctx->cur_stream->size - ctx->cur_stream_offset); if (ctx->cur_stream_offset == 0) { - u32 flags; /* Starting a new stream. */ DEBUG("Begin new stream (size=%"PRIu64").", ctx->cur_stream->size); - flags = BEGIN_STREAM_FLAG_PARTIAL_RESOURCE; - if (size == ctx->cur_stream->size) - flags |= BEGIN_STREAM_FLAG_WHOLE_STREAM; ret = (*ctx->cbs.begin_stream)(ctx->cur_stream, - flags, ctx->cbs.begin_stream_ctx); if (ret) return ret; @@ -1073,8 +1068,7 @@ struct hasher_context { /* Callback for starting to read a stream while calculating its SHA1 message * digest. */ static int -hasher_begin_stream(struct wim_lookup_table_entry *lte, u32 flags, - void *_ctx) +hasher_begin_stream(struct wim_lookup_table_entry *lte, void *_ctx) { struct hasher_context *ctx = _ctx; @@ -1083,8 +1077,7 @@ hasher_begin_stream(struct wim_lookup_table_entry *lte, u32 flags, if (ctx->cbs.begin_stream == NULL) return 0; else - return (*ctx->cbs.begin_stream)(lte, flags, - ctx->cbs.begin_stream_ctx); + return (*ctx->cbs.begin_stream)(lte, ctx->cbs.begin_stream_ctx); } /* A consume_data_callback_t implementation that continues calculating the SHA1 @@ -1173,7 +1166,7 @@ read_full_stream_with_cbs(struct wim_lookup_table_entry *lte, { int ret; - ret = (*cbs->begin_stream)(lte, 0, cbs->begin_stream_ctx); + ret = (*cbs->begin_stream)(lte, cbs->begin_stream_ctx); if (ret) return ret; diff --git a/src/unix_apply.c b/src/unix_apply.c index b41c1e2c..a683b4da 100644 --- a/src/unix_apply.c +++ b/src/unix_apply.c @@ -561,8 +561,7 @@ retry_create: /* Called when starting to read a single-instance stream for extraction */ static int -unix_begin_extract_stream(struct wim_lookup_table_entry *stream, - u32 flags, void *_ctx) +unix_begin_extract_stream(struct wim_lookup_table_entry *stream, void *_ctx) { struct unix_apply_ctx *ctx = _ctx; const struct stream_owner *owners = stream_owners(stream); diff --git a/src/win32_apply.c b/src/win32_apply.c index 6faf2125..df42653c 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -1632,8 +1632,7 @@ extract_encrypted_file(const struct wim_dentry *dentry, /* Called when starting to read a stream for extraction on Windows */ static int -begin_extract_stream(struct wim_lookup_table_entry *stream, - u32 flags, void *_ctx) +begin_extract_stream(struct wim_lookup_table_entry *stream, void *_ctx) { struct win32_apply_ctx *ctx = _ctx; const struct stream_owner *owners = stream_owners(stream); diff --git a/src/write.c b/src/write.c index c45d0b7f..91954f9f 100644 --- a/src/write.c +++ b/src/write.c @@ -712,8 +712,7 @@ done_with_stream(struct wim_lookup_table_entry *stream, /* Begin processing a stream for writing. */ static int -write_stream_begin_read(struct wim_lookup_table_entry *lte, - u32 flags, void *_ctx) +write_stream_begin_read(struct wim_lookup_table_entry *lte, void *_ctx) { struct write_streams_ctx *ctx = _ctx; int ret; @@ -742,8 +741,6 @@ write_stream_begin_read(struct wim_lookup_table_entry *lte, ctx->stream_was_duplicate = false; if (ctx->lookup_table != NULL && lte->unhashed && !lte->unique_size) { - wimlib_assert(!(flags & BEGIN_STREAM_FLAG_PARTIAL_RESOURCE)); - struct wim_lookup_table_entry *lte_new; ret = hash_unhashed_stream(lte, ctx->lookup_table, <e_new); -- 2.43.0