3068 Commits

Author SHA1 Message Date
Marcus Holland-Moritz
240abf9f56 feat(filesystem_parser): use optimized search for section header
Turns out that `std::boyer_moore_searcher` is pretty slow for our small
needle. This custom searcher assumes that the major version byte is the
most unlikely to occur (at least for now) and uses `strchr` to search
for that (in the hope that this is nicely optimized), and then validate
any match against the full magic.

Here's a benchmark (x86_64) for a tiny image with a 110 MiB header:

```
$ hyperfine "./dwarfsck.orig --no-check -q td.dwarfs" "./dwarfsck --no-check -q td.dwarfs"
Benchmark 1: ./dwarfsck.orig --no-check -q td.dwarfs
  Time (mean ± σ):      72.5 ms ±   4.0 ms    [User: 64.5 ms, System: 7.8 ms]
  Range (min … max):    67.1 ms …  84.2 ms    35 runs

Benchmark 2: ./dwarfsck --no-check -q td.dwarfs
  Time (mean ± σ):      16.0 ms ±   0.9 ms    [User: 8.6 ms, System: 7.3 ms]
  Range (min … max):    14.4 ms …  19.5 ms    161 runs

Summary
  ./dwarfsck --no-check -q td.dwarfs ran
    4.54 ± 0.35 times faster than ./dwarfsck.orig --no-check -q td.dwarfs
```
2025-09-11 22:45:21 +02:00
Marcus Holland-Moritz
be3e1533b3 chore: update TODO 2025-09-11 22:45:21 +02:00
Marcus Holland-Moritz
d8d3317a86 refactor(rewrite_filesystem): reduce scope of block_no 2025-09-11 22:45:21 +02:00
Marcus Holland-Moritz
586ff3c0e7 refactor: make all single-argument ctors explicit 2025-09-11 22:45:21 +02:00
Marcus Holland-Moritz
d8c25f51e3 refactor: fix some clang-tidy warnings 2025-09-11 22:45:21 +02:00
Ahmad Khalifa
7675900f36 Fix dwarfs2 when building shared libraries 2025-09-11 22:38:12 +02:00
Ahmad Khalifa
c9411605b3 Move dwarfs/dwarfs2 to /bin from /sbin 2025-09-11 22:38:12 +02:00
Marcus Holland-Moritz
02c9101266 fix: use GPL-3.0-or-later instead of GPL-3.0-only (fixes gh #275) 2025-09-11 22:02:46 +02:00
Marcus Holland-Moritz
ea9f34404e chore: skip a few builds while not in release mode 2025-09-11 22:02:46 +02:00
Marcus Holland-Moritz
ba427d5c82 chore: fix typo in release script v0.13.0 2025-08-29 19:29:32 +02:00
Marcus Holland-Moritz
e0f9b09518 chore: update change log 2025-08-29 18:22:44 +02:00
Marcus Holland-Moritz
d892975936 chore: rename frozen_analysis_details to frozen_details 2025-08-29 17:18:03 +02:00
Marcus Holland-Moritz
d540ade893 test(dwarfsextract): test --format=auto errors 2025-08-29 17:18:03 +02:00
Marcus Holland-Moritz
ddef5f50d8 docs(mkdwarfs): add section on virtual block size 2025-08-29 17:18:03 +02:00
Marcus Holland-Moritz
1370bbb385 refactor(fits_categorizer): turn exception into assertion 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
02a8875d5d chore: make a note that FITS is always big-endian 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
4c6e652ba7 test: add more hotness categorizer tests 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
6ac0b355e4 test(pcmaudio): test unexpected-end-of-file condition 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
ce7cbb8dcf refactor(pcmaudio_categorizer): replace exceptions with assertions 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
23c8c26b03 refactor(categorizer): replace logging with assertion 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
16662ebdaf test(mkdwarfs): check unknown categorizer 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
2c9ea48bd9 refactor(mkdwarfs): catch exceptions when building categorizers 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
1d426f3331 refactor(categorizer): replace exception with assertion 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
181098e0c0 refactor(categorizer): remove unused code 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
38676f1bb6 test(mkdwarfs): more --order tests 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
04d1d8dde0 refactor(category_resolver): replace exception with assertion 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
9282abe2a2 refactor(writer_progress): remove unused code 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
cff0e2e60e test: check logging for duplicates in --input-list 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
67720ab810 feat(scanner): log when we skip duplicates in --input-list 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
56361180d6 refactor(filesystem_writer): turn exceptions into assertions 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
ded9977613 refactor(entry): replace exceptions with assertions 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
0685f4d4a6 refactor: start with slightly smaller chunk sizes 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
f57a7ff558 test(mkdwarfs): test --no-section-index 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
9ec7d9fa17 feat(filesystem_v2): add section index validity to dump / json output 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
5cb892b7fb refactor(metadata_types): remove unused code 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
ff06308f65 test(filesystem): excercise all section index code paths 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
6e1c6c426e chore(filesystem_parser): remove redundant check 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
6ec670f0bd fix: handle section index endianness correctly 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
a2db02126f test(compat): test has_valid_section_index() 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
968328d0bb feat(filesystem_v2): add has_valid_section_index() 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
3e86f01c33 test: add some file system parser tests 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
811cf7906b refactor(filesystem_parser): better error messages 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
586e306031 test: add test for block number out of range 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
b929fda3dc refactor(block_cache): turn exception into assertion for block size check 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
cb742bcd55 test(dwarfsck): make sure metadata version history is shown in analysis 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
9e363e279e test(mkdwarfs): check that input must be a directory 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
dcf67e0ad2 chore(mkdwarfs): slightly improve error reporting on non-existent file 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
dbeaf29e10 test(mkdwarfs): check warning when trying to increase time resolution 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
069943f479 refactor(inode_manager): reformat switch in ordered_span 2025-08-29 16:03:12 +02:00
Marcus Holland-Moritz
7ee1c69836 test: use fixtures to simplify some tests 2025-08-29 16:03:12 +02:00