2 * Copyright (C) 2015 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 typedef struct BrilloSlotInfo {
28 typedef struct BrilloBootInfo {
29 // Used by fs_mgr. Must be NUL terminated.
30 char bootctrl_suffix[4];
32 // Magic for identification - must be 'B', 'C', 'c' (short for
33 // "boot_control copy" implementation).
36 // Version of BrilloBootInfo struct, must be 0 or larger.
39 // Currently active slot.
42 // Information about each slot.
43 BrilloSlotInfo slot_info[2];
48 // Loading and saving BrillBootInfo instances.
49 bool boot_info_load(BrilloBootInfo *out_info);
50 bool boot_info_save(BrilloBootInfo *info);
52 // Returns non-zero if valid.
53 bool boot_info_validate(BrilloBootInfo* info);
54 void boot_info_reset(BrilloBootInfo* info);
56 // Opens partition by |name|, e.g. "misc" or "boot_a" with |flags|
57 // (e.g. O_RDONLY or O_RDWR) passed directly to open(2). Returns fd on
58 // success and -1 on error.
59 int boot_info_open_partition(const char *name, uint64_t *out_size, int flags);
61 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
62 _Static_assert(sizeof(BrilloBootInfo) == 32, "BrilloBootInfo has wrong size");