TarExport *tar_export_unref(TarExport *e) { if (!e) return NULL; sd_event_source_unref(e->output_event_source); if (e->tar_pid > 1) { (void) kill_and_sigcont(e->tar_pid, SIGKILL); (void) wait_for_terminate(e->tar_pid, NULL); } if (e->temp_path) { (void) btrfs_subvol_remove(e->temp_path, BTRFS_REMOVE_QUOTA); free(e->temp_path); } import_compress_free(&e->compress); sd_event_unref(e->event); safe_close(e->tar_fd); free(e->buffer); free(e->path); free(e); return NULL; }
TarImport* tar_import_unref(TarImport *i) { if (!i) return NULL; sd_event_source_unref(i->input_event_source); if (i->tar_pid > 1) { (void) kill_and_sigcont(i->tar_pid, SIGKILL); (void) wait_for_terminate(i->tar_pid, NULL); } if (i->temp_path) { (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME); free(i->temp_path); } import_compress_free(&i->compress); sd_event_unref(i->event); safe_close(i->tar_fd); free(i->final_path); free(i->image_root); free(i->local); free(i); return NULL; }
RawExport *raw_export_unref(RawExport *e) { if (!e) return NULL; sd_event_source_unref(e->output_event_source); import_compress_free(&e->compress); sd_event_unref(e->event); safe_close(e->input_fd); free(e->buffer); free(e->path); return mfree(e); }
RawImport* raw_import_unref(RawImport *i) { if (!i) return NULL; sd_event_unref(i->event); if (i->temp_path) { (void) unlink(i->temp_path); free(i->temp_path); } import_compress_free(&i->compress); sd_event_source_unref(i->input_event_source); safe_close(i->output_fd); free(i->final_path); free(i->image_root); free(i->local); return mfree(i); }