Merge branch 'master' into isa/arm64
[lunaix-os.git] / lunaix-os / includes / lunaix / blkpart_gpt.h
1 /**
2  * @file blkpart_gpt.h
3  * @author Lunaixsky (lunaxisky@qq.com)
4  * @brief The GUID Partition Table (GPT)
5  * @version 0.1
6  * @date 2022-11-09
7  *
8  * @copyright Copyright (c) 2022
9  *
10  */
11 #ifndef __LUNAIX_BLKPART_GPT_H
12 #define __LUNAIX_BLKPART_GPT_H
13
14 #include <lunaix/device.h>
15 #include <lunaix/types.h>
16
17 struct gpt_header
18 {
19     u8_t signature[8];
20     u32_t rev;
21     u32_t hdr_size;
22     u32_t hdr_cksum;
23     u32_t reserved1;
24     u64_t hdr_lba;
25     u64_t hdr_backup_lba;
26     u64_t lba_start;
27     u64_t lba_end;
28     u8_t guid[16];
29     u64_t ents_lba;
30     u32_t ents_len;
31     u32_t ent_size;
32     u32_t ent_cksum;
33     // reserved start here
34 } compact;
35
36 struct gpt_entry
37 {
38     u8_t pguid[16];
39     u8_t uguid[16];
40     u64_t start_lba;
41     u64_t end_lba;
42     u64_t attr_flags;
43     char name[72];
44 } compact;
45
46 int
47 blkpart_probegpt(struct device* master);
48
49 #endif /* __LUNAIX_BLKPART_GPT_H */