Merge branch 'refs/heads/t/sha3' into master
[osl.git] / fsck.c
diff --git a/fsck.c b/fsck.c
index e814df55e866529328608d5acd39c5e2e9c76366..53b4a9b345b04db83cb7a314c37afed2ebfd24ac 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -722,7 +722,7 @@ static int check_disk_storage_presence(struct osl_table *t)
                ret = get_mapped_object(t, dsnc, k, &obj);
                if (ret < 0)
                        return ret;
-               hash_object(&obj, hashes + k * HASH_SIZE);
+               hash_object(t, &obj, hashes + k * HASH_SIZE);
                hash_obj.data = hashes + k * HASH_SIZE;
                osl_add_row(hash_tree_table, &hash_obj);
                ds_name = disk_storage_name_of_hash(t, hashes + k * HASH_SIZE);
@@ -876,21 +876,23 @@ static void set_dummy_contents(struct osl_table_description *desc)
 static int fsck_init(struct osl_table_description *desc, struct osl_table **t)
 {
        struct osl_object map;
-       int ret = map_index(desc, &map);
+       int version, ret = map_index(desc, &map);
 
        if (ret < 0)
                goto out;
-       ret = read_table_desc(&map, desc);
+       ret = read_table_desc(&map, desc); /* checks table version */
        if (ret < 0) {
                osl_munmap(map.data, map.size);
                goto out;
        }
+       version = ret;
        set_dummy_contents(desc);
        ret = init_table_structure(desc, t);
        if (ret < 0) {
                osl_munmap(map.data, map.size);
                goto out;
        }
+       (*t)->version = version;
        DEBUG_LOG("unmapping index\n");
        osl_munmap(map.data, map.size);
        if (OPT_GIVEN(FORCE))
@@ -1043,7 +1045,7 @@ static int dump_row(struct osl_table *t, unsigned row_num, const char *row_dir)
        ret = get_mapped_object(t, dsnc, row_num, &obj);
        if (ret < 0)
                return ret;
-       hash_object(&obj, hash);
+       hash_object(t, &obj, hash);
        ds_name = disk_storage_name_of_hash(t, hash);
        FOR_EACH_DISK_STORAGE_COLUMN(i, t, cd) {
                filename = disk_storage_path(t, i, ds_name);