]> wimlib.net Git - wimlib/blobdiff - src/unix_apply.c
unix_apply.c: preallocate space for regular files
[wimlib] / src / unix_apply.c
index 3746f504a3695954e9de7c0126872d151075681e..e2ba76f9edddbc4d7fe04fb643dd964e055e5354 100644 (file)
@@ -585,6 +585,9 @@ retry_create:
                return WIMLIB_ERR_OPEN;
        }
        filedes_init(&ctx->open_fds[ctx->num_open_fds++], fd);
+#ifdef HAVE_POSIX_FALLOCATE
+       posix_fallocate(fd, 0, blob->size);
+#endif
        return unix_create_hardlinks(inode, first_dentry, first_path, ctx);
 }
 
@@ -611,7 +614,8 @@ unix_begin_extract_blob(struct blob_descriptor *blob, void *_ctx)
 
 /* Called when the next chunk of a blob has been read for extraction  */
 static int
-unix_extract_chunk(const void *chunk, size_t size, void *_ctx)
+unix_extract_chunk(const struct blob_descriptor *blob, u64 offset,
+                  const void *chunk, size_t size, void *_ctx)
 {
        struct unix_apply_ctx *ctx = _ctx;
        int ret;
@@ -765,7 +769,7 @@ unix_extract(struct list_head *dentry_list, struct apply_ctx *_ctx)
 
        struct read_blob_callbacks cbs = {
                .begin_blob     = unix_begin_extract_blob,
-               .consume_chunk  = unix_extract_chunk,
+               .continue_blob  = unix_extract_chunk,
                .end_blob       = unix_end_extract_blob,
                .ctx            = ctx,
        };