]> wimlib.net Git - wimlib/blobdiff - src/write.c
Fix can_raw_copy()
[wimlib] / src / write.c
index 63c91b2aef5b683ef00120a9c1222b6a0279df40..e7107ab1d392bb0a740d304737677117e7f6a8a2 100644 (file)
@@ -74,17 +74,19 @@ static bool
 can_raw_copy(const struct wim_lookup_table_entry *lte,
             int write_resource_flags, int out_ctype, u32 out_chunk_size)
 {
+       if (write_resource_flags & WIMLIB_WRITE_RESOURCE_FLAG_RECOMPRESS)
+               return false;
        if (lte->resource_location != RESOURCE_IN_WIM)
                return false;
        if (out_ctype == WIMLIB_COMPRESSION_TYPE_NONE)
                return false;
-       if (lte->rspec->ctype != out_ctype)
+       if (lte->rspec->flags & WIM_RESHDR_FLAG_PACKED_STREAMS)
                return false;
-       if (out_chunk_size != lte->rspec->cchunk_size)
+       if (!(lte->rspec->flags & WIM_RESHDR_FLAG_COMPRESSED))
                return false;
-       if (lte->offset_in_res != 0)
+       if (lte->rspec->wim->compression_type != out_ctype)
                return false;
-       if (lte->size != lte->rspec->uncompressed_size)
+       if (lte->rspec->wim->chunk_size != out_chunk_size)
                return false;
        return true;
 }
@@ -268,7 +270,7 @@ write_pwm_stream_header(const struct wim_lookup_table_entry *lte,
                copy_hash(stream_hdr.hash, lte->hash);
        }
 
-       reshdr_flags = lte->flags & ~(WIM_RESHDR_FLAG_COMPRESSED | WIM_RESHDR_FLAG_CONCAT);
+       reshdr_flags = lte->flags & ~(WIM_RESHDR_FLAG_COMPRESSED | WIM_RESHDR_FLAG_PACKED_STREAMS);
        reshdr_flags |= additional_reshdr_flags;
        stream_hdr.flags = cpu_to_le32(reshdr_flags);
        ret = full_write(out_fd, &stream_hdr, sizeof(stream_hdr));
@@ -442,7 +444,6 @@ write_wim_resource(struct wim_lookup_table_entry *lte,
 {
        struct write_resource_ctx write_ctx;
        off_t res_start_offset;
-       u32 in_chunk_size;
        u64 read_size;
        int ret;
 
@@ -527,12 +528,8 @@ write_wim_resource(struct wim_lookup_table_entry *lte,
        write_ctx.out_fd = out_fd;
        write_ctx.resource_flags = resource_flags;
 try_write_again:
-       if (write_ctx.out_ctype == WIMLIB_COMPRESSION_TYPE_NONE)
-               in_chunk_size = lte_cchunk_size(lte);
-       else
-               in_chunk_size = out_chunk_size;
        ret = read_stream_prefix(lte, read_size, write_resource_cb,
-                                in_chunk_size, &write_ctx, resource_flags);
+                                &write_ctx, resource_flags);
        if (ret)
                goto out_free_chunk_tab;
 
@@ -557,7 +554,7 @@ try_write_again:
        /* Fill in out_reshdr with information about the newly written
         * resource.  */
        out_reshdr->size_in_wim   = out_fd->offset - res_start_offset;
-       out_reshdr->flags         = lte->flags & ~WIM_RESHDR_FLAG_CONCAT;
+       out_reshdr->flags         = lte->flags & ~WIM_RESHDR_FLAG_PACKED_STREAMS;
        if (out_ctype == WIMLIB_COMPRESSION_TYPE_NONE)
                out_reshdr->flags &= ~WIM_RESHDR_FLAG_COMPRESSED;
        else
@@ -1480,8 +1477,7 @@ submit_stream_for_compression(struct wim_lookup_table_entry *lte,
        ctx->next_lte = lte;
        INIT_LIST_HEAD(&lte->msg_list);
        list_add_tail(&lte->being_compressed_list, &ctx->outstanding_streams);
-       ret = read_stream_prefix(lte, lte->size, main_writer_thread_cb,
-                                ctx->out_chunk_size, ctx, 0);
+       ret = read_stream_prefix(lte, lte->size, main_writer_thread_cb, ctx, 0);
        if (ret)
                return ret;
        wimlib_assert(ctx->next_chunk == ctx->next_num_chunks);