assert(f);
/* Write the final tag */
- if (f->seal)
+ if (f->seal && f->writable)
journal_file_append_tag(f);
/* Sync everything to disk, before we mark the file offline */
}
f->compress = !!(le32toh(f->header->incompatible_flags) & HEADER_INCOMPATIBLE_COMPRESSED);
- f->seal = !!(le32toh(f->header->compatible_flags) & HEADER_COMPATIBLE_SEALED);
+
+ if (f->writable)
+ f->seal = !!(le32toh(f->header->compatible_flags) & HEADER_COMPATIBLE_SEALED);
return 0;
}
return (le64toh(o->object.size) - offsetof(Object, entry_array.items)) / sizeof(uint64_t);
}
+uint64_t journal_file_hash_table_n_items(Object *o) {
+ assert(o);
+ assert(o->object.type == OBJECT_DATA_HASH_TABLE ||
+ o->object.type == OBJECT_FIELD_HASH_TABLE);
+
+ return (le64toh(o->object.size) - offsetof(Object, hash_table.items)) / sizeof(HashItem);
+}
+
static int link_entry_into_array(JournalFile *f,
le64_t *first,
le64_t *idx,
break;
case OBJECT_ENTRY:
- printf("Type: OBJECT_ENTRY %llu %llu %llu\n",
+ printf("Type: OBJECT_ENTRY seqnum=%llu monotonic=%llu realtime=%llu\n",
(unsigned long long) le64toh(o->entry.seqnum),
(unsigned long long) le64toh(o->entry.monotonic),
(unsigned long long) le64toh(o->entry.realtime));
break;
case OBJECT_TAG:
- printf("Type: OBJECT_TAG %llu\n",
- (unsigned long long) le64toh(o->tag.seqnum));
+ printf("Type: OBJECT_TAG seqnum=%llu epoch=%llu\n",
+ (unsigned long long) le64toh(o->tag.seqnum),
+ (unsigned long long) le64toh(o->tag.epoch));
break;
}
if (mmap_cache)
f->mmap = mmap_cache_ref(mmap_cache);
else {
- /* One context for each type, plus the zeroth catchall
- * context. One fd for the file plus one for each type
- * (which we need during verification */
- f->mmap = mmap_cache_new(_OBJECT_TYPE_MAX, 1 + _OBJECT_TYPE_MAX);
+ f->mmap = mmap_cache_new();
if (!f->mmap) {
r = -ENOMEM;
goto fail;