| 1447 | #endif /* EKCD */ |
| 1448 | |
| 1449 | static int |
| 1450 | kerneldumpcomp_write_cb(void *base, size_t length, off_t offset, void *arg) |
| 1451 | { |
| 1452 | struct dumperinfo *di; |
| 1453 | size_t resid, rlength; |
| 1454 | int error; |
| 1455 | |
| 1456 | di = arg; |
| 1457 | |
| 1458 | if (length % di->blocksize != 0) { |
| 1459 | /* |
| 1460 | * This must be the final write after flushing the compression |
| 1461 | * stream. Write as many full blocks as possible and stash the |
| 1462 | * residual data in the dumper's block buffer. It will be |
| 1463 | * padded and written in dump_finish(). |
| 1464 | */ |
| 1465 | rlength = rounddown(length, di->blocksize); |
| 1466 | if (rlength != 0) { |
| 1467 | error = _dump_append(di, base, 0, rlength); |
| 1468 | if (error != 0) |
| 1469 | return (error); |
| 1470 | } |
| 1471 | resid = length - rlength; |
| 1472 | memmove(di->blockbuf, (uint8_t *)base + rlength, resid); |
| 1473 | bzero((uint8_t *)di->blockbuf + resid, di->blocksize - resid); |
| 1474 | di->kdcomp->kdc_resid = resid; |
| 1475 | return (EAGAIN); |
| 1476 | } |
| 1477 | return (_dump_append(di, base, 0, length)); |
| 1478 | } |
| 1479 | |
| 1480 | /* |
| 1481 | * Write kernel dump headers at the beginning and end of the dump extent. |
nothing calls this directly
no test coverage detected