xref: /spdk/module/bdev/gpt/gpt.h (revision 307b8c112ffd90a26d53dd15fad67bd9038ef526)
1  /*   SPDX-License-Identifier: BSD-3-Clause
2   *   Copyright (c) Intel Corporation.
3   *   All rights reserved.
4   */
5  
6  /** \file
7   * GPT internal Interface
8   */
9  
10  #ifndef SPDK_INTERNAL_GPT_H
11  #define SPDK_INTERNAL_GPT_H
12  
13  #include "spdk/stdinc.h"
14  
15  #include "spdk/gpt_spec.h"
16  
17  #define SPDK_GPT_PART_TYPE_GUID SPDK_GPT_GUID(0x7c5222bd, 0x8f5d, 0x4087, 0x9c00, 0xbf9843c7b58c)
18  #define SPDK_GPT_BUFFER_SIZE 32768  /* 32KB */
19  #define	SPDK_GPT_GUID_EQUAL(x,y) (memcmp(x, y, sizeof(struct spdk_gpt_guid)) == 0)
20  
21  enum spdk_gpt_parse_phase {
22  	SPDK_GPT_PARSE_PHASE_INVALID = 0,
23  	SPDK_GPT_PARSE_PHASE_PRIMARY,
24  	SPDK_GPT_PARSE_PHASE_SECONDARY,
25  };
26  
27  struct spdk_gpt {
28  	uint8_t parse_phase;
29  	unsigned char *buf;
30  	uint64_t buf_size;
31  	uint64_t lba_start;
32  	uint64_t lba_end;
33  	uint64_t total_sectors;
34  	uint32_t sector_size;
35  	struct spdk_gpt_header *header;
36  	struct spdk_gpt_partition_entry *partitions;
37  };
38  
39  int gpt_parse_mbr(struct spdk_gpt *gpt);
40  int gpt_parse_partition_table(struct spdk_gpt *gpt);
41  
42  #endif  /* SPDK_INTERNAL_GPT_H */
43