part.c (7f49ce7a0b5f0d501d233308d73ccb1bf191a68b) part.c (124003d5870a2da22648cfd8d9a71fda4f0d64a7)
1/*-
2 * Copyright (c) 2012 Andrey V. Elsukov <ae@FreeBSD.org>
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 * 1. Redistributions of source code must retain the above copyright

--- 46 unchanged lines hidden (view full) ---

55static const uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA;
56static const uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
57static const uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI;
58static const uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD;
59static const uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT;
60static const uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP;
61static const uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
62static const uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
1/*-
2 * Copyright (c) 2012 Andrey V. Elsukov <ae@FreeBSD.org>
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 * 1. Redistributions of source code must retain the above copyright

--- 46 unchanged lines hidden (view full) ---

55static const uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA;
56static const uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
57static const uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI;
58static const uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD;
59static const uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT;
60static const uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP;
61static const uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
62static const uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
63static const uuid_t gpt_uuid_apple_apfs = GPT_ENT_TYPE_APPLE_APFS;
63#endif
64
65struct pentry {
66 struct ptable_entry part;
67 uint64_t flags;
68 union {
69 uint8_t bsd;
70 uint8_t mbr;

--- 22 unchanged lines hidden (view full) ---

93 { PART_FREEBSD_UFS, "FreeBSD UFS" },
94 { PART_FREEBSD_ZFS, "FreeBSD ZFS" },
95 { PART_FREEBSD_SWAP, "FreeBSD swap" },
96 { PART_FREEBSD_VINUM, "FreeBSD vinum" },
97 { PART_LINUX, "Linux" },
98 { PART_LINUX_SWAP, "Linux swap" },
99 { PART_DOS, "DOS/Windows" },
100 { PART_ISO9660, "ISO9660" },
64#endif
65
66struct pentry {
67 struct ptable_entry part;
68 uint64_t flags;
69 union {
70 uint8_t bsd;
71 uint8_t mbr;

--- 22 unchanged lines hidden (view full) ---

94 { PART_FREEBSD_UFS, "FreeBSD UFS" },
95 { PART_FREEBSD_ZFS, "FreeBSD ZFS" },
96 { PART_FREEBSD_SWAP, "FreeBSD swap" },
97 { PART_FREEBSD_VINUM, "FreeBSD vinum" },
98 { PART_LINUX, "Linux" },
99 { PART_LINUX_SWAP, "Linux swap" },
100 { PART_DOS, "DOS/Windows" },
101 { PART_ISO9660, "ISO9660" },
102 { PART_APFS, "APFS" },
101};
102
103const char *
104parttype2str(enum partition_type type)
105{
106 size_t i;
107
108 for (i = 0; i < nitems(ptypes); i++)

--- 27 unchanged lines hidden (view full) ---

136 else if (uuid_equal(&type, &gpt_uuid_freebsd_zfs, NULL))
137 return (PART_FREEBSD_ZFS);
138 else if (uuid_equal(&type, &gpt_uuid_freebsd_swap, NULL))
139 return (PART_FREEBSD_SWAP);
140 else if (uuid_equal(&type, &gpt_uuid_freebsd_vinum, NULL))
141 return (PART_FREEBSD_VINUM);
142 else if (uuid_equal(&type, &gpt_uuid_freebsd, NULL))
143 return (PART_FREEBSD);
103};
104
105const char *
106parttype2str(enum partition_type type)
107{
108 size_t i;
109
110 for (i = 0; i < nitems(ptypes); i++)

--- 27 unchanged lines hidden (view full) ---

138 else if (uuid_equal(&type, &gpt_uuid_freebsd_zfs, NULL))
139 return (PART_FREEBSD_ZFS);
140 else if (uuid_equal(&type, &gpt_uuid_freebsd_swap, NULL))
141 return (PART_FREEBSD_SWAP);
142 else if (uuid_equal(&type, &gpt_uuid_freebsd_vinum, NULL))
143 return (PART_FREEBSD_VINUM);
144 else if (uuid_equal(&type, &gpt_uuid_freebsd, NULL))
145 return (PART_FREEBSD);
146 else if (uuid_equal(&type, &gpt_uuid_apple_apfs, NULL))
147 return (PART_APFS);
144 return (PART_UNKNOWN);
145}
146
147static struct gpt_hdr *
148gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self, uint64_t lba_last,
149 uint16_t sectorsize)
150{
151 uint32_t sz, crc;

--- 790 unchanged lines hidden ---
148 return (PART_UNKNOWN);
149}
150
151static struct gpt_hdr *
152gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self, uint64_t lba_last,
153 uint16_t sectorsize)
154{
155 uint32_t sz, crc;

--- 790 unchanged lines hidden ---