@@ -1023,8 +1023,8 @@ EndPrepare(GlobalTransaction gxact)
10231023 TwoPhaseFileHeader * hdr ;
10241024 char path [MAXPGPATH ];
10251025 StateFileChunk * record ;
1026- pg_crc32 statefile_crc ;
1027- pg_crc32 bogus_crc ;
1026+ pg_crc32c statefile_crc ;
1027+ pg_crc32c bogus_crc ;
10281028 int fd ;
10291029
10301030 /* Add the end sentinel to the list of 2PC records */
@@ -1034,7 +1034,7 @@ EndPrepare(GlobalTransaction gxact)
10341034 /* Go back and fill in total_len in the file header record */
10351035 hdr = (TwoPhaseFileHeader * ) records .head -> data ;
10361036 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 );
10381038
10391039 /*
10401040 * If the file size exceeds MaxAllocSize, we won't be able to read it in
@@ -1082,7 +1082,7 @@ EndPrepare(GlobalTransaction gxact)
10821082 */
10831083 bogus_crc = ~statefile_crc ;
10841084
1085- if ((write (fd , & bogus_crc , sizeof (pg_crc32 ))) != sizeof (pg_crc32 ))
1085+ if ((write (fd , & bogus_crc , sizeof (pg_crc32c ))) != sizeof (pg_crc32c ))
10861086 {
10871087 CloseTransientFile (fd );
10881088 ereport (ERROR ,
@@ -1091,7 +1091,7 @@ EndPrepare(GlobalTransaction gxact)
10911091 }
10921092
10931093 /* 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 )
10951095 {
10961096 CloseTransientFile (fd );
10971097 ereport (ERROR ,
@@ -1135,7 +1135,7 @@ EndPrepare(GlobalTransaction gxact)
11351135 /* If we crash now, we have prepared: WAL replay will fix things */
11361136
11371137 /* 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 ))
11391139 {
11401140 CloseTransientFile (fd );
11411141 ereport (ERROR ,
@@ -1223,7 +1223,7 @@ ReadTwoPhaseFile(TransactionId xid, bool give_warnings)
12231223 int fd ;
12241224 struct stat stat ;
12251225 uint32 crc_offset ;
1226- pg_crc32 calc_crc ,
1226+ pg_crc32c calc_crc ,
12271227 file_crc ;
12281228
12291229 TwoPhaseFilePath (path , xid );
@@ -1258,14 +1258,14 @@ ReadTwoPhaseFile(TransactionId xid, bool give_warnings)
12581258
12591259 if (stat .st_size < (MAXALIGN (sizeof (TwoPhaseFileHeader )) +
12601260 MAXALIGN (sizeof (TwoPhaseRecordOnDisk )) +
1261- sizeof (pg_crc32 )) ||
1261+ sizeof (pg_crc32c )) ||
12621262 stat .st_size > MaxAllocSize )
12631263 {
12641264 CloseTransientFile (fd );
12651265 return NULL ;
12661266 }
12671267
1268- crc_offset = stat .st_size - sizeof (pg_crc32 );
1268+ crc_offset = stat .st_size - sizeof (pg_crc32c );
12691269 if (crc_offset != MAXALIGN (crc_offset ))
12701270 {
12711271 CloseTransientFile (fd );
@@ -1302,7 +1302,7 @@ ReadTwoPhaseFile(TransactionId xid, bool give_warnings)
13021302 COMP_CRC32C (calc_crc , buf , crc_offset );
13031303 FIN_CRC32C (calc_crc );
13041304
1305- file_crc = * ((pg_crc32 * ) (buf + crc_offset ));
1305+ file_crc = * ((pg_crc32c * ) (buf + crc_offset ));
13061306
13071307 if (!EQ_CRC32C (calc_crc , file_crc ))
13081308 {
@@ -1545,7 +1545,7 @@ void
15451545RecreateTwoPhaseFile (TransactionId xid , void * content , int len )
15461546{
15471547 char path [MAXPGPATH ];
1548- pg_crc32 statefile_crc ;
1548+ pg_crc32c statefile_crc ;
15491549 int fd ;
15501550
15511551 /* Recompute CRC */
@@ -1572,7 +1572,7 @@ RecreateTwoPhaseFile(TransactionId xid, void *content, int len)
15721572 (errcode_for_file_access (),
15731573 errmsg ("could not write two-phase state file: %m" )));
15741574 }
1575- if (write (fd , & statefile_crc , sizeof (pg_crc32 )) != sizeof (pg_crc32 ))
1575+ if (write (fd , & statefile_crc , sizeof (pg_crc32c )) != sizeof (pg_crc32c ))
15761576 {
15771577 CloseTransientFile (fd );
15781578 ereport (ERROR ,
0 commit comments