| 1118 | } |
| 1119 | |
| 1120 | UCHAR mvol_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) |
| 1121 | { |
| 1122 | const UCHAR* ptr; |
| 1123 | ULONG cnt = 0; |
| 1124 | |
| 1125 | BurpGlobals* tdgbl = BurpGlobals::getSpecific(); |
| 1126 | |
| 1127 | if (!tdgbl->master) |
| 1128 | { |
| 1129 | BackupRelationTask::renewBuffer(tdgbl); |
| 1130 | *(*io_ptr)++ = c; |
| 1131 | (*io_cnt)--; |
| 1132 | return c; |
| 1133 | } |
| 1134 | |
| 1135 | const ULONG size_to_write = BURP_UP_TO_BLOCK(*io_ptr - tdgbl->mvol_io_buffer); |
| 1136 | FB_UINT64 left = size_to_write; |
| 1137 | |
| 1138 | if (tdgbl->stdIoMode && tdgbl->uSvc->isService()) |
| 1139 | { |
| 1140 | tdgbl->uSvc->started(); |
| 1141 | tdgbl->uSvc->putBytes(tdgbl->mvol_io_buffer, left); |
| 1142 | left = 0; |
| 1143 | } |
| 1144 | else |
| 1145 | { |
| 1146 | for (ptr = tdgbl->mvol_io_buffer; left > 0; ptr += cnt, left -= cnt) |
| 1147 | { |
| 1148 | if (tdgbl->action->act_action == ACT_backup_split) |
| 1149 | { |
| 1150 | // Write to the current file till fil_lingth > 0, otherwise |
| 1151 | // switch to the next one |
| 1152 | if (tdgbl->action->act_file->fil_length == 0) |
| 1153 | { |
| 1154 | if (tdgbl->action->act_file->fil_next) |
| 1155 | { |
| 1156 | close_platf(tdgbl->file_desc); |
| 1157 | for (burp_fil* file = tdgbl->gbl_sw_backup_files; file; file = file->fil_next) |
| 1158 | { |
| 1159 | if (file->fil_fd == tdgbl->file_desc) |
| 1160 | file->fil_fd = INVALID_HANDLE_VALUE; |
| 1161 | } |
| 1162 | tdgbl->action->act_file->fil_fd = INVALID_HANDLE_VALUE; |
| 1163 | tdgbl->action->act_file = tdgbl->action->act_file->fil_next; |
| 1164 | tdgbl->file_desc = tdgbl->action->act_file->fil_fd; |
| 1165 | } |
| 1166 | else |
| 1167 | { |
| 1168 | // This is a last file. Keep writing in a hope that there is |
| 1169 | // enough free disk space ... |
| 1170 | tdgbl->action->act_file->fil_length = MAX_LENGTH; |
| 1171 | } |
| 1172 | } |
| 1173 | } |
| 1174 | |
| 1175 | FB_UINT64 longBytesToWrite = |
| 1176 | (tdgbl->action->act_action == ACT_backup_split && |
| 1177 | tdgbl->action->act_file->fil_length < left) ? |
no test coverage detected