@@ -2492,6 +2492,37 @@ static void fio_check_postmaster_impl(int out, char *buf)
24922492 IO_CHECK (fio_write_all (out , & hdr , sizeof (hdr )), sizeof (hdr ));
24932493}
24942494
2495+ /*
2496+ * Delete file pointed by the pgFile.
2497+ * If the pgFile points directory, the directory must be empty.
2498+ */
2499+ void
2500+ fio_delete (mode_t mode , const char * fullpath , fio_location location )
2501+ {
2502+ if (fio_is_remote (location ))
2503+ {
2504+ fio_header hdr ;
2505+
2506+ hdr .cop = FIO_DELETE ;
2507+ hdr .size = strlen (fullpath ) + 1 ;
2508+ hdr .arg = mode ;
2509+
2510+ IO_CHECK (fio_write_all (fio_stdout , & hdr , sizeof (hdr )), sizeof (hdr ));
2511+ IO_CHECK (fio_write_all (fio_stdout , fullpath , hdr .size ), hdr .size );
2512+
2513+ }
2514+ else
2515+ pgFileDelete (mode , fullpath );
2516+ }
2517+
2518+ static void
2519+ fio_delete_impl (mode_t mode , char * buf )
2520+ {
2521+ char * fullpath = (char * ) buf ;
2522+
2523+ pgFileDelete (mode , fullpath );
2524+ }
2525+
24952526/* Execute commands at remote host */
24962527void fio_communicate (int in , int out )
24972528{
@@ -2675,6 +2706,10 @@ void fio_communicate(int in, int out)
26752706 /* calculate crc32 for a file */
26762707 fio_check_postmaster_impl (out , buf );
26772708 break ;
2709+ case FIO_DELETE :
2710+ /* delete file */
2711+ fio_delete_impl (hdr .arg , buf );
2712+ break ;
26782713 case FIO_DISCONNECT :
26792714 hdr .cop = FIO_DISCONNECTED ;
26802715 IO_CHECK (fio_write_all (out , & hdr , sizeof (hdr )), sizeof (hdr ));
0 commit comments