block: add gpt partitioning
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
0d87d7bffe
commit
25c0b538d2
5 changed files with 177 additions and 3 deletions
40
kernel/block/gpt.h
Normal file
40
kernel/block/gpt.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef _GPT_H_
|
||||
#define _GPT_H_
|
||||
|
||||
#include <kernel/common.h>
|
||||
#include <kernel/block.h>
|
||||
|
||||
#include <lib/list.h>
|
||||
|
||||
|
||||
struct gpt_header {
|
||||
char signature[8];
|
||||
u32 revision;
|
||||
u32 header_size;
|
||||
u32 header_crc32;
|
||||
u32 reserved;
|
||||
u64 this_lba;
|
||||
u64 alt_lba;
|
||||
u64 first_lba;
|
||||
u64 last_lba;
|
||||
char diskguid[16];
|
||||
u64 pentry_lba;
|
||||
u32 n_pentries;
|
||||
u32 pentry_size;
|
||||
u32 pentry_crc32;
|
||||
} PACKED;
|
||||
|
||||
struct gpt_partition {
|
||||
char ptypeguid[16];
|
||||
char partguid[16];
|
||||
u64 lba_start;
|
||||
u64 lba_end;
|
||||
u64 attributes;
|
||||
char partname[72];
|
||||
} PACKED;
|
||||
|
||||
int gpt_parse_partitions(struct block_device *bdev, struct gpt_partition **out);
|
||||
bool block_has_gpt_header(struct block_device *bdev);
|
||||
|
||||
#endif /* _GPT_H_ */
|
||||
Loading…
Reference in a new issue