ChunkerFixed can be configured to support files with a specific header size.
But we do not want to get an AssertionError if we encounter a 0-byte file
or a file that is shorter than the header size.
no options yet, just hardcoded macOS and Linux xattrs.
removed the --exclude-nodump option, it is also done automagically now.
also: create: call stat_ext_attrs early
this reads bsdflags, xattrs and ACLs from the
filesystem, except if the user chose to disable that.
notable:
- borg always reads these, even for unchanged files
- if we read them early, borg can now behave differently
based e.g. on a xattr value (and e.g. exclude the file)
we want to get rid of legacy stuff(*) one day and sha256 is as
good for this purpose (and might be even hw accelerated).
(*) considered legacy due to the way it gives the key to the
blake2b function (just padding and prepending it to the data,
instead of using the key parameter, see #8867 ).
Replaced inline file reading logic with `FileReader` to standardize handling across chunkers. Improved buffer updates and allocation handling for sparse files and optimized read operations.
Includes cases for simple reads, multiple reads, and mock chunk scenarios to verify behavior with mixed allocation types.
Also: change Chunk type for empty read result for better consistency.
Simplified and improved handling of mixed types of chunks during reading. The allocation type of resulting chunks is now determined based on contributing chunks.
The `header_size` parameter and related logic have been removed from file readers, simplifying their implementation. This change eliminates unnecessary complexity while maintaining all functional capabilities via `read_size` and `fmap`.
`FileFMAPReader` deals with sparse files (data vs holes) or fmap and yields blocks of some specific read_size using a generator.
`FileReader` uses the `FileFMAPReader` to fill an internal buffer and lets users use its `read` method to read arbitrary sized chunks from the buffer.
For both classes, instances now only deal with a single file.
Replaced `ChunkerFixed`'s block-reading functionality with a new `FileReader` class to streamline code and improve separation of concerns. Adjusted `ChunkerFixed` to delegate file reading to `FileReader` while focusing on chunk assembly.
`FileReader` is intended to be useful for other chunkers also, so they can easily implement sparse file reading / fmap support.