|
PostgreSQL Source Code git master
|
#include "postgres_fe.h"#include <sys/stat.h>#include <dirent.h>#include <fcntl.h>#include <unistd.h>#include "common/file_perm.h"#include "common/file_utils.h"#include "file_ops.h"#include "filemap.h"#include "pg_rewind.h"
Go to the source code of this file.
Functions | |
| static void | create_target_dir (const char *path) |
| static void | remove_target_dir (const char *path) |
| static void | create_target_symlink (const char *path, const char *link) |
| static void | remove_target_symlink (const char *path) |
| static void | recurse_dir (const char *datadir, const char *parentpath, process_file_callback_t callback) |
| void | open_target_file (const char *path, bool trunc) |
| void | close_target_file (void) |
| void | write_target_range (char *buf, off_t begin, size_t size) |
| void | remove_target (file_entry_t *entry) |
| void | create_target (file_entry_t *entry) |
| void | remove_target_file (const char *path, bool missing_ok) |
| void | truncate_target_file (const char *path, off_t newsize) |
| void | sync_target_dir (void) |
| char * | slurpFile (const char *datadir, const char *path, size_t *filesize) |
| void | traverse_datadir (const char *datadir, process_file_callback_t callback) |
Variables | |
| static int | dstfd = -1 |
| static char | dstpath [MAXPGPATH] = "" |
| void close_target_file | ( | void | ) |
Definition at line 75 of file file_ops.c.
References close, dstfd, dstpath, and pg_fatal.
Referenced by createBackupLabel(), open_target_file(), and perform_rewind().
| void create_target | ( | file_entry_t * | entry | ) |
Definition at line 156 of file file_ops.c.
References file_entry_t::action, Assert(), create_target_dir(), create_target_symlink(), FILE_ACTION_CREATE, FILE_TYPE_DIRECTORY, FILE_TYPE_REGULAR, FILE_TYPE_SYMLINK, FILE_TYPE_UNDEFINED, file_entry_t::path, pg_fatal, file_entry_t::source_link_target, file_entry_t::source_type, and file_entry_t::target_exists.
Referenced by perform_rewind().
|
static |
Definition at line 229 of file file_ops.c.
References datadir_target, dry_run, dstpath, MAXPGPATH, mkdir, pg_dir_create_mode, pg_fatal, and snprintf.
Referenced by create_target().
|
static |
Definition at line 257 of file file_ops.c.
References datadir_target, dry_run, dstpath, MAXPGPATH, pg_fatal, snprintf, and symlink.
Referenced by create_target().
| void open_target_file | ( | const char * | path, |
| bool | trunc | ||
| ) |
Definition at line 47 of file file_ops.c.
References close_target_file(), datadir_target, dry_run, dstfd, dstpath, mode, PG_BINARY, pg_fatal, pg_file_create_mode, and snprintf.
Referenced by createBackupLabel(), libpq_queue_fetch_file(), local_queue_fetch_file(), local_queue_fetch_range(), and process_queued_fetch_requests().
|
static |
Definition at line 374 of file file_ops.c.
References callback(), closedir(), dirent::d_name, datadir, FILE_TYPE_DIRECTORY, FILE_TYPE_REGULAR, FILE_TYPE_SYMLINK, len, lstat, MAXPGPATH, opendir(), pg_fatal, PG_TBLSPC_DIR, readdir(), readlink, recurse_dir(), S_ISDIR, S_ISLNK, S_ISREG, snprintf, stat::st_mode, and stat::st_size.
Referenced by recurse_dir(), and traverse_datadir().
| void remove_target | ( | file_entry_t * | entry | ) |
Definition at line 130 of file file_ops.c.
References file_entry_t::action, Assert(), FILE_ACTION_REMOVE, FILE_TYPE_DIRECTORY, FILE_TYPE_REGULAR, FILE_TYPE_SYMLINK, FILE_TYPE_UNDEFINED, file_entry_t::path, pg_fatal, remove_target_dir(), remove_target_file(), remove_target_symlink(), file_entry_t::target_exists, and file_entry_t::target_type.
Referenced by perform_rewind().
|
static |
Definition at line 243 of file file_ops.c.
References datadir_target, dry_run, dstpath, MAXPGPATH, pg_fatal, and snprintf.
Referenced by remove_target().
| void remove_target_file | ( | const char * | path, |
| bool | missing_ok | ||
| ) |
Definition at line 187 of file file_ops.c.
References datadir_target, dry_run, dstpath, MAXPGPATH, pg_fatal, and snprintf.
Referenced by process_queued_fetch_requests(), and remove_target().
|
static |
Definition at line 271 of file file_ops.c.
References datadir_target, dry_run, dstpath, MAXPGPATH, pg_fatal, and snprintf.
Referenced by remove_target().
| char * slurpFile | ( | const char * | datadir, |
| const char * | path, | ||
| size_t * | filesize | ||
| ) |
Definition at line 314 of file file_ops.c.
References close, datadir, fd(), fstat, len, MAXPGPATH, PG_BINARY, pg_fatal, pg_malloc(), read, snprintf, and stat::st_size.
Referenced by getTimelineHistory(), local_fetch_file(), and main().
| void sync_target_dir | ( | void | ) |
Definition at line 294 of file file_ops.c.
References datadir_target, do_sync, dry_run, and sync_method.
Referenced by main().
| void traverse_datadir | ( | const char * | datadir, |
| process_file_callback_t | callback | ||
| ) |
Definition at line 362 of file file_ops.c.
References callback(), datadir, and recurse_dir().
Referenced by local_traverse_files(), and main().
| void truncate_target_file | ( | const char * | path, |
| off_t | newsize | ||
| ) |
Definition at line 206 of file file_ops.c.
References close, datadir_target, dry_run, dstpath, fd(), MAXPGPATH, pg_fatal, pg_file_create_mode, and snprintf.
Referenced by perform_rewind().
| void write_target_range | ( | char * | buf, |
| off_t | begin, | ||
| size_t | size | ||
| ) |
Definition at line 88 of file file_ops.c.
References buf, dry_run, dstfd, dstpath, fetch_done, pg_fatal, progress_report(), and write.
Referenced by createBackupLabel(), local_queue_fetch_file(), local_queue_fetch_range(), and process_queued_fetch_requests().
|
static |
Definition at line 31 of file file_ops.c.
Referenced by clone_file(), close_target_file(), copy_file(), open_target_file(), and write_target_range().
|
static |
Definition at line 32 of file file_ops.c.
Referenced by check_db_file_conflict(), close_target_file(), create_target_dir(), create_target_symlink(), CreateDatabaseUsingFileCopy(), CreateDatabaseUsingWalLog(), movedb_failure_callback(), open_target_file(), remove_dbtablespaces(), remove_target_dir(), remove_target_file(), remove_target_symlink(), ResetUnloggedRelationsInDbspaceDir(), truncate_target_file(), and write_target_range().