MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / mvol_write

Function mvol_write

src/burp/mvol.cpp:1120–1339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1118}
1119
1120UCHAR 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) ?

Callers 2

mvol_fini_writeFunction · 0.85
mvol_write_blockFunction · 0.85

Calls 11

BURP_UP_TO_BLOCKFunction · 0.85
file_not_emptyFunction · 0.85
BURP_printFunction · 0.85
BURP_errorFunction · 0.85
BURP_error_redirectFunction · 0.85
close_platfFunction · 0.70
SafeArgClass · 0.50
isServiceMethod · 0.45
startedMethod · 0.45
putBytesMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected