Lines Matching refs:f
113 static int hash_payload(JournalFile *f, Object *o, uint64_t offset, const uint8_t *src, uint64_t si… in hash_payload() argument
135 *res_hash = journal_file_hash_data(f, b, b_size); in hash_payload()
137 *res_hash = journal_file_hash_data(f, src, size); in hash_payload()
142 static int journal_file_object_verify(JournalFile *f, uint64_t offset, Object *o) { in journal_file_object_verify() argument
143 assert(f); in journal_file_object_verify()
181 r = hash_payload(f, o, offset, o->data.payload, in journal_file_object_verify()
220 r = hash_payload(f, o, offset, o->field.payload, in journal_file_object_verify()
393 static int contains_uint64(MMapFileDescriptor *f, uint64_t n, uint64_t p) { in contains_uint64() argument
397 assert(f); in contains_uint64()
407 … r = mmap_cache_fd_get(f, 0, false, c * sizeof(uint64_t), sizeof(uint64_t), NULL, (void **) &z); in contains_uint64()
427 JournalFile *f, in verify_data() argument
435 assert(f); in verify_data()
461 r = journal_file_move_to_entry_by_offset(f, q, DIRECTION_DOWN, NULL, NULL); in verify_data()
483 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o); in verify_data()
508 r = journal_file_move_to_entry_by_offset(f, q, DIRECTION_DOWN, NULL, NULL); in verify_data()
517 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o); in verify_data()
529 JournalFile *f, in verify_data_hash_table() argument
539 assert(f); in verify_data_hash_table()
545 n = le64toh(f->header->data_hash_table_size) / sizeof(HashItem); in verify_data_hash_table()
549 r = journal_file_map_data_hash_table(f); in verify_data_hash_table()
559 p = le64toh(f->data_hash_table[i].head_hash_offset); in verify_data_hash_table()
569 r = journal_file_move_to_object(f, OBJECT_DATA, p, &o); in verify_data_hash_table()
584 … r = verify_data(f, o, p, cache_entry_fd, n_entries, cache_entry_array_fd, n_entry_arrays); in verify_data_hash_table()
592 if (last != le64toh(f->data_hash_table[i].tail_hash_offset)) { in verify_data_hash_table()
596 le64toh(f->data_hash_table[i].tail_hash_offset)); in verify_data_hash_table()
604 static int data_object_in_hash_table(JournalFile *f, uint64_t hash, uint64_t p) { in data_object_in_hash_table() argument
607 assert(f); in data_object_in_hash_table()
609 n = le64toh(f->header->data_hash_table_size) / sizeof(HashItem); in data_object_in_hash_table()
613 r = journal_file_map_data_hash_table(f); in data_object_in_hash_table()
619 q = le64toh(f->data_hash_table[h].head_hash_offset); in data_object_in_hash_table()
626 r = journal_file_move_to_object(f, OBJECT_DATA, q, &o); in data_object_in_hash_table()
637 JournalFile *f, in verify_entry() argument
645 assert(f); in verify_entry()
661 r = journal_file_move_to_object(f, OBJECT_DATA, q, &u); in verify_entry()
665 r = data_object_in_hash_table(f, le64toh(u->data.hash), q); in verify_entry()
673 … r = journal_file_move_to_entry_by_offset_for_data(f, u, p, DIRECTION_DOWN, NULL, NULL); in verify_entry()
690 JournalFile *f, in verify_entry_array() argument
700 assert(f); in verify_entry_array()
706 n = le64toh(f->header->n_entries); in verify_entry_array()
707 a = le64toh(f->header->entry_array_offset); in verify_entry_array()
725 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o); in verify_entry_array()
751 r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o); in verify_entry_array()
755 r = verify_entry(f, o, p, cache_data_fd, n_data, /*last=*/ i + 1 == n); in verify_entry_array()
760 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o); in verify_entry_array()
809 JournalFile *f, in journal_file_verify() argument
833 assert(f); in journal_file_verify()
837 r = journal_file_parse_verification_key(f, key); in journal_file_verify()
845 } else if (JOURNAL_HEADER_SEALED(f->header)) in journal_file_verify()
873 m = mmap_cache_fd_cache(f->cache_fd); in journal_file_verify()
910 if (le32toh(f->header->compatible_flags) & ~HEADER_COMPATIBLE_SUPPORTED) { in journal_file_verify()
916 for (i = 0; i < sizeof(f->header->reserved); i++) in journal_file_verify()
917 if (f->header->reserved[i] != 0) { in journal_file_verify()
926 p = le64toh(f->header->header_size); in journal_file_verify()
929 if (le64toh(f->header->tail_object_offset) == 0) in journal_file_verify()
933 … draw_progress(scale_progress(0x7FFF, p, le64toh(f->header->tail_object_offset)), &last_usec); in journal_file_verify()
935 r = journal_file_move_to_object(f, OBJECT_UNUSED, p, &o); in journal_file_verify()
941 if (p > le64toh(f->header->tail_object_offset)) { in journal_file_verify()
945 le64toh(f->header->tail_object_offset)); in journal_file_verify()
952 r = journal_file_object_verify(f, p, o); in journal_file_verify()
966 … if ((o->object.flags & OBJECT_COMPRESSED_XZ) && !JOURNAL_HEADER_COMPRESSED_XZ(f->header)) { in journal_file_verify()
972 … if ((o->object.flags & OBJECT_COMPRESSED_LZ4) && !JOURNAL_HEADER_COMPRESSED_LZ4(f->header)) { in journal_file_verify()
978 … if ((o->object.flags & OBJECT_COMPRESSED_ZSTD) && !JOURNAL_HEADER_COMPRESSED_ZSTD(f->header)) { in journal_file_verify()
999 if (JOURNAL_HEADER_SEALED(f->header) && n_tags <= 0) { in journal_file_verify()
1019 le64toh(o->entry.seqnum) != le64toh(f->header->head_entry_seqnum)) { in journal_file_verify()
1023 le64toh(f->header->head_entry_seqnum)); in journal_file_verify()
1057 le64toh(o->entry.realtime) != le64toh(f->header->head_entry_realtime)) { in journal_file_verify()
1061 le64toh(f->header->head_entry_realtime)); in journal_file_verify()
1074 le64toh(f->header->data_hash_table_offset), in journal_file_verify()
1075 le64toh(f->header->data_hash_table_size)); in journal_file_verify()
1082 le64toh(f->header->field_hash_table_offset), in journal_file_verify()
1083 le64toh(f->header->field_hash_table_size)); in journal_file_verify()
1094 if (p == le64toh(f->header->entry_array_offset)) { in journal_file_verify()
1108 if (!JOURNAL_HEADER_SEALED(f->header)) { in journal_file_verify()
1133 if (JOURNAL_HEADER_SEALED(f->header)) { in journal_file_verify()
1138 … rt = f->fss_start_usec + le64toh(o->tag.epoch) * f->fss_interval_usec; in journal_file_verify()
1139 … if (entry_realtime_set && entry_realtime >= rt + f->fss_interval_usec) { in journal_file_verify()
1143 rt + f->fss_interval_usec); in journal_file_verify()
1151 r = journal_file_fsprg_seek(f, le64toh(o->tag.epoch)); in journal_file_verify()
1155 r = journal_file_hmac_start(f); in journal_file_verify()
1160 r = journal_file_hmac_put_header(f); in journal_file_verify()
1164 q = le64toh(f->header->header_size); in journal_file_verify()
1169 r = journal_file_move_to_object(f, OBJECT_UNUSED, q, &o); in journal_file_verify()
1173 r = journal_file_hmac_put_object(f, OBJECT_UNUSED, o, q); in journal_file_verify()
1181 r = journal_file_move_to_object(f, OBJECT_UNUSED, p, &o); in journal_file_verify()
1185 if (memcmp(o->tag.tag, gcry_md_read(f->hmac, 0), TAG_LENGTH) != 0) { in journal_file_verify()
1191 f->hmac_running = false; in journal_file_verify()
1208 if (p == le64toh(f->header->tail_object_offset)) { in journal_file_verify()
1216 if (!found_last && le64toh(f->header->tail_object_offset) != 0) { in journal_file_verify()
1217 error(le64toh(f->header->tail_object_offset), in journal_file_verify()
1219 le64toh(f->header->tail_object_offset)); in journal_file_verify()
1224 if (n_objects != le64toh(f->header->n_objects)) { in journal_file_verify()
1228 le64toh(f->header->n_objects)); in journal_file_verify()
1233 if (n_entries != le64toh(f->header->n_entries)) { in journal_file_verify()
1237 le64toh(f->header->n_entries)); in journal_file_verify()
1242 if (JOURNAL_HEADER_CONTAINS(f->header, n_data) && in journal_file_verify()
1243 n_data != le64toh(f->header->n_data)) { in journal_file_verify()
1247 le64toh(f->header->n_data)); in journal_file_verify()
1252 if (JOURNAL_HEADER_CONTAINS(f->header, n_fields) && in journal_file_verify()
1253 n_fields != le64toh(f->header->n_fields)) { in journal_file_verify()
1257 le64toh(f->header->n_fields)); in journal_file_verify()
1262 if (JOURNAL_HEADER_CONTAINS(f->header, n_tags) && in journal_file_verify()
1263 n_tags != le64toh(f->header->n_tags)) { in journal_file_verify()
1267 le64toh(f->header->n_tags)); in journal_file_verify()
1272 if (JOURNAL_HEADER_CONTAINS(f->header, n_entry_arrays) && in journal_file_verify()
1273 n_entry_arrays != le64toh(f->header->n_entry_arrays)) { in journal_file_verify()
1277 le64toh(f->header->n_entry_arrays)); in journal_file_verify()
1282 if (!found_main_entry_array && le64toh(f->header->entry_array_offset) != 0) { in journal_file_verify()
1289 entry_seqnum != le64toh(f->header->tail_entry_seqnum)) { in journal_file_verify()
1293 le64toh(f->header->tail_entry_seqnum)); in journal_file_verify()
1299 (sd_id128_equal(entry_boot_id, f->header->boot_id) && in journal_file_verify()
1300 entry_monotonic != le64toh(f->header->tail_entry_monotonic))) { in journal_file_verify()
1304 le64toh(f->header->tail_entry_monotonic)); in journal_file_verify()
1309 if (entry_realtime_set && entry_realtime != le64toh(f->header->tail_entry_realtime)) { in journal_file_verify()
1313 le64toh(f->header->tail_entry_realtime)); in journal_file_verify()
1341 r = verify_entry_array(f, in journal_file_verify()
1350 r = verify_data_hash_table(f, in journal_file_verify()
1367 *first_contained = le64toh(f->header->head_entry_realtime); in journal_file_verify()
1371 *last_contained = le64toh(f->header->tail_entry_realtime); in journal_file_verify()
1380 f->path, in journal_file_verify()
1382 (unsigned long long) f->last_stat.st_size, in journal_file_verify()
1383 100 * p / f->last_stat.st_size); in journal_file_verify()