@@ -819,7 +819,7 @@ typedef struct {
819819 const char * dictFileName ;
820820 ZSTD_CStream * cctx ;
821821 WritePoolCtx_t * writeCtx ;
822- read_pool_ctx_t * readCtx ;
822+ ReadPoolCtx_t * readCtx ;
823823} cRess_t ;
824824
825825/** ZSTD_cycleLog() :
@@ -878,7 +878,7 @@ static cRess_t FIO_createCResources(FIO_prefs_t* const prefs,
878878 ress .dictBufferSize = FIO_createDictBuffer (& ress .dictBuffer , dictFileName , prefs ); /* works with dictFileName==NULL */
879879
880880 ress .writeCtx = AIO_WritePool_create (prefs , ZSTD_CStreamOutSize ());
881- ress .readCtx = ReadPool_create (prefs , ZSTD_CStreamInSize ());
881+ ress .readCtx = AIO_ReadPool_create (prefs , ZSTD_CStreamInSize ());
882882
883883 /* Advanced parameters, including dictionary */
884884 if (dictFileName && (ress .dictBuffer == NULL ))
@@ -943,7 +943,7 @@ static void FIO_freeCResources(const cRess_t* const ress)
943943{
944944 free (ress -> dictBuffer );
945945 AIO_WritePool_free (ress -> writeCtx );
946- ReadPool_free (ress -> readCtx );
946+ AIO_ReadPool_free (ress -> readCtx );
947947 ZSTD_freeCStream (ress -> cctx ); /* never fails */
948948}
949949
@@ -981,7 +981,7 @@ FIO_compressGzFrame(const cRess_t* ress, /* buffers & handlers are used, but no
981981 while (1 ) {
982982 int ret ;
983983 if (strm .avail_in == 0 ) {
984- ReadPool_fillBuffer (ress -> readCtx , ZSTD_CStreamInSize ());
984+ AIO_ReadPool_fillBuffer (ress -> readCtx , ZSTD_CStreamInSize ());
985985 if (ress -> readCtx -> srcBufferLoaded == 0 ) break ;
986986 inFileSize += ress -> readCtx -> srcBufferLoaded ;
987987 strm .next_in = (z_const unsigned char * )ress -> readCtx -> srcBuffer ;
@@ -991,7 +991,7 @@ FIO_compressGzFrame(const cRess_t* ress, /* buffers & handlers are used, but no
991991 {
992992 size_t const availBefore = strm .avail_in ;
993993 ret = deflate (& strm , Z_NO_FLUSH );
994- ReadPool_consumeBytes (ress -> readCtx , availBefore - strm .avail_in );
994+ AIO_ReadPool_consumeBytes (ress -> readCtx , availBefore - strm .avail_in );
995995 }
996996
997997 if (ret != Z_OK )
@@ -1077,7 +1077,7 @@ FIO_compressLzmaFrame(cRess_t* ress,
10771077
10781078 while (1 ) {
10791079 if (strm .avail_in == 0 ) {
1080- size_t const inSize = ReadPool_fillBuffer (ress -> readCtx , ZSTD_CStreamInSize ());
1080+ size_t const inSize = AIO_ReadPool_fillBuffer (ress -> readCtx , ZSTD_CStreamInSize ());
10811081 if (ress -> readCtx -> srcBufferLoaded == 0 ) action = LZMA_FINISH ;
10821082 inFileSize += inSize ;
10831083 strm .next_in = (BYTE const * )ress -> readCtx -> srcBuffer ;
@@ -1087,7 +1087,7 @@ FIO_compressLzmaFrame(cRess_t* ress,
10871087 {
10881088 size_t const availBefore = strm .avail_in ;
10891089 ret = lzma_code (& strm , action );
1090- ReadPool_consumeBytes (ress -> readCtx , availBefore - strm .avail_in );
1090+ AIO_ReadPool_consumeBytes (ress -> readCtx , availBefore - strm .avail_in );
10911091 }
10921092
10931093
@@ -1174,7 +1174,7 @@ FIO_compressLz4Frame(cRess_t* ress,
11741174 outFileSize += headerSize ;
11751175
11761176 /* Read first block */
1177- readSize = ReadPool_fillBuffer (ress -> readCtx , blockSize );
1177+ readSize = AIO_ReadPool_fillBuffer (ress -> readCtx , blockSize );
11781178 inFileSize += readSize ;
11791179
11801180 /* Main Loop */
@@ -1200,8 +1200,8 @@ FIO_compressLz4Frame(cRess_t* ress,
12001200 AIO_WritePool_enqueueAndReacquireWriteJob (& writeJob );
12011201
12021202 /* Read next block */
1203- ReadPool_consumeBytes (ress -> readCtx , ress -> readCtx -> srcBufferLoaded );
1204- readSize = ReadPool_fillBuffer (ress -> readCtx , blockSize );
1203+ AIO_ReadPool_consumeBytes (ress -> readCtx , ress -> readCtx -> srcBufferLoaded );
1204+ readSize = AIO_ReadPool_fillBuffer (ress -> readCtx , blockSize );
12051205 inFileSize += readSize ;
12061206 }
12071207
@@ -1234,7 +1234,7 @@ FIO_compressZstdFrame(FIO_ctx_t* const fCtx,
12341234 int compressionLevel , U64 * readsize )
12351235{
12361236 cRess_t const ress = * ressPtr ;
1237- IOJob_t * writeJob = AIO_WritePool_acquireJob (ressPtr -> writeCtx );
1237+ IOJob_t * writeJob = AIO_WritePool_acquireJob (ressPtr -> writeCtx );
12381238
12391239 U64 compressedfilesize = 0 ;
12401240 ZSTD_EndDirective directive = ZSTD_e_continue ;
@@ -1280,7 +1280,7 @@ FIO_compressZstdFrame(FIO_ctx_t* const fCtx,
12801280 do {
12811281 size_t stillToFlush ;
12821282 /* Fill input Buffer */
1283- size_t const inSize = ReadPool_fillBuffer (ress .readCtx , ZSTD_CStreamInSize ());
1283+ size_t const inSize = AIO_ReadPool_fillBuffer (ress .readCtx , ZSTD_CStreamInSize ());
12841284 ZSTD_inBuffer inBuff = { ress .readCtx -> srcBuffer , ress .readCtx -> srcBufferLoaded , 0 };
12851285 DISPLAYLEVEL (6 , "fread %u bytes from source \n" , (unsigned )inSize );
12861286 * readsize += inSize ;
@@ -1296,7 +1296,7 @@ FIO_compressZstdFrame(FIO_ctx_t* const fCtx,
12961296 ZSTD_outBuffer outBuff = { writeJob -> buffer , writeJob -> bufferSize , 0 };
12971297 size_t const toFlushNow = ZSTD_toFlushNow (ress .cctx );
12981298 CHECK_V (stillToFlush , ZSTD_compressStream2 (ress .cctx , & outBuff , & inBuff , directive ));
1299- ReadPool_consumeBytes (ress .readCtx , inBuff .pos - oldIPos );
1299+ AIO_ReadPool_consumeBytes (ress .readCtx , inBuff .pos - oldIPos );
13001300
13011301 /* count stats */
13021302 inputPresented ++ ;
@@ -1568,7 +1568,7 @@ static int FIO_compressFilename_dstFile(FIO_ctx_t* const fCtx,
15681568 stat_t statbuf ;
15691569 int transferMTime = 0 ;
15701570 FILE * dstFile ;
1571- assert (ReadPool_getFile (ress .readCtx ) != NULL );
1571+ assert (AIO_ReadPool_getFile (ress .readCtx ) != NULL );
15721572 if (AIO_WritePool_getFile (ress .writeCtx ) == NULL ) {
15731573 int dstFilePermissions = DEFAULT_FILE_PERMISSIONS ;
15741574 if ( strcmp (srcFileName , stdinmark )
@@ -1670,9 +1670,9 @@ FIO_compressFilename_srcFile(FIO_ctx_t* const fCtx,
16701670 srcFile = FIO_openSrcFile (prefs , srcFileName );
16711671 if (srcFile == NULL ) return 1 ; /* srcFile could not be opened */
16721672
1673- ReadPool_setFile (ress .readCtx , srcFile );
1673+ AIO_ReadPool_setFile (ress .readCtx , srcFile );
16741674 result = FIO_compressFilename_dstFile (fCtx , prefs , ress , dstFileName , srcFileName , compressionLevel );
1675- ReadPool_closeFile (ress .readCtx );
1675+ AIO_ReadPool_closeFile (ress .readCtx );
16761676
16771677 if ( prefs -> removeSrcFile /* --rm */
16781678 && result == 0 /* success */
@@ -1896,7 +1896,7 @@ int FIO_compressMultipleFilenames(FIO_ctx_t* const fCtx,
18961896typedef struct {
18971897 ZSTD_DStream * dctx ;
18981898 WritePoolCtx_t * writeCtx ;
1899- read_pool_ctx_t * readCtx ;
1899+ ReadPoolCtx_t * readCtx ;
19001900} dRess_t ;
19011901
19021902static dRess_t FIO_createDResources (FIO_prefs_t * const prefs , const char * dictFileName )
@@ -1922,7 +1922,7 @@ static dRess_t FIO_createDResources(FIO_prefs_t* const prefs, const char* dictFi
19221922 }
19231923
19241924 ress .writeCtx = AIO_WritePool_create (prefs , ZSTD_DStreamOutSize ());
1925- ress .readCtx = ReadPool_create (prefs , ZSTD_DStreamInSize ());
1925+ ress .readCtx = AIO_ReadPool_create (prefs , ZSTD_DStreamInSize ());
19261926
19271927 return ress ;
19281928}
@@ -1931,7 +1931,7 @@ static void FIO_freeDResources(dRess_t ress)
19311931{
19321932 CHECK ( ZSTD_freeDStream (ress .dctx ) );
19331933 AIO_WritePool_free (ress .writeCtx );
1934- ReadPool_free (ress .readCtx );
1934+ AIO_ReadPool_free (ress .readCtx );
19351935}
19361936
19371937/** FIO_passThrough() : just copy input into output, for compatibility with gzip -df mode
@@ -1940,17 +1940,17 @@ static int FIO_passThrough(dRess_t *ress)
19401940{
19411941 size_t const blockSize = MIN (MIN (64 KB , ZSTD_DStreamInSize ()), ZSTD_DStreamOutSize ());
19421942 IOJob_t * writeJob = AIO_WritePool_acquireJob (ress -> writeCtx );
1943- ReadPool_fillBuffer (ress -> readCtx , blockSize );
1943+ AIO_ReadPool_fillBuffer (ress -> readCtx , blockSize );
19441944
19451945 while (ress -> readCtx -> srcBufferLoaded ) {
19461946 size_t writeSize ;
1947- ReadPool_fillBuffer (ress -> readCtx , blockSize );
1947+ AIO_ReadPool_fillBuffer (ress -> readCtx , blockSize );
19481948 writeSize = MIN (blockSize , ress -> readCtx -> srcBufferLoaded );
19491949 assert (writeSize <= writeJob -> bufferSize );
19501950 memcpy (writeJob -> buffer , ress -> readCtx -> srcBuffer , writeSize );
19511951 writeJob -> usedBufferSize = writeSize ;
19521952 AIO_WritePool_enqueueAndReacquireWriteJob (& writeJob );
1953- ReadPool_consumeBytes (ress -> readCtx , writeSize );
1953+ AIO_ReadPool_consumeBytes (ress -> readCtx , writeSize );
19541954 }
19551955 assert (ress -> readCtx -> reachedEof );
19561956 AIO_WritePool_releaseIoJob (writeJob );
@@ -2012,7 +2012,7 @@ FIO_decompressZstdFrame(FIO_ctx_t* const fCtx, dRess_t* ress,
20122012
20132013 /* Header loading : ensures ZSTD_getFrameHeader() will succeed */
20142014 if (ress -> readCtx -> srcBufferLoaded < ZSTD_FRAMEHEADERSIZE_MAX )
2015- ReadPool_fillBuffer (ress -> readCtx , ZSTD_FRAMEHEADERSIZE_MAX );
2015+ AIO_ReadPool_fillBuffer (ress -> readCtx , ZSTD_FRAMEHEADERSIZE_MAX );
20162016
20172017 /* Main decompression Loop */
20182018 while (1 ) {
@@ -2048,14 +2048,14 @@ FIO_decompressZstdFrame(FIO_ctx_t* const fCtx, dRess_t* ress,
20482048 srcFileName , hrs .precision , hrs .value , hrs .suffix );
20492049 }
20502050
2051- ReadPool_consumeBytes (ress -> readCtx , inBuff .pos );
2051+ AIO_ReadPool_consumeBytes (ress -> readCtx , inBuff .pos );
20522052
20532053 if (readSizeHint == 0 ) break ; /* end of frame */
20542054
20552055 /* Fill input buffer */
20562056 { size_t const toDecode = MIN (readSizeHint , ZSTD_DStreamInSize ()); /* support large skippable frames */
20572057 if (ress -> readCtx -> srcBufferLoaded < toDecode ) {
2058- size_t const readSize = ReadPool_fillBuffer (ress -> readCtx , toDecode );
2058+ size_t const readSize = AIO_ReadPool_fillBuffer (ress -> readCtx , toDecode );
20592059 if (readSize == 0 ) {
20602060 DISPLAYLEVEL (1 , "%s : Read error (39) : premature end \n" ,
20612061 srcFileName );
@@ -2099,7 +2099,7 @@ FIO_decompressGzFrame(dRess_t* ress, const char* srcFileName)
20992099 for ( ; ; ) {
21002100 int ret ;
21012101 if (strm .avail_in == 0 ) {
2102- ReadPool_consumeAndRefill (ress -> readCtx );
2102+ AIO_ReadPool_consumeAndRefill (ress -> readCtx );
21032103 if (ress -> readCtx -> srcBufferLoaded == 0 ) flush = Z_FINISH ;
21042104 strm .next_in = (z_const unsigned char * )ress -> readCtx -> srcBuffer ;
21052105 strm .avail_in = (uInt )ress -> readCtx -> srcBufferLoaded ;
@@ -2125,7 +2125,7 @@ FIO_decompressGzFrame(dRess_t* ress, const char* srcFileName)
21252125 if (ret == Z_STREAM_END ) break ;
21262126 }
21272127
2128- ReadPool_consumeBytes (ress -> readCtx , ress -> readCtx -> srcBufferLoaded - strm .avail_in );
2128+ AIO_ReadPool_consumeBytes (ress -> readCtx , ress -> readCtx -> srcBufferLoaded - strm .avail_in );
21292129
21302130 if ( (inflateEnd (& strm ) != Z_OK ) /* release resources ; error detected */
21312131 && (decodingError == 0 ) ) {
@@ -2174,7 +2174,7 @@ FIO_decompressLzmaFrame(dRess_t* ress,
21742174 for ( ; ; ) {
21752175 lzma_ret ret ;
21762176 if (strm .avail_in == 0 ) {
2177- ReadPool_consumeAndRefill (ress -> readCtx );
2177+ AIO_ReadPool_consumeAndRefill (ress -> readCtx );
21782178 if (ress -> readCtx -> srcBufferLoaded == 0 ) action = LZMA_FINISH ;
21792179 strm .next_in = (BYTE const * )ress -> readCtx -> srcBuffer ;
21802180 strm .avail_in = ress -> readCtx -> srcBufferLoaded ;
@@ -2201,7 +2201,7 @@ FIO_decompressLzmaFrame(dRess_t* ress,
22012201 if (ret == LZMA_STREAM_END ) break ;
22022202 }
22032203
2204- ReadPool_consumeBytes (ress -> readCtx , ress -> readCtx -> srcBufferLoaded - strm .avail_in );
2204+ AIO_ReadPool_consumeBytes (ress -> readCtx , ress -> readCtx -> srcBufferLoaded - strm .avail_in );
22052205 lzma_end (& strm );
22062206 AIO_WritePool_releaseIoJob (writeJob );
22072207 AIO_WritePool_sparseWriteEnd (ress -> writeCtx );
@@ -2234,7 +2234,7 @@ FIO_decompressLz4Frame(dRess_t* ress, const char* srcFileName)
22342234 int fullBufferDecoded = 0 ;
22352235
22362236 /* Read input */
2237- ReadPool_fillBuffer (ress -> readCtx , nextToLoad );
2237+ AIO_ReadPool_fillBuffer (ress -> readCtx , nextToLoad );
22382238 if (!ress -> readCtx -> srcBufferLoaded ) break ; /* reached end of file */
22392239
22402240 while ((pos < ress -> readCtx -> srcBufferLoaded ) || fullBufferDecoded ) { /* still to read, or still to flush */
@@ -2264,7 +2264,7 @@ FIO_decompressLz4Frame(dRess_t* ress, const char* srcFileName)
22642264
22652265 if (!nextToLoad ) break ;
22662266 }
2267- ReadPool_consumeBytes (ress -> readCtx , pos );
2267+ AIO_ReadPool_consumeBytes (ress -> readCtx , pos );
22682268 }
22692269 if (nextToLoad != 0 ) {
22702270 DISPLAYLEVEL (1 , "zstd: %s: unfinished lz4 stream \n" , srcFileName );
@@ -2299,7 +2299,7 @@ static int FIO_decompressFrames(FIO_ctx_t* const fCtx,
22992299 /* check magic number -> version */
23002300 size_t const toRead = 4 ;
23012301 const BYTE * buf ;
2302- ReadPool_fillBuffer (ress .readCtx , toRead );
2302+ AIO_ReadPool_fillBuffer (ress .readCtx , toRead );
23032303 buf = (const BYTE * )ress .readCtx -> srcBuffer ;
23042304 if (ress .readCtx -> srcBufferLoaded == 0 ) {
23052305 if (readSomething == 0 ) { /* srcFile is empty (which is invalid) */
@@ -2446,11 +2446,11 @@ static int FIO_decompressSrcFile(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs
24462446
24472447 srcFile = FIO_openSrcFile (prefs , srcFileName );
24482448 if (srcFile == NULL ) return 1 ;
2449- ReadPool_setFile (ress .readCtx , srcFile );
2449+ AIO_ReadPool_setFile (ress .readCtx , srcFile );
24502450
24512451 result = FIO_decompressDstFile (fCtx , prefs , ress , dstFileName , srcFileName );
24522452
2453- ReadPool_setFile (ress .readCtx , NULL );
2453+ AIO_ReadPool_setFile (ress .readCtx , NULL );
24542454
24552455 /* Close file */
24562456 if (fclose (srcFile )) {
0 commit comments