ftwin 0.8.10
|
Interface for file comparison and checksum calculation. More...
Go to the source code of this file.
Functions | |
apr_status_t | checksum_file (const char *filename, apr_off_t size, apr_off_t excess_size, ft_hash_t *hash_out, apr_pool_t *gc_pool) |
Calculates the XXH128 checksum of a file. | |
apr_status_t | filecmp (apr_pool_t *pool, const char *fname1, const char *fname2, apr_off_t size, apr_off_t excess_size, int *result_out) |
Compares two files byte-by-byte to determine if they are identical. | |
Interface for file comparison and checksum calculation.
Definition in file ft_file.h.
apr_status_t checksum_file | ( | const char * | filename, |
apr_off_t | size, | ||
apr_off_t | excess_size, | ||
ft_hash_t * | hash_out, | ||
apr_pool_t * | gc_pool | ||
) |
Calculates the XXH128 checksum of a file.
This function handles both small files (using memory-mapping for efficiency if possible) and large files (using buffered reading). The determination is based on the excess_size
parameter.
[in] | filename | The path to the file. |
[in] | size | The size of the file. |
[in] | excess_size | The file size threshold above which buffered reading is used instead of mmap. |
[out] | hash_out | Pointer to a ft_hash_t structure to store the resulting checksum. |
[in] | gc_pool | An APR pool for temporary allocations during the operation. |
apr_status_t filecmp | ( | apr_pool_t * | pool, |
const char * | fname1, | ||
const char * | fname2, | ||
apr_off_t | size, | ||
apr_off_t | excess_size, | ||
int * | result_out | ||
) |
Compares two files byte-by-byte to determine if they are identical.
This function intelligently chooses between memory-mapping for smaller files and buffered reading for larger files, based on the excess_size
threshold.
[in] | pool | The APR pool to use for allocations. |
[in] | fname1 | The path to the first file. |
[in] | fname2 | The path to the second file. |
[in] | size | The size of the files (assumed to be identical). |
[in] | excess_size | The file size threshold to switch from mmap to buffered I/O. |
[out] | i | Pointer to an integer that will be set to 0 if the files are identical, or a non-zero value otherwise. |
Definition at line 285 of file ft_file.c.
Referenced by ft_report_json().