* Extracts a checkpoint from a file descriptor. * * \param[out] cp * Checkpoint structure to read the data into * \param fd * Stream to read checkpoint from * * \return * Whether the operation succeeded or failed due to lack of * space/malformed log */
| 584 | * space/malformed log |
| 585 | */ |
| 586 | inline bool |
| 587 | readCheckpoint(Checkpoint &cp, FILE *fd) { |
| 588 | cp.entryType = EntryType::INVALID; |
| 589 | long numRead = fread(&cp, sizeof(Checkpoint), 1UL, fd); |
| 590 | |
| 591 | if (!numRead) |
| 592 | return false; |
| 593 | |
| 594 | assert(cp.entryType == EntryType::CHECKPOINT); |
| 595 | return true; |
| 596 | } |
| 597 | |
| 598 | /** |
| 599 | * Copies a primitive to a character array and bumps the array pointer. |
no outgoing calls