@@ -1355,9 +1355,15 @@ fio_sync(char const* path, fio_location location)
13551355 }
13561356}
13571357
1358+ enum {
1359+ GET_CRC32_DECOMPRESS = 1 ,
1360+ GET_CRC32_MISSING_OK = 2
1361+ };
1362+
13581363/* Get crc32 of file */
13591364pg_crc32
1360- fio_get_crc32 (const char * file_path , fio_location location , bool decompress )
1365+ fio_get_crc32 (const char * file_path , fio_location location ,
1366+ bool decompress , bool missing_ok )
13611367{
13621368 if (fio_is_remote (location ))
13631369 {
@@ -1370,7 +1376,9 @@ fio_get_crc32(const char *file_path, fio_location location, bool decompress)
13701376 hdr .arg = 0 ;
13711377
13721378 if (decompress )
1373- hdr .arg = 1 ;
1379+ hdr .arg = GET_CRC32_DECOMPRESS ;
1380+ if (missing_ok )
1381+ hdr .arg |= GET_CRC32_MISSING_OK ;
13741382
13751383 IO_CHECK (fio_write_all (fio_stdout , & hdr , sizeof (hdr )), sizeof (hdr ));
13761384 IO_CHECK (fio_write_all (fio_stdout , file_path , path_len ), path_len );
@@ -1381,9 +1389,9 @@ fio_get_crc32(const char *file_path, fio_location location, bool decompress)
13811389 else
13821390 {
13831391 if (decompress )
1384- return pgFileGetCRCgz (file_path , true, true );
1392+ return pgFileGetCRCgz (file_path , true, missing_ok );
13851393 else
1386- return pgFileGetCRC (file_path , true, true );
1394+ return pgFileGetCRC (file_path , true, missing_ok );
13871395 }
13881396}
13891397
@@ -3380,10 +3388,10 @@ fio_communicate(int in, int out)
33803388 break ;
33813389 case FIO_GET_CRC32 :
33823390 /* calculate crc32 for a file */
3383- if (hdr .arg == 1 )
3384- crc = pgFileGetCRCgz (buf , true, true );
3391+ if (( hdr .arg & GET_CRC32_DECOMPRESS ) )
3392+ crc = pgFileGetCRCgz (buf , true, ( hdr . arg & GET_CRC32_MISSING_OK ) != 0 );
33853393 else
3386- crc = pgFileGetCRC (buf , true, true );
3394+ crc = pgFileGetCRC (buf , true, ( hdr . arg & GET_CRC32_MISSING_OK ) != 0 );
33873395 IO_CHECK (fio_write_all (out , & crc , sizeof (crc )), sizeof (crc ));
33883396 break ;
33893397 case FIO_GET_CHECKSUM_MAP :
0 commit comments