mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
Move PG_TEMP_FILE* macros to file_utils.h.
Presently, frontend code that needs to use these macros must either include storage/fd.h, which declares several frontend-unsafe functions, or duplicate the macros. This commit moves these macros to common/file_utils.h, which is safe for both frontend and backend code. Consequently, we can also remove the duplicated macros in pg_checksums and stop including storage/fd.h in pg_rewind. Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/ZOP5qoUualu5xl2Z%40paquier.xyz
This commit is contained in:
parent
119c23eb98
commit
f39b265808
@ -25,6 +25,7 @@
|
|||||||
#include "commands/defrem.h"
|
#include "commands/defrem.h"
|
||||||
#include "common/compression.h"
|
#include "common/compression.h"
|
||||||
#include "common/file_perm.h"
|
#include "common/file_perm.h"
|
||||||
|
#include "common/file_utils.h"
|
||||||
#include "lib/stringinfo.h"
|
#include "lib/stringinfo.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
#include "nodes/pg_list.h"
|
#include "nodes/pg_list.h"
|
||||||
@ -37,7 +38,6 @@
|
|||||||
#include "storage/bufpage.h"
|
#include "storage/bufpage.h"
|
||||||
#include "storage/checksum.h"
|
#include "storage/checksum.h"
|
||||||
#include "storage/dsm_impl.h"
|
#include "storage/dsm_impl.h"
|
||||||
#include "storage/fd.h"
|
|
||||||
#include "storage/ipc.h"
|
#include "storage/ipc.h"
|
||||||
#include "storage/reinit.h"
|
#include "storage/reinit.h"
|
||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
|
@ -94,6 +94,7 @@
|
|||||||
#include "access/xlogrecovery.h"
|
#include "access/xlogrecovery.h"
|
||||||
#include "catalog/pg_control.h"
|
#include "catalog/pg_control.h"
|
||||||
#include "common/file_perm.h"
|
#include "common/file_perm.h"
|
||||||
|
#include "common/file_utils.h"
|
||||||
#include "common/ip.h"
|
#include "common/ip.h"
|
||||||
#include "common/pg_prng.h"
|
#include "common/pg_prng.h"
|
||||||
#include "common/string.h"
|
#include "common/string.h"
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "catalog/pg_tablespace.h"
|
#include "catalog/pg_tablespace.h"
|
||||||
#include "commands/tablespace.h"
|
#include "commands/tablespace.h"
|
||||||
|
#include "common/file_utils.h"
|
||||||
#include "common/hashfn.h"
|
#include "common/hashfn.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
#include "storage/ipc.h"
|
#include "storage/ipc.h"
|
||||||
|
@ -52,16 +52,6 @@ typedef enum
|
|||||||
PG_MODE_ENABLE
|
PG_MODE_ENABLE
|
||||||
} PgChecksumMode;
|
} PgChecksumMode;
|
||||||
|
|
||||||
/*
|
|
||||||
* Filename components.
|
|
||||||
*
|
|
||||||
* XXX: fd.h is not declared here as frontend side code is not able to
|
|
||||||
* interact with the backend-side definitions for the various fsync
|
|
||||||
* wrappers.
|
|
||||||
*/
|
|
||||||
#define PG_TEMP_FILES_DIR "pgsql_tmp"
|
|
||||||
#define PG_TEMP_FILE_PREFIX "pgsql_tmp"
|
|
||||||
|
|
||||||
static PgChecksumMode mode = PG_MODE_CHECK;
|
static PgChecksumMode mode = PG_MODE_CHECK;
|
||||||
|
|
||||||
static const char *progname;
|
static const char *progname;
|
||||||
|
@ -27,12 +27,12 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "catalog/pg_tablespace_d.h"
|
#include "catalog/pg_tablespace_d.h"
|
||||||
|
#include "common/file_utils.h"
|
||||||
#include "common/hashfn.h"
|
#include "common/hashfn.h"
|
||||||
#include "common/string.h"
|
#include "common/string.h"
|
||||||
#include "datapagemap.h"
|
#include "datapagemap.h"
|
||||||
#include "filemap.h"
|
#include "filemap.h"
|
||||||
#include "pg_rewind.h"
|
#include "pg_rewind.h"
|
||||||
#include "storage/fd.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define a hash table which we can use to store information about the files
|
* Define a hash table which we can use to store information about the files
|
||||||
|
@ -46,4 +46,8 @@ extern ssize_t pg_pwritev_with_retry(int fd,
|
|||||||
|
|
||||||
extern ssize_t pg_pwrite_zeros(int fd, size_t size, off_t offset);
|
extern ssize_t pg_pwrite_zeros(int fd, size_t size, off_t offset);
|
||||||
|
|
||||||
|
/* Filename components */
|
||||||
|
#define PG_TEMP_FILES_DIR "pgsql_tmp"
|
||||||
|
#define PG_TEMP_FILE_PREFIX "pgsql_tmp"
|
||||||
|
|
||||||
#endif /* FILE_UTILS_H */
|
#endif /* FILE_UTILS_H */
|
||||||
|
@ -195,8 +195,4 @@ extern int durable_unlink(const char *fname, int elevel);
|
|||||||
extern void SyncDataDirectory(void);
|
extern void SyncDataDirectory(void);
|
||||||
extern int data_sync_elevel(int elevel);
|
extern int data_sync_elevel(int elevel);
|
||||||
|
|
||||||
/* Filename components */
|
|
||||||
#define PG_TEMP_FILES_DIR "pgsql_tmp"
|
|
||||||
#define PG_TEMP_FILE_PREFIX "pgsql_tmp"
|
|
||||||
|
|
||||||
#endif /* FD_H */
|
#endif /* FD_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user