From a2e949e5e49e2e3ffd8e9e5b3f6cb3f28abe985f Mon Sep 17 00:00:00 2001 From: Francesco Cozzuto Date: Sun, 9 Nov 2025 12:51:51 +0100 Subject: [PATCH] Progress --- src/file_tree.c | 4 +--- src/metadata_server.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/file_tree.c b/src/file_tree.c index 95af747..febe682 100644 --- a/src/file_tree.c +++ b/src/file_tree.c @@ -394,8 +394,6 @@ int file_tree_write(FileTree *ft, string path, return 0; } -#define ZERO_HASH ((SHA256) { .data={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }) - int file_tree_read(FileTree *ft, string path, uint64_t off, uint64_t len, uint64_t *chunk_size, SHA256 *hashes, int max_hashes) @@ -423,7 +421,7 @@ int file_tree_read(FileTree *ft, string path, *chunk_size = f->chunk_size; uint64_t first_chunk_index = off / f->chunk_size; - uint64_t last_chunk_index = (off + len - 1) / f->chunk_size; + uint64_t last_chunk_index = first_chunk_index + (len - 1) / f->chunk_size; if (first_chunk_index >= f->num_chunks) return 0; diff --git a/src/metadata_server.c b/src/metadata_server.c index 0db3507..6998dee 100644 --- a/src/metadata_server.c +++ b/src/metadata_server.c @@ -826,7 +826,7 @@ int metadata_server_init(MetadataServer *state, int argc, char **argv, void **co return -1; state->trace = trace; - state->replication_factor = 3; + state->replication_factor = 3; // TODO: what about the REPLICATION_FACTOR macro? if (state->replication_factor > MAX_CHUNK_SERVERS) return -1;