source: mainline/uspace/lib/label/include/std/gpt.h@ 3faa03d

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 3faa03d was 3faa03d, checked in by Jiri Svoboda <jiri@…>, 10 years ago

Liblabel reading GPT and MBR partitions (primary only).

  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[975e7e9]1/*
[3faa03d]2 * Copyright (c) 2015 Jiri Svoboda
[975e7e9]3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup bd
30 * @{
31 */
32/** @file
33 */
34
[3faa03d]35#ifndef LIBLABEL_STD_GPT_H_
36#define LIBLABEL_STD_GPT_H_
[975e7e9]37
38#include <sys/types.h>
39
40/** Block address of GPT header. */
41#define GPT_HDR_BA 1
42
43/** GPT header */
44typedef struct {
45 uint8_t efi_signature[8];
46 uint32_t revision;
47 uint32_t header_size;
48 uint32_t header_crc32;
49 uint32_t reserved;
50 uint64_t my_lba;
51 uint64_t alternate_lba;
52 uint64_t first_usable_lba;
53 uint64_t last_usable_lba;
54 uint8_t disk_guid[16];
55 uint64_t entry_lba;
56 uint32_t num_entries;
57 uint32_t entry_size;
58 uint32_t pe_array_crc32;
59} __attribute__((packed)) gpt_header_t;
60
61/** GPT partition entry */
62typedef struct {
63 uint8_t part_type[16];
64 uint8_t part_id[16];
65 uint64_t start_lba;
66 uint64_t end_lba;
67 uint64_t attributes;
68 uint16_t part_name[36];
69} __attribute__((packed)) gpt_entry_t;
70
71#endif
72
73/** @}
74 */
Note: See TracBrowser for help on using the repository browser.