@@ -58,20 +58,6 @@ typedef enum
5858 FIO_READLINK
5959} fio_operations ;
6060
61- typedef enum
62- {
63- FIO_LOCAL_HOST , /* data is locate at local host */
64- FIO_DB_HOST , /* data is located at Postgres server host */
65- FIO_BACKUP_HOST , /* data is located at backup host */
66- FIO_REMOTE_HOST /* date is located at remote host */
67- } fio_location ;
68-
69- #define FIO_FDMAX 64
70- #define FIO_PIPE_MARKER 0x40000000
71-
72- #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)
73- #define IO_CHECK (cmd , size ) do { int _rc = (cmd); if (_rc != (size)) fio_error(_rc, size, __FILE__, __LINE__); } while (0)
74-
7561typedef struct
7662{
7763// fio_operations cop;
@@ -86,18 +72,51 @@ typedef struct
8672 unsigned arg ;
8773} fio_header ;
8874
75+ typedef enum
76+ {
77+ FIO_LOCAL_HOST , /* data is locate at local host */
78+ FIO_DB_HOST , /* data is located at Postgres server host */
79+ FIO_BACKUP_HOST , /* data is located at backup host */
80+ FIO_REMOTE_HOST /* date is located at remote host */
81+ } fio_location ;
82+
8983extern fio_location MyLocation ;
9084
91- /* Check if FILE handle is local or remote (created by FIO) */
92- #define fio_is_remote_file (file ) ((size_t)(file) <= FIO_FDMAX)
85+ extern void setMyLocation (ProbackupSubcmd const subcmd );
86+ /* Check if specified location is local for current node */
87+ extern bool fio_is_remote (fio_location location );
88+ extern bool fio_is_remote_simple (fio_location location );
9389
94- extern void fio_redirect (int in , int out , int err );
9590extern void fio_communicate (int in , int out );
9691extern void fio_disconnect (void );
97-
9892extern int fio_get_agent_version (void );
93+
94+ #define FIO_FDMAX 64
95+ #define FIO_PIPE_MARKER 0x40000000
96+
97+ /* Check if FILE handle is local or remote (created by FIO) */
98+ #define fio_is_remote_file (file ) ((size_t)(file) <= FIO_FDMAX)
99+
100+ extern void fio_redirect (int in , int out , int err );
99101extern void fio_error (int rc , int size , const char * file , int line );
100102
103+ #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)
104+ #define IO_CHECK (cmd , size ) do { int _rc = (cmd); if (_rc != (size)) fio_error(_rc, size, __FILE__, __LINE__); } while (0)
105+
106+
107+ /* fd-style functions */
108+ extern int fio_open (fio_location location , const char * name , int mode );
109+ extern ssize_t fio_write (int fd , void const * buf , size_t size );
110+ extern ssize_t fio_write_async (int fd , void const * buf , size_t size );
111+ extern int fio_check_error_fd (int fd , char * * errmsg );
112+ extern int fio_check_error_fd_gz (gzFile f , char * * errmsg );
113+ extern ssize_t fio_read (int fd , void * buf , size_t size );
114+ extern int fio_flush (int fd );
115+ extern int fio_seek (int fd , off_t offs );
116+ extern int fio_fstat (int fd , struct stat * st );
117+ extern int fio_truncate (int fd , off_t size );
118+ extern int fio_close (int fd );
119+
101120/* FILE-style functions */
102121extern FILE * fio_fopen (fio_location location , const char * name , const char * mode );
103122extern size_t fio_fwrite (FILE * f , void const * buf , size_t size );
@@ -116,18 +135,16 @@ extern int fio_ffstat(FILE* f, struct stat* st);
116135extern FILE * fio_open_stream (fio_location location , const char * name );
117136extern int fio_close_stream (FILE * f );
118137
119- /* fd-style functions */
120- extern int fio_open (fio_location location , const char * name , int mode );
121- extern ssize_t fio_write (int fd , void const * buf , size_t size );
122- extern ssize_t fio_write_async (int fd , void const * buf , size_t size );
123- extern int fio_check_error_fd (int fd , char * * errmsg );
124- extern int fio_check_error_fd_gz (gzFile f , char * * errmsg );
125- extern ssize_t fio_read (int fd , void * buf , size_t size );
126- extern int fio_flush (int fd );
127- extern int fio_seek (int fd , off_t offs );
128- extern int fio_fstat (int fd , struct stat * st );
129- extern int fio_truncate (int fd , off_t size );
130- extern int fio_close (int fd );
138+ /* gzFile-style functions */
139+ #ifdef HAVE_LIBZ
140+ extern gzFile fio_gzopen (fio_location location , const char * path , const char * mode , int level );
141+ extern int fio_gzclose (gzFile file );
142+ extern int fio_gzread (gzFile f , void * buf , unsigned size );
143+ extern int fio_gzwrite (gzFile f , void const * buf , unsigned size );
144+ extern int fio_gzeof (gzFile f );
145+ extern z_off_t fio_gzseek (gzFile f , z_off_t offset , int whence );
146+ extern const char * fio_gzerror (gzFile file , int * errnum );
147+ #endif
131148
132149/* DIR-style functions */
133150extern DIR * fio_opendir (fio_location location , const char * path );
@@ -149,15 +166,14 @@ extern bool fio_is_same_file(fio_location location, const char* filename1, co
149166extern ssize_t fio_readlink (fio_location location , const char * path , char * value , size_t valsiz );
150167extern pid_t fio_check_postmaster (fio_location location , const char * pgdata );
151168
152- /* gzFile-style functions */
153- #ifdef HAVE_LIBZ
154- extern gzFile fio_gzopen (fio_location location , const char * path , const char * mode , int level );
155- extern int fio_gzclose (gzFile file );
156- extern int fio_gzread (gzFile f , void * buf , unsigned size );
157- extern int fio_gzwrite (gzFile f , void const * buf , unsigned size );
158- extern int fio_gzeof (gzFile f );
159- extern z_off_t fio_gzseek (gzFile f , z_off_t offset , int whence );
160- extern const char * fio_gzerror (gzFile file , int * errnum );
161- #endif
169+ extern void fio_list_dir (parray * files , const char * root , bool exclude , bool follow_symlink ,
170+ bool add_root , bool backup_logs , bool skip_hidden , int external_dir_num );
171+
172+ struct PageState ; /* defined in pg_probackup.h */
173+ extern struct PageState * fio_get_checksum_map (fio_location location , const char * fullpath , uint32 checksum_version ,
174+ int n_blocks , XLogRecPtr dest_stop_lsn , BlockNumber segmentno );
175+ struct datapagemap ; /* defined in datapagemap.h */
176+ extern struct datapagemap * fio_get_lsn_map (fio_location location , const char * fullpath , uint32 checksum_version ,
177+ int n_blocks , XLogRecPtr horizonLsn , BlockNumber segmentno );
162178
163179#endif
0 commit comments