]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/blocksource: stop using `xmmap()`
authorPatrick Steinhardt <ps@pks.im>
Tue, 18 Feb 2025 09:20:39 +0000 (10:20 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Feb 2025 18:55:35 +0000 (10:55 -0800)
commit70afa6fa318db517adb0cc7d4cb66260061bb684
tree1495b671dcae9385a0512dae4a42bec542b9b893
parente31db89558b7f1d622e5a64cf37779b721099814
reftable/blocksource: stop using `xmmap()`

We use `xmmap()` to map reftables into memory. This function has two
problems:

  - It causes us to die in case the mmap fails.

  - It ties us to the Git codebase.

Refactor the code to use mmap(3p) instead with manual error checking.
Note that this function may not be the system-provided mmap(3p), but may
point to our `git_mmap()` wrapper that emulates the syscall on systems
that do not have mmap(3p) available.

Fix `reftable_block_source_from_file()` to properly bubble up the error
code in case the map(3p) call fails.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/blocksource.c