feat(fileio): move size helpers to Rust
Move the file-stat size scan and highest-bit helper behind Rust ABI implementations while preserving the C file-I/O surface and unknown-size sentinel behavior. Add temporary-file and boundary coverage for the migrated helpers. Test Plan: cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features cli,compression,decompression,benchmark; cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features helpers; cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets --no-default-features --features cli,compression,decompression,benchmark; cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets --no-default-features --features helpers; make -B -C programs -j2 zstd zstd-small zstd-frugal; make -B -C tests -j2 test-cli-tests
This commit is contained in:
+4
-11
@@ -307,6 +307,8 @@ static int FIO_shouldDisplayMultipleFileSummary(FIO_ctx_t const* fCtx)
|
||||
/* These symbols are implemented by rust/src/fileio_prefs.rs. The declarations
|
||||
* in fileio.h remain the C ABI shims while all actual file I/O stays here. */
|
||||
int FIO_rust_checkFilenameCollisions(const char** filenameTable, unsigned nbFiles);
|
||||
unsigned FIO_rust_highbit64(unsigned long long v);
|
||||
unsigned long long FIO_rust_getLargestFileSize(const char** inFileNames, unsigned nbFiles);
|
||||
|
||||
|
||||
/*-*************************************
|
||||
@@ -702,11 +704,8 @@ FIO_createFilename_fromOutDir(const char* path, const char* outDirName, const si
|
||||
*/
|
||||
static unsigned FIO_highbit64(unsigned long long v)
|
||||
{
|
||||
unsigned count = 0;
|
||||
assert(v != 0);
|
||||
v >>= 1;
|
||||
while (v) { v >>= 1; count++; }
|
||||
return count;
|
||||
return FIO_rust_highbit64(v);
|
||||
}
|
||||
|
||||
static void FIO_adjustMemLimitForPatchFromMode(FIO_prefs_t* const prefs,
|
||||
@@ -1948,13 +1947,7 @@ FIO_determineCompressedName(const char* srcFileName, const char* outDirName, con
|
||||
|
||||
static unsigned long long FIO_getLargestFileSize(const char** inFileNames, unsigned nbFiles)
|
||||
{
|
||||
size_t i;
|
||||
unsigned long long fileSize, maxFileSize = 0;
|
||||
for (i = 0; i < nbFiles; i++) {
|
||||
fileSize = UTIL_getFileSize(inFileNames[i]);
|
||||
maxFileSize = fileSize > maxFileSize ? fileSize : maxFileSize;
|
||||
}
|
||||
return maxFileSize;
|
||||
return FIO_rust_getLargestFileSize(inFileNames, nbFiles);
|
||||
}
|
||||
|
||||
/* FIO_compressMultipleFilenames() :
|
||||
|
||||
Reference in New Issue
Block a user