feat(fileio): move buffer helpers to Rust
Route file-I/O input/output buffer construction and the LZ4 block-size mapping through Rust ABI leaves while preserving the existing C helper names and public buffer layouts. Add layout, field, and formula coverage. Test Plan: cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features cli,compression,decompression,benchmark; cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets --no-default-features --features cli,compression,decompression,benchmark; make -B -C programs -j2 zstd zstd-small zstd-frugal; make -B -C tests -j2 test-cli-tests
This commit is contained in:
+11
-7
@@ -309,6 +309,11 @@ static int FIO_shouldDisplayMultipleFileSummary(FIO_ctx_t const* fCtx)
|
||||
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);
|
||||
void FIO_rust_setInBuffer(ZSTD_inBuffer* output, const void* buf, size_t s, size_t pos);
|
||||
void FIO_rust_setOutBuffer(ZSTD_outBuffer* output, void* buf, size_t s, size_t pos);
|
||||
#ifdef ZSTD_LZ4COMPRESS
|
||||
int FIO_rust_LZ4_GetBlockSize_FromBlockId(int id);
|
||||
#endif
|
||||
|
||||
|
||||
/*-*************************************
|
||||
@@ -792,18 +797,14 @@ static int FIO_multiFilesConcatWarning(const FIO_ctx_t* fCtx, FIO_prefs_t* prefs
|
||||
static ZSTD_inBuffer setInBuffer(const void* buf, size_t s, size_t pos)
|
||||
{
|
||||
ZSTD_inBuffer i;
|
||||
i.src = buf;
|
||||
i.size = s;
|
||||
i.pos = pos;
|
||||
FIO_rust_setInBuffer(&i, buf, s, pos);
|
||||
return i;
|
||||
}
|
||||
|
||||
static ZSTD_outBuffer setOutBuffer(void* buf, size_t s, size_t pos)
|
||||
{
|
||||
ZSTD_outBuffer o;
|
||||
o.dst = buf;
|
||||
o.size = s;
|
||||
o.pos = pos;
|
||||
FIO_rust_setOutBuffer(&o, buf, s, pos);
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -1140,7 +1141,10 @@ FIO_compressLzmaFrame(cRess_t* ress,
|
||||
#define LZ4F_max64KB max64KB
|
||||
#endif
|
||||
|
||||
static int FIO_LZ4_GetBlockSize_FromBlockId (int id) { return (1 << (8 + (2 * id))); }
|
||||
static int FIO_LZ4_GetBlockSize_FromBlockId (int id)
|
||||
{
|
||||
return FIO_rust_LZ4_GetBlockSize_FromBlockId(id);
|
||||
}
|
||||
|
||||
static unsigned long long
|
||||
FIO_compressLz4Frame(cRess_t* ress,
|
||||
|
||||
Reference in New Issue
Block a user