Skip to content

Commit c68c788

Browse files
committed
enums for get_crc32
1 parent c5f1eea commit c68c788

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/utils/file.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,11 @@ 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 */
13591364
pg_crc32
13601365
fio_get_crc32(const char *file_path, fio_location location,
@@ -1371,9 +1376,9 @@ fio_get_crc32(const char *file_path, fio_location location,
13711376
hdr.arg = 0;
13721377

13731378
if (decompress)
1374-
hdr.arg = 1;
1379+
hdr.arg = GET_CRC32_DECOMPRESS;
13751380
if (missing_ok)
1376-
hdr.arg |= 2;
1381+
hdr.arg |= GET_CRC32_MISSING_OK;
13771382

13781383
IO_CHECK(fio_write_all(fio_stdout, &hdr, sizeof(hdr)), sizeof(hdr));
13791384
IO_CHECK(fio_write_all(fio_stdout, file_path, path_len), path_len);
@@ -3383,10 +3388,10 @@ fio_communicate(int in, int out)
33833388
break;
33843389
case FIO_GET_CRC32:
33853390
/* calculate crc32 for a file */
3386-
if ((hdr.arg & 1))
3387-
crc = pgFileGetCRCgz(buf, true, (hdr.arg & 2) != 0);
3391+
if ((hdr.arg & GET_CRC32_DECOMPRESS))
3392+
crc = pgFileGetCRCgz(buf, true, (hdr.arg & GET_CRC32_MISSING_OK) != 0);
33883393
else
3389-
crc = pgFileGetCRC(buf, true, (hdr.arg & 2) != 0);
3394+
crc = pgFileGetCRC(buf, true, (hdr.arg & GET_CRC32_MISSING_OK) != 0);
33903395
IO_CHECK(fio_write_all(out, &crc, sizeof(crc)), sizeof(crc));
33913396
break;
33923397
case FIO_GET_CHECKSUM_MAP:

0 commit comments

Comments
 (0)