L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
mbr.h
1/*
2 * Copyright (C) 2025 Kernkonzept GmbH.
3 * Author(s): Jakub Jermar <jakub.jermar@kernkonzept.com>
4 *
5 * License: see LICENSE.spdx (in this directory or the directories above)
6 */
7#pragma once
8
9#include <l4/sys/types.h>
10
11namespace Block_device {
12namespace Mbr {
13
14enum
15{
16 Primary_partitions = 4
17};
18
19enum
20{
21 Magic_lo = 0x55,
22 Magic_hi = 0xaa
23};
24
25enum Partition_type
26{
27 Extended = 0x5,
28 Linux = 0x83
29};
30
31struct Entry
32{
33 l4_uint8_t attr;
34 l4_uint8_t chs_start[3];
35 l4_uint8_t type;
36 l4_uint8_t chs_last[3];
37 l4_uint32_t lba_start;
38 l4_uint32_t lba_num;
39} __attribute__((packed));
40
41struct Mbr
42{
43 l4_uint8_t code[440];
44 l4_uint32_t disk_id;
45 l4_uint16_t reserved;
46 Entry partition[4];
47 l4_uint8_t signature[2];
48} __attribute__((packed));
49
50} // namespace
51
52namespace Ext2 {
53
54enum
55{
56 Superblock_offset = 1024,
57 Superblock_magic = 0xef53,
58 Superblock_version = 1,
59};
60
61// Ext2 superblock with fields essential for getting the "label".
62struct Superblock
63{
64 l4_uint8_t ignore[56];
65 l4_uint16_t magic;
66 l4_uint8_t ignore2[18];
67 l4_uint32_t major;
68 l4_uint8_t ignore3[24];
69 l4_uint8_t fs_id[16];
70 l4_uint8_t name[16];
71} __attribute__((packed));
72
73} // namespace
74
75} // namespace
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition l4int.h:25
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:29
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition l4int.h:27
Common L4 ABI Data Types.