2022-06-03 19:15:11 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2022-11-01 20:26:26 +00:00
|
|
|
* Copyright (C) 2017 Intel Corporation.
|
2017-06-01 05:02:54 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* GPT internal Interface
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SPDK_INTERNAL_GPT_H
|
|
|
|
#define SPDK_INTERNAL_GPT_H
|
|
|
|
|
2017-07-21 19:49:09 +00:00
|
|
|
#include "spdk/stdinc.h"
|
|
|
|
|
2017-06-01 05:02:54 +00:00
|
|
|
#include "spdk/gpt_spec.h"
|
|
|
|
|
|
|
|
#define SPDK_GPT_PART_TYPE_GUID SPDK_GPT_GUID(0x7c5222bd, 0x8f5d, 0x4087, 0x9c00, 0xbf9843c7b58c)
|
|
|
|
#define SPDK_GPT_BUFFER_SIZE 32768 /* 32KB */
|
2017-07-07 17:51:47 +00:00
|
|
|
#define SPDK_GPT_GUID_EQUAL(x,y) (memcmp(x, y, sizeof(struct spdk_gpt_guid)) == 0)
|
2017-06-01 05:02:54 +00:00
|
|
|
|
2019-01-19 06:56:14 +00:00
|
|
|
enum spdk_gpt_parse_phase {
|
|
|
|
SPDK_GPT_PARSE_PHASE_INVALID = 0,
|
|
|
|
SPDK_GPT_PARSE_PHASE_PRIMARY,
|
|
|
|
SPDK_GPT_PARSE_PHASE_SECONDARY,
|
|
|
|
};
|
|
|
|
|
2017-06-01 05:02:54 +00:00
|
|
|
struct spdk_gpt {
|
2019-01-19 06:56:14 +00:00
|
|
|
uint8_t parse_phase;
|
2017-06-01 05:02:54 +00:00
|
|
|
unsigned char *buf;
|
2017-10-23 18:59:27 +00:00
|
|
|
uint64_t buf_size;
|
2017-06-01 05:02:54 +00:00
|
|
|
uint64_t lba_start;
|
|
|
|
uint64_t lba_end;
|
|
|
|
uint64_t total_sectors;
|
|
|
|
uint32_t sector_size;
|
|
|
|
struct spdk_gpt_header *header;
|
|
|
|
struct spdk_gpt_partition_entry *partitions;
|
|
|
|
};
|
|
|
|
|
2020-05-10 07:22:54 +00:00
|
|
|
int gpt_parse_mbr(struct spdk_gpt *gpt);
|
|
|
|
int gpt_parse_partition_table(struct spdk_gpt *gpt);
|
2017-06-01 05:02:54 +00:00
|
|
|
|
|
|
|
#endif /* SPDK_INTERNAL_GPT_H */
|