Commit Graph

15 Commits

Author SHA1 Message Date
Tor Arne Vestbø
06dd45bfd5 Do special case ENOENT after all
Otherwise seeking into a raw dmg file will fail when hitting
parts of it that are not covered by a band. The expectation
in that case is to pad with zeroes, like we do for partial
bands.
2021-06-30 23:22:09 +02:00
Tor Arne Vestbø
b3f62d8f66 Add option to always close band files after use 2021-06-30 23:03:18 +02:00
Tor Arne Vestbø
5b75eeeebd Forward error code from process_band function 2021-06-30 22:52:49 +02:00
Tor Arne Vestbø
324d41ed89 Don't special case ENOENT (no such file) when opening bands
If a band is missing that's an error, and should be reported
as such.
2021-06-30 22:51:06 +02:00
Tor Arne Vestbø
3392ba1be1 Return -1 from sparsebundle_open_file on failure
As per the expectation of the call sites. Returning errno is not
necessary, as the caller can check errno directly.
2021-06-30 22:50:32 +02:00
Tor Arne Vestbø
c5dfc45e30 Use same variable name for band file descriptor 2021-06-30 22:50:32 +02:00
Tor Arne Vestbø
00a45b9edc Keep files open for non-zero-copy reads as well
Opening and closing files is bad for performance, so now that
we accurately track the situation of hitting too many open files
we can keep the band files open, even for the non-readbuf code
path.

This unifies the logic of opening (and caching file descriptors)
between the readbuf and non-readbuf code paths.
2021-06-30 22:50:32 +02:00
Tor Arne Vestbø
b5398b1958 Catch EMFILE instead of trying to compute when we'll hit max open files
The previous logic was flawed anyways, as reading a range could
potentially span multiple bands, but we only checked if we were
just below the max limit.
2021-06-30 22:28:50 +02:00
Tor Arne Vestbø
a52497c2b6 Log when we're opening and closing files for basic reads 2021-06-30 22:28:13 +02:00
Tor Arne Vestbø
47d66c39bb Add option and test for reading without read_buf 2021-06-27 23:46:16 +02:00
Tor Arne Vestbø
365d3a35cd Use hfsfuse to test correctness of sparsebundlefs 2021-06-27 23:32:55 +02:00
Tor Arne Vestbø
24400ff67b Use .tst extension for tests suites 2021-06-27 22:07:56 +02:00
Tor Arne Vestbø
6c837549ad Use short-form of testsuite when printing missing testcase 2021-06-27 22:07:55 +02:00
Tor Arne Vestbø
fb86e90f00 Run test setup and teardown the same way test cases are run 2021-06-27 22:07:55 +02:00
Tor Arne Vestbø
b70e8fb4be Move sources into their own subdirectory 2021-06-27 19:55:01 +02:00