Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf39b265

Browse files
Move PG_TEMP_FILE* macros to file_utils.h.
Presently, frontend code that needs to use these macros must eitherinclude storage/fd.h, which declares several frontend-unsafefunctions, or duplicate the macros. This commit moves these macrosto common/file_utils.h, which is safe for both frontend and backendcode. Consequently, we can also remove the duplicated macros inpg_checksums and stop including storage/fd.h in pg_rewind.Reviewed-by: Michael PaquierDiscussion:https://postgr.es/m/ZOP5qoUualu5xl2Z%40paquier.xyz
1 parent119c23e commitf39b265

File tree

7 files changed

+8
-16
lines changed

7 files changed

+8
-16
lines changed

‎src/backend/backup/basebackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include"commands/defrem.h"
2626
#include"common/compression.h"
2727
#include"common/file_perm.h"
28+
#include"common/file_utils.h"
2829
#include"lib/stringinfo.h"
2930
#include"miscadmin.h"
3031
#include"nodes/pg_list.h"
@@ -37,7 +38,6 @@
3738
#include"storage/bufpage.h"
3839
#include"storage/checksum.h"
3940
#include"storage/dsm_impl.h"
40-
#include"storage/fd.h"
4141
#include"storage/ipc.h"
4242
#include"storage/reinit.h"
4343
#include"utils/builtins.h"

‎src/backend/postmaster/postmaster.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
#include"access/xlogrecovery.h"
9595
#include"catalog/pg_control.h"
9696
#include"common/file_perm.h"
97+
#include"common/file_utils.h"
9798
#include"common/ip.h"
9899
#include"common/pg_prng.h"
99100
#include"common/string.h"

‎src/backend/storage/file/fileset.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include"catalog/pg_tablespace.h"
2727
#include"commands/tablespace.h"
28+
#include"common/file_utils.h"
2829
#include"common/hashfn.h"
2930
#include"miscadmin.h"
3031
#include"storage/ipc.h"

‎src/bin/pg_checksums/pg_checksums.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@ typedef enum
5252
PG_MODE_ENABLE
5353
}PgChecksumMode;
5454

55-
/*
56-
* Filename components.
57-
*
58-
* XXX: fd.h is not declared here as frontend side code is not able to
59-
* interact with the backend-side definitions for the various fsync
60-
* wrappers.
61-
*/
62-
#definePG_TEMP_FILES_DIR "pgsql_tmp"
63-
#definePG_TEMP_FILE_PREFIX "pgsql_tmp"
64-
6555
staticPgChecksumModemode=PG_MODE_CHECK;
6656

6757
staticconstchar*progname;

‎src/bin/pg_rewind/filemap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
#include<unistd.h>
2828

2929
#include"catalog/pg_tablespace_d.h"
30+
#include"common/file_utils.h"
3031
#include"common/hashfn.h"
3132
#include"common/string.h"
3233
#include"datapagemap.h"
3334
#include"filemap.h"
3435
#include"pg_rewind.h"
35-
#include"storage/fd.h"
3636

3737
/*
3838
* Define a hash table which we can use to store information about the files

‎src/include/common/file_utils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ extern ssize_t pg_pwritev_with_retry(int fd,
4646

4747
externssize_tpg_pwrite_zeros(intfd,size_tsize,off_toffset);
4848

49+
/* Filename components */
50+
#definePG_TEMP_FILES_DIR "pgsql_tmp"
51+
#definePG_TEMP_FILE_PREFIX "pgsql_tmp"
52+
4953
#endif/* FILE_UTILS_H */

‎src/include/storage/fd.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,4 @@ extern intdurable_unlink(const char *fname, int elevel);
195195
externvoidSyncDataDirectory(void);
196196
externintdata_sync_elevel(intelevel);
197197

198-
/* Filename components */
199-
#definePG_TEMP_FILES_DIR "pgsql_tmp"
200-
#definePG_TEMP_FILE_PREFIX "pgsql_tmp"
201-
202198
#endif/* FD_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp