summaryrefslogtreecommitdiff
path: root/contrib/pg_upgrade/file.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2010-10-19 21:38:16 +0000
committerBruce Momjian <bruce@momjian.us>2010-10-19 21:38:34 +0000
commite13f7e9a711c9117e438516537066bbe61df6455 (patch)
tree1c805eb384b78475cbf7d69257188bbd26fa75cd /contrib/pg_upgrade/file.c
parent6e74a91b2bf0e0032ccd60dd99d6cf47c190c428 (diff)
Restructure the pg_upgrade code to use several global structures rather
than packing everything into 'ctx' and passing that to every function.
Diffstat (limited to 'contrib/pg_upgrade/file.c')
-rw-r--r--contrib/pg_upgrade/file.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/contrib/pg_upgrade/file.c b/contrib/pg_upgrade/file.c
index 983a2b2d988..a88d7aa6908 100644
--- a/contrib/pg_upgrade/file.c
+++ b/contrib/pg_upgrade/file.c
@@ -22,7 +22,7 @@ static int copy_dir(const char *from, const char *to, bool force);
#endif
#ifndef HAVE_SCANDIR
-static int pg_scandir_internal(migratorContext *ctx, const char *dirname,
+static int pg_scandir_internal(const char *dirname,
struct dirent *** namelist,
int (*selector) (const struct dirent *));
#endif
@@ -35,7 +35,7 @@ static int pg_scandir_internal(migratorContext *ctx, const char *dirname,
* uses that pageConverter to do a page-by-page conversion.
*/
const char *
-copyAndUpdateFile(migratorContext *ctx, pageCnvCtx *pageConverter,
+copyAndUpdateFile(pageCnvCtx *pageConverter,
const char *src, const char *dst, bool force)
{
if (pageConverter == NULL)
@@ -116,7 +116,7 @@ copyAndUpdateFile(migratorContext *ctx, pageCnvCtx *pageConverter,
* instead of copying the data from the old cluster to the new cluster.
*/
const char *
-linkAndUpdateFile(migratorContext *ctx, pageCnvCtx *pageConverter,
+linkAndUpdateFile(pageCnvCtx *pageConverter,
const char *src, const char *dst)
{
if (pageConverter != NULL)
@@ -231,12 +231,12 @@ copy_file(const char *srcfile, const char *dstfile, bool force)
* Wrapper for portable scandir functionality
*/
int
-pg_scandir(migratorContext *ctx, const char *dirname,
+pg_scandir(const char *dirname,
struct dirent *** namelist,
int (*selector) (const struct dirent *))
{
#ifndef HAVE_SCANDIR
- return pg_scandir_internal(ctx, dirname, namelist, selector);
+ return pg_scandir_internal(dirname, namelist, selector);
/*
* scandir() is originally from BSD 4.3, which had the third argument as
@@ -277,7 +277,7 @@ pg_scandir(migratorContext *ctx, const char *dirname,
* .2, etc.) and should therefore be invoked a small number of times.
*/
static int
-pg_scandir_internal(migratorContext *ctx, const char *dirname,
+pg_scandir_internal(const char *dirname,
struct dirent *** namelist, int (*selector) (const struct dirent *))
{
DIR *dirdesc;
@@ -287,7 +287,7 @@ pg_scandir_internal(migratorContext *ctx, const char *dirname,
size_t entrysize;
if ((dirdesc = opendir(dirname)) == NULL)
- pg_log(ctx, PG_FATAL, "Could not open directory \"%s\": %m\n", dirname);
+ pg_log(PG_FATAL, "Could not open directory \"%s\": %m\n", dirname);
*namelist = NULL;
@@ -342,18 +342,18 @@ dir_matching_filenames(const struct dirent * scan_ent)
void
-check_hard_link(migratorContext *ctx)
+check_hard_link(void)
{
char existing_file[MAXPGPATH];
char new_link_file[MAXPGPATH];
- snprintf(existing_file, sizeof(existing_file), "%s/PG_VERSION", ctx->old.pgdata);
- snprintf(new_link_file, sizeof(new_link_file), "%s/PG_VERSION.linktest", ctx->new.pgdata);
+ snprintf(existing_file, sizeof(existing_file), "%s/PG_VERSION", old_cluster.pgdata);
+ snprintf(new_link_file, sizeof(new_link_file), "%s/PG_VERSION.linktest", new_cluster.pgdata);
unlink(new_link_file); /* might fail */
if (pg_link_file(existing_file, new_link_file) == -1)
{
- pg_log(ctx, PG_FATAL,
+ pg_log(PG_FATAL,
"Could not create hard link between old and new data directories: %s\n"
"In link mode the old and new data directories must be on the same file system volume.\n",
getErrorText(errno));