aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / boot / slot_control.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* slot_control.h -- commit one AIENOS slot control record (slot_format.h) |
| 18 | * through the torn-slot protocol (native/store/torn_slot.c) and prove it |
| 19 | * landed: ts_commit (body, flush, commit header, flush), then ts_recover and |
| 20 | * a byte compare of what came back. The one control-commit routine shared by |
| 21 | * SLOTLDR.EFI (native/boot/slot_loader.c, candidate tries), the kernel |
| 22 | * (native/kernel/svc/slot_service.c, promote / abandon / stage) and the host |
| 23 | * tool (ck_slot_tool control-commit). Freestanding, no allocation. */ |
| 24 | #ifndef AIENOS_CK_SLOT_CONTROL_H |
| 25 | #define AIENOS_CK_SLOT_CONTROL_H |
| 26 | #include "slot_format.h" |
| 27 | #include "../store/torn_slot.h" |
| 28 | |
| 29 | /* r must have been recovered (ts_recover) before the first commit. Returns |
| 30 | * TS_OK with *seq_out = the committed sequence, or the torn-slot error, or |
| 31 | * TS_CORRUPT when the record read back differs from the one committed. */ |
| 32 | int ck_slot_control_commit(ts_region *r, const struct ck_slot_control *c, uint64_t *seq_out); |
| 33 | |
| 34 | #endif |