@@ -1023,8 +1023,8 @@ EndPrepare(GlobalTransaction gxact)
1023
1023
TwoPhaseFileHeader * hdr ;
1024
1024
char path [MAXPGPATH ];
1025
1025
StateFileChunk * record ;
1026
- pg_crc32 statefile_crc ;
1027
- pg_crc32 bogus_crc ;
1026
+ pg_crc32c statefile_crc ;
1027
+ pg_crc32c bogus_crc ;
1028
1028
int fd ;
1029
1029
1030
1030
/* Add the end sentinel to the list of 2PC records */
@@ -1034,7 +1034,7 @@ EndPrepare(GlobalTransaction gxact)
1034
1034
/* Go back and fill in total_len in the file header record */
1035
1035
hdr = (TwoPhaseFileHeader * ) records .head -> data ;
1036
1036
Assert (hdr -> magic == TWOPHASE_MAGIC );
1037
- hdr -> total_len = records .total_len + sizeof (pg_crc32 );
1037
+ hdr -> total_len = records .total_len + sizeof (pg_crc32c );
1038
1038
1039
1039
/*
1040
1040
* If the file size exceeds MaxAllocSize, we won't be able to read it in
@@ -1082,7 +1082,7 @@ EndPrepare(GlobalTransaction gxact)
1082
1082
*/
1083
1083
bogus_crc = ~statefile_crc ;
1084
1084
1085
- if ((write (fd , & bogus_crc , sizeof (pg_crc32 ))) != sizeof (pg_crc32 ))
1085
+ if ((write (fd , & bogus_crc , sizeof (pg_crc32c ))) != sizeof (pg_crc32c ))
1086
1086
{
1087
1087
CloseTransientFile (fd );
1088
1088
ereport (ERROR ,
@@ -1091,7 +1091,7 @@ EndPrepare(GlobalTransaction gxact)
1091
1091
}
1092
1092
1093
1093
/* Back up to prepare for rewriting the CRC */
1094
- if (lseek (fd , - ((off_t ) sizeof (pg_crc32 )), SEEK_CUR ) < 0 )
1094
+ if (lseek (fd , - ((off_t ) sizeof (pg_crc32c )), SEEK_CUR ) < 0 )
1095
1095
{
1096
1096
CloseTransientFile (fd );
1097
1097
ereport (ERROR ,
@@ -1135,7 +1135,7 @@ EndPrepare(GlobalTransaction gxact)
1135
1135
/* If we crash now, we have prepared: WAL replay will fix things */
1136
1136
1137
1137
/* write correct CRC and close file */
1138
- if ((write (fd , & statefile_crc , sizeof (pg_crc32 ))) != sizeof (pg_crc32 ))
1138
+ if ((write (fd , & statefile_crc , sizeof (pg_crc32c ))) != sizeof (pg_crc32c ))
1139
1139
{
1140
1140
CloseTransientFile (fd );
1141
1141
ereport (ERROR ,
@@ -1223,7 +1223,7 @@ ReadTwoPhaseFile(TransactionId xid, bool give_warnings)
1223
1223
int fd ;
1224
1224
struct stat stat ;
1225
1225
uint32 crc_offset ;
1226
- pg_crc32 calc_crc ,
1226
+ pg_crc32c calc_crc ,
1227
1227
file_crc ;
1228
1228
1229
1229
TwoPhaseFilePath (path , xid );
@@ -1258,14 +1258,14 @@ ReadTwoPhaseFile(TransactionId xid, bool give_warnings)
1258
1258
1259
1259
if (stat .st_size < (MAXALIGN (sizeof (TwoPhaseFileHeader )) +
1260
1260
MAXALIGN (sizeof (TwoPhaseRecordOnDisk )) +
1261
- sizeof (pg_crc32 )) ||
1261
+ sizeof (pg_crc32c )) ||
1262
1262
stat .st_size > MaxAllocSize )
1263
1263
{
1264
1264
CloseTransientFile (fd );
1265
1265
return NULL ;
1266
1266
}
1267
1267
1268
- crc_offset = stat .st_size - sizeof (pg_crc32 );
1268
+ crc_offset = stat .st_size - sizeof (pg_crc32c );
1269
1269
if (crc_offset != MAXALIGN (crc_offset ))
1270
1270
{
1271
1271
CloseTransientFile (fd );
@@ -1302,7 +1302,7 @@ ReadTwoPhaseFile(TransactionId xid, bool give_warnings)
1302
1302
COMP_CRC32C (calc_crc , buf , crc_offset );
1303
1303
FIN_CRC32C (calc_crc );
1304
1304
1305
- file_crc = * ((pg_crc32 * ) (buf + crc_offset ));
1305
+ file_crc = * ((pg_crc32c * ) (buf + crc_offset ));
1306
1306
1307
1307
if (!EQ_CRC32C (calc_crc , file_crc ))
1308
1308
{
@@ -1545,7 +1545,7 @@ void
1545
1545
RecreateTwoPhaseFile (TransactionId xid , void * content , int len )
1546
1546
{
1547
1547
char path [MAXPGPATH ];
1548
- pg_crc32 statefile_crc ;
1548
+ pg_crc32c statefile_crc ;
1549
1549
int fd ;
1550
1550
1551
1551
/* Recompute CRC */
@@ -1572,7 +1572,7 @@ RecreateTwoPhaseFile(TransactionId xid, void *content, int len)
1572
1572
(errcode_for_file_access (),
1573
1573
errmsg ("could not write two-phase state file: %m" )));
1574
1574
}
1575
- if (write (fd , & statefile_crc , sizeof (pg_crc32 )) != sizeof (pg_crc32 ))
1575
+ if (write (fd , & statefile_crc , sizeof (pg_crc32c )) != sizeof (pg_crc32c ))
1576
1576
{
1577
1577
CloseTransientFile (fd );
1578
1578
ereport (ERROR ,
0 commit comments