]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/lib/bdev/gpt/gpt.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / lib / bdev / gpt / gpt.h
CommitLineData
7c673cae
FG
1/*-
2 * BSD LICENSE
3 *
4 * Copyright (c) Intel Corporation.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
11fdf7f2
TL
34/** \file
35 * GPT internal Interface
36 */
7c673cae 37
11fdf7f2
TL
38#ifndef SPDK_INTERNAL_GPT_H
39#define SPDK_INTERNAL_GPT_H
7c673cae 40
11fdf7f2 41#include "spdk/stdinc.h"
7c673cae 42
11fdf7f2 43#include "spdk/gpt_spec.h"
7c673cae 44
11fdf7f2
TL
45#define SPDK_GPT_PART_TYPE_GUID SPDK_GPT_GUID(0x7c5222bd, 0x8f5d, 0x4087, 0x9c00, 0xbf9843c7b58c)
46#define SPDK_GPT_BUFFER_SIZE 32768 /* 32KB */
47#define SPDK_GPT_GUID_EQUAL(x,y) (memcmp(x, y, sizeof(struct spdk_gpt_guid)) == 0)
7c673cae 48
9f95a23c
TL
49enum spdk_gpt_parse_phase {
50 SPDK_GPT_PARSE_PHASE_INVALID = 0,
51 SPDK_GPT_PARSE_PHASE_PRIMARY,
52 SPDK_GPT_PARSE_PHASE_SECONDARY,
53};
54
11fdf7f2 55struct spdk_gpt {
9f95a23c 56 uint8_t parse_phase;
11fdf7f2
TL
57 unsigned char *buf;
58 uint64_t buf_size;
59 uint64_t lba_start;
60 uint64_t lba_end;
61 uint64_t total_sectors;
62 uint32_t sector_size;
63 struct spdk_gpt_header *header;
64 struct spdk_gpt_partition_entry *partitions;
65};
7c673cae 66
9f95a23c
TL
67int spdk_gpt_parse_mbr(struct spdk_gpt *gpt);
68int spdk_gpt_parse_partition_table(struct spdk_gpt *gpt);
7c673cae 69
11fdf7f2 70#endif /* SPDK_INTERNAL_GPT_H */