chunk: file contents is now stored in a single, variable-length chunk
This commit is contained in:
@@ -67,6 +67,9 @@ static enum ec3_status capture_file(
|
||||
}
|
||||
|
||||
enum ec3_status s2 = EC3_SUCCESS;
|
||||
chunk_table_begin_chunk(&ctx->ctx_chunks);
|
||||
|
||||
size_t chunk_size = 0;
|
||||
|
||||
while (1) {
|
||||
size_t nr_read = 0;
|
||||
@@ -84,22 +87,31 @@ static enum ec3_status capture_file(
|
||||
break;
|
||||
}
|
||||
|
||||
ec3_chunk_id chunk;
|
||||
enum ec3_status s2 = chunk_table_put(
|
||||
&ctx->ctx_chunks,
|
||||
buf,
|
||||
nr_read,
|
||||
chunk);
|
||||
enum ec3_status s2
|
||||
= chunk_table_put(&ctx->ctx_chunks, buf, nr_read);
|
||||
|
||||
if (s2 != EC3_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
||||
chunk_size += nr_read;
|
||||
|
||||
if (nr_read < buf_len) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ec3_chunk_id id = {0};
|
||||
s2 = chunk_table_end_chunk(&ctx->ctx_chunks, id);
|
||||
|
||||
if (s2 != EC3_SUCCESS) {
|
||||
return s2;
|
||||
}
|
||||
|
||||
char id_str[128];
|
||||
ec3_chunk_id_to_string(id, id_str, sizeof id_str);
|
||||
printf("wrote %zu byte chunk %s\n", chunk_size, id_str);
|
||||
|
||||
free(buf);
|
||||
b_file_release(src);
|
||||
return s2;
|
||||
@@ -175,10 +187,6 @@ static int capture(
|
||||
const b_arglist *opt,
|
||||
const b_array *args)
|
||||
{
|
||||
printf("sizeof(struct ec3_vnode_group) = %zu\n",
|
||||
sizeof(struct ec3_vnode_group));
|
||||
return 0;
|
||||
|
||||
const char *out_path = NULL;
|
||||
b_arglist_get_string(opt, OPT_OUTPATH, OPT_OUTPATH_PATH, 0, &out_path);
|
||||
|
||||
@@ -351,6 +359,7 @@ static int capture(
|
||||
ec3_tag_ioctx_close(stab);
|
||||
ec3_tag_ioctx_close(ctab);
|
||||
ec3_tag_ioctx_close(cdat);
|
||||
|
||||
ec3_image_ioctx_close(image);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user