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

Function flush_io_buff

src/burp/split/spit.cpp:1228–1287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1226
1227
1228static int flush_io_buff(const UCHAR* remaining_io,
1229 SLONG remaining_io_len,
1230 FILE_DESC output_fl_desc,
1231 SINT64 file_size,
1232 SLONG* byte_write,
1233 bool* flush_done)
1234{
1235/********************************************************************
1236**
1237** f l u s h _ i o _ b u f f
1238**
1239*********************************************************************
1240**
1241** Functional description:
1242**
1243** flush out the remaining data in the I/O buffer
1244**
1245** when the file_size is truly has space to write out the remaining data
1246** then
1247** set and returns flush_done true
1248** otherwise
1249** closes the output file, set and returns flush_done false.
1250** otherwise
1251** we can only writes out as much data as file_size indicated
1252** if it was able to write out the remaining data
1253** then
1254** set and returns flush_done true
1255** otherwise
1256** closes the output file, set and returns flush_done false.
1257**
1258*********************************************************************
1259*/
1260
1261 SLONG write_cnt;
1262
1263 if (file_size > remaining_io_len)
1264 write_cnt = write_platf(output_fl_desc, remaining_io, remaining_io_len);
1265 else // file_size <= remaining_io_len
1266 write_cnt = write_platf(output_fl_desc, remaining_io, (unsigned int) file_size);
1267
1268 switch (write_cnt)
1269 {
1270 case -1: // write failed
1271 close_platf(output_fl_desc);
1272 *flush_done = false;
1273 return FB_FAILURE;
1274
1275 default:
1276 if (write_cnt == remaining_io_len) // write ok
1277 *flush_done = true;
1278 else
1279 {
1280 // could not write out all remaining data
1281 close_platf(output_fl_desc);
1282 *flush_done = false;
1283 }
1284 *byte_write = write_cnt;
1285 return FB_SUCCESS;

Callers 1

gen_multy_bakup_filesFunction · 0.85

Calls 2

write_platfFunction · 0.85
close_platfFunction · 0.70

Tested by

no test coverage detected