Android-cuttlefish cvd tool
mbr.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 The Android Open Source Project
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#pragma once
17
18#include <stdint.h>
19
20namespace cuttlefish {
21
22inline constexpr int kSectorSizeShift = 9;
23inline constexpr int kSectorSize = 1 << kSectorSizeShift;
24
25struct __attribute__((packed)) MbrPartitionEntry {
26 uint8_t status;
27 uint8_t begin_chs[3];
28 uint8_t partition_type;
29 uint8_t end_chs[3];
30 uint32_t first_lba;
31 uint32_t num_sectors;
32};
33
34struct __attribute__((packed)) MasterBootRecord {
35 uint8_t bootstrap_code[446];
36 MbrPartitionEntry partitions[4];
37 uint8_t boot_signature[2];
38};
39
40static_assert(sizeof(MasterBootRecord) == kSectorSize);
41
48MasterBootRecord ProtectiveMbr(uint64_t size);
49
50} // namespace cuttlefish
int status()
Definition: health.cpp:42
uint32_t size
Definition: io.h:2
Definition: alloc_utils.cpp:23
constexpr int kSectorSizeShift
Definition: mbr.h:22
MasterBootRecord ProtectiveMbr(uint64_t size)
Definition: mbr.cc:22
struct __attribute__((__packed__)) tpm_message_header
Definition: in_process_tpm.cpp:50
constexpr int kSectorSize
Definition: mbr.h:23