@@ -59,20 +59,6 @@ typedef enum
59
59
FIO_PAGE_ZERO
60
60
} fio_operations ;
61
61
62
- typedef enum
63
- {
64
- FIO_LOCAL_HOST , /* data is locate at local host */
65
- FIO_DB_HOST , /* data is located at Postgres server host */
66
- FIO_BACKUP_HOST , /* data is located at backup host */
67
- FIO_REMOTE_HOST /* date is located at remote host */
68
- } fio_location ;
69
-
70
- #define FIO_FDMAX 64
71
- #define FIO_PIPE_MARKER 0x40000000
72
-
73
- #define SYS_CHECK (cmd ) do if ((cmd) < 0) { fprintf(stderr, "%s:%d: (%s) %s\n", __FILE__, __LINE__, #cmd, strerror(errno)); exit(EXIT_FAILURE); } while (0)
74
- #define IO_CHECK (cmd , size ) do { int _rc = (cmd); if (_rc != (size)) fio_error(_rc, size, __FILE__, __LINE__); } while (0)
75
-
76
62
typedef struct
77
63
{
78
64
// fio_operations cop;
@@ -87,18 +73,51 @@ typedef struct
87
73
unsigned arg ;
88
74
} fio_header ;
89
75
76
+ typedef enum
77
+ {
78
+ FIO_LOCAL_HOST , /* data is locate at local host */
79
+ FIO_DB_HOST , /* data is located at Postgres server host */
80
+ FIO_BACKUP_HOST , /* data is located at backup host */
81
+ FIO_REMOTE_HOST /* date is located at remote host */
82
+ } fio_location ;
83
+
90
84
extern fio_location MyLocation ;
91
85
92
- /* Check if FILE handle is local or remote (created by FIO) */
93
- #define fio_is_remote_file (file ) ((size_t)(file) <= FIO_FDMAX)
86
+ extern void setMyLocation (ProbackupSubcmd const subcmd );
87
+ /* Check if specified location is local for current node */
88
+ extern bool fio_is_remote (fio_location location );
89
+ extern bool fio_is_remote_simple (fio_location location );
94
90
95
- extern void fio_redirect (int in , int out , int err );
96
91
extern void fio_communicate (int in , int out );
97
92
extern void fio_disconnect (void );
98
-
99
93
extern void fio_get_agent_version (int * protocol , char * payload_buf , size_t payload_buf_size );
94
+
95
+ #define FIO_FDMAX 64
96
+ #define FIO_PIPE_MARKER 0x40000000
97
+
98
+ /* Check if FILE handle is local or remote (created by FIO) */
99
+ #define fio_is_remote_file (file ) ((size_t)(file) <= FIO_FDMAX)
100
+
101
+ extern void fio_redirect (int in , int out , int err );
100
102
extern void fio_error (int rc , int size , const char * file , int line );
101
103
104
+ #define SYS_CHECK (cmd ) do if ((cmd) < 0) { fprintf(stderr, "%s:%d: (%s) %s\n", __FILE__, __LINE__, #cmd, strerror(errno)); exit(EXIT_FAILURE); } while (0)
105
+ #define IO_CHECK (cmd , size ) do { int _rc = (cmd); if (_rc != (size)) fio_error(_rc, size, __FILE__, __LINE__); } while (0)
106
+
107
+
108
+ /* fd-style functions */
109
+ extern int fio_open (fio_location location , const char * name , int mode );
110
+ extern ssize_t fio_write (int fd , void const * buf , size_t size );
111
+ extern ssize_t fio_write_async (int fd , void const * buf , size_t size );
112
+ extern int fio_check_error_fd (int fd , char * * errmsg );
113
+ extern int fio_check_error_fd_gz (gzFile f , char * * errmsg );
114
+ extern ssize_t fio_read (int fd , void * buf , size_t size );
115
+ extern int fio_flush (int fd );
116
+ extern int fio_seek (int fd , off_t offs );
117
+ extern int fio_fstat (int fd , struct stat * st );
118
+ extern int fio_truncate (int fd , off_t size );
119
+ extern int fio_close (int fd );
120
+
102
121
/* FILE-style functions */
103
122
extern FILE * fio_fopen (fio_location location , const char * name , const char * mode );
104
123
extern size_t fio_fwrite (FILE * f , void const * buf , size_t size );
@@ -117,18 +136,16 @@ extern int fio_ffstat(FILE* f, struct stat* st);
117
136
extern FILE * fio_open_stream (fio_location location , const char * name );
118
137
extern int fio_close_stream (FILE * f );
119
138
120
- /* fd-style functions */
121
- extern int fio_open (fio_location location , const char * name , int mode );
122
- extern ssize_t fio_write (int fd , void const * buf , size_t size );
123
- extern ssize_t fio_write_async (int fd , void const * buf , size_t size );
124
- extern int fio_check_error_fd (int fd , char * * errmsg );
125
- extern int fio_check_error_fd_gz (gzFile f , char * * errmsg );
126
- extern ssize_t fio_read (int fd , void * buf , size_t size );
127
- extern int fio_flush (int fd );
128
- extern int fio_seek (int fd , off_t offs );
129
- extern int fio_fstat (int fd , struct stat * st );
130
- extern int fio_truncate (int fd , off_t size );
131
- extern int fio_close (int fd );
139
+ /* gzFile-style functions */
140
+ #ifdef HAVE_LIBZ
141
+ extern gzFile fio_gzopen (fio_location location , const char * path , const char * mode , int level );
142
+ extern int fio_gzclose (gzFile file );
143
+ extern int fio_gzread (gzFile f , void * buf , unsigned size );
144
+ extern int fio_gzwrite (gzFile f , void const * buf , unsigned size );
145
+ extern int fio_gzeof (gzFile f );
146
+ extern z_off_t fio_gzseek (gzFile f , z_off_t offset , int whence );
147
+ extern const char * fio_gzerror (gzFile file , int * errnum );
148
+ #endif
132
149
133
150
/* DIR-style functions */
134
151
extern DIR * fio_opendir (fio_location location , const char * path );
@@ -153,15 +170,14 @@ extern bool fio_is_same_file(fio_location location, const char* filename1, co
153
170
extern ssize_t fio_readlink (fio_location location , const char * path , char * value , size_t valsiz );
154
171
extern pid_t fio_check_postmaster (fio_location location , const char * pgdata );
155
172
156
- /* gzFile-style functions */
157
- #ifdef HAVE_LIBZ
158
- extern gzFile fio_gzopen (fio_location location , const char * path , const char * mode , int level );
159
- extern int fio_gzclose (gzFile file );
160
- extern int fio_gzread (gzFile f , void * buf , unsigned size );
161
- extern int fio_gzwrite (gzFile f , void const * buf , unsigned size );
162
- extern int fio_gzeof (gzFile f );
163
- extern z_off_t fio_gzseek (gzFile f , z_off_t offset , int whence );
164
- extern const char * fio_gzerror (gzFile file , int * errnum );
165
- #endif
173
+ extern void fio_list_dir (parray * files , const char * root , bool exclude , bool follow_symlink ,
174
+ bool add_root , bool backup_logs , bool skip_hidden , int external_dir_num );
175
+
176
+ struct PageState ; /* defined in pg_probackup.h */
177
+ extern struct PageState * fio_get_checksum_map (fio_location location , const char * fullpath , uint32 checksum_version ,
178
+ int n_blocks , XLogRecPtr dest_stop_lsn , BlockNumber segmentno );
179
+ struct datapagemap ; /* defined in datapagemap.h */
180
+ extern struct datapagemap * fio_get_lsn_map (fio_location location , const char * fullpath , uint32 checksum_version ,
181
+ int n_blocks , XLogRecPtr horizonLsn , BlockNumber segmentno );
166
182
167
183
#endif
0 commit comments