55{
56 char *strategy_name = NULL;
57 void (*strategy_implementation) (const char *, const char *,
59
60
61
62
63
65 {
67
69 pg_fatal(
"could not open file \"%s\": %m", src);
71 pg_fatal(
"could not close file \"%s\": %m", src);
72 }
73
74#ifdef WIN32
75
76
77
78
79
80
82 copy_method = COPY_METHOD_COPYFILE;
83#endif
84
85
86 switch (copy_method)
87 {
89 strategy_name = "clone";
91 break;
93
95 break;
97 strategy_name = "copy_file_range";
99 break;
100#ifdef WIN32
101 case COPY_METHOD_COPYFILE:
102 strategy_name = "CopyFile";
103 strategy_implementation = copy_file_copyfile;
104 break;
105#endif
107 strategy_name = "link";
109 break;
110 }
111
113 {
114 if (strategy_name)
115 pg_log_debug(
"would copy \"%s\" to \"%s\" using strategy %s",
116 src, dst, strategy_name);
117 else
119 src, dst);
120 }
121 else
122 {
123 if (strategy_name)
124 pg_log_debug(
"copying \"%s\" to \"%s\" using strategy %s",
125 src, dst, strategy_name);
128 src, dst);
129 else
130 pg_log_debug(
"copying \"%s\" to \"%s\" and checksumming with %s",
132
133 strategy_implementation(src, dst, checksum_ctx);
134 }
135}
char * pg_checksum_type_name(pg_checksum_type type)
static void copy_file_blocks(const char *src, const char *dst, pg_checksum_context *checksum_ctx)
static void copy_file_clone(const char *src, const char *dest, pg_checksum_context *checksum_ctx)
static void copy_file_link(const char *src, const char *dest, pg_checksum_context *checksum_ctx)
static void copy_file_by_range(const char *src, const char *dest, pg_checksum_context *checksum_ctx)
#define pg_log_debug(...)
static int fd(const char *x, int i)