Spdk/include/spdk/gpt_spec.h
Jim Harris 488570ebd4 Replace most BSD 3-clause license text with SPDX identifier.
Many open source projects have moved to using SPDX identifiers
to specify license information, reducing the amount of
boilerplate code in every source file.  This patch replaces
the bulk of SPDK .c, .cpp and Makefiles with the BSD-3-Clause
identifier.

Almost all of these files share the exact same license text,
and this patch only modifies the files that contain the
most common license text.  There can be slight variations
because the third clause contains company names - most say
"Intel Corporation", but there are instances for Nvidia,
Samsung, Eideticom and even "the copyright holder".

Used a bash script to automate replacement of the license text
with SPDX identifier which is checked into scripts/spdx.sh.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaa88ab5e92ea471691dc298cfe41ebfb5d169780
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12904
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: <qun.wan@intel.com>
2022-06-09 07:35:12 +00:00

117 lines
3.1 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) Intel Corporation.
* All rights reserved.
*/
/**
* \file
* GUID Partition Table (GPT) specification definitions
*/
#ifndef SPDK_GPT_SPEC_H
#define SPDK_GPT_SPEC_H
#include "spdk/stdinc.h"
#include "spdk/assert.h"
#pragma pack(push, 1)
#define SPDK_MBR_SIGNATURE 0xAA55
#define SPDK_MBR_OS_TYPE_GPT_PROTECTIVE 0xEE
#define SPDK_MBR_OS_TYPE_EFI_SYSTEM_PARTITION 0xEF
struct spdk_mbr_chs {
uint8_t head;
uint16_t sector : 6;
uint16_t cylinder : 10;
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_mbr_chs) == 3, "size incorrect");
struct spdk_mbr_partition_entry {
uint8_t reserved : 7;
uint8_t bootable : 1;
struct spdk_mbr_chs start_chs;
uint8_t os_type;
struct spdk_mbr_chs end_chs;
uint32_t start_lba;
uint32_t size_lba;
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_mbr_partition_entry) == 16, "size incorrect");
struct spdk_mbr {
uint8_t boot_code[440];
uint32_t disk_signature;
uint16_t reserved_444;
struct spdk_mbr_partition_entry partitions[4];
uint16_t mbr_signature;
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_mbr) == 512, "size incorrect");
#define SPDK_GPT_SIGNATURE "EFI PART"
#define SPDK_GPT_REVISION_1_0 0x00010000u
struct spdk_gpt_guid {
uint8_t raw[16];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_gpt_guid) == 16, "size incorrect");
#define SPDK_GPT_GUID(a, b, c, d, e) \
(struct spdk_gpt_guid){{ \
(uint8_t)(a), (uint8_t)(((uint32_t)a) >> 8), \
(uint8_t)(((uint32_t)a) >> 16), (uint8_t)(((uint32_t)a >> 24)), \
(uint8_t)(b), (uint8_t)(((uint16_t)b) >> 8), \
(uint8_t)(c), (uint8_t)(((uint16_t)c) >> 8), \
(uint8_t)(((uint16_t)d) >> 8), (uint8_t)(d), \
(uint8_t)(((uint64_t)e) >> 40), (uint8_t)(((uint64_t)e) >> 32), (uint8_t)(((uint64_t)e) >> 24), \
(uint8_t)(((uint64_t)e) >> 16), (uint8_t)(((uint64_t)e) >> 8), (uint8_t)(e) \
}}
#define SPDK_GPT_PART_TYPE_UNUSED SPDK_GPT_GUID(0x00000000, 0x0000, 0x0000, 0x0000, 0x000000000000)
#define SPDK_GPT_PART_TYPE_EFI_SYSTEM_PARTITION SPDK_GPT_GUID(0xC12A7328, 0xF81F, 0x11D2, 0xBA4B, 0x00A0C93EC93B)
#define SPDK_GPT_PART_TYPE_LEGACY_MBR SPDK_GPT_GUID(0x024DEE41, 0x33E7, 0x11D3, 0x9D69, 0x0008C781F39F)
struct spdk_gpt_header {
char gpt_signature[8];
uint32_t revision;
uint32_t header_size;
uint32_t header_crc32;
uint32_t reserved;
uint64_t my_lba;
uint64_t alternate_lba;
uint64_t first_usable_lba;
uint64_t last_usable_lba;
struct spdk_gpt_guid disk_guid;
uint64_t partition_entry_lba;
uint32_t num_partition_entries;
uint32_t size_of_partition_entry;
uint32_t partition_entry_array_crc32;
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_gpt_header) == 92, "size incorrect");
struct spdk_gpt_partition_entry {
struct spdk_gpt_guid part_type_guid;
struct spdk_gpt_guid unique_partition_guid;
uint64_t starting_lba;
uint64_t ending_lba;
struct {
uint64_t required : 1;
uint64_t no_block_io_proto : 1;
uint64_t legacy_bios_bootable : 1;
uint64_t reserved_uefi : 45;
uint64_t guid_specific : 16;
} attr;
uint16_t partition_name[36];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_gpt_partition_entry) == 128, "size incorrect");
#pragma pack(pop)
#endif