bootc_lib/
discoverable_partition_specification.rs

1#![allow(dead_code)]
2
3//! Partition type GUIDs from the Discoverable Partitions Specification (DPS)
4//!
5//! This module contains constants for partition type GUIDs as defined by the
6//! UAPI Group's Discoverable Partitions Specification.
7//!
8//! Reference: <https://uapi-group.org/specifications/specs/discoverable_partitions_specification/>
9
10// ============================================================================
11// ROOT PARTITIONS
12// ============================================================================
13
14/// Root partition for Alpha architecture
15pub const ROOT_ALPHA: &str = "6523f8ae-3eb1-4e2a-a05a-18b695ae656f";
16
17/// Root partition for ARC architecture
18pub const ROOT_ARC: &str = "d27f46ed-2919-4cb8-bd25-9531f3c16534";
19
20/// Root partition for 32-bit ARM architecture
21pub const ROOT_ARM: &str = "69dad710-2ce4-4e3c-b16c-21a1d49abed3";
22
23/// Root partition for 64-bit ARM/AArch64 architecture
24pub const ROOT_ARM64: &str = "b921b045-1df0-41c3-af44-4c6f280d3fae";
25
26/// Root partition for Itanium/IA-64 architecture
27pub const ROOT_IA64: &str = "993d8d3d-f80e-4225-855a-9daf8ed7ea97";
28
29/// Root partition for 64-bit LoongArch architecture
30pub const ROOT_LOONGARCH64: &str = "77055800-792c-4f94-b39a-98c91b762bb6";
31
32/// Root partition for 32-bit MIPS Little Endian
33pub const ROOT_MIPS_LE: &str = "37c58c8a-d913-4156-a25f-48b1b64e07f0";
34
35/// Root partition for 64-bit MIPS Little Endian
36pub const ROOT_MIPS64_LE: &str = "700bda43-7a34-4507-b179-eeb93d7a7ca3";
37
38/// Root partition for 32-bit MIPS Big Endian
39pub const ROOT_MIPS: &str = "e9434544-6e2c-47cc-bae2-12d6deafb44c";
40
41/// Root partition for 64-bit MIPS Big Endian
42pub const ROOT_MIPS64: &str = "d113af76-80ef-41b4-bdb6-0cff4d3d4a25";
43
44/// Root partition for PA-RISC/HPPA architecture
45pub const ROOT_PARISC: &str = "1aacdb3b-5444-4138-bd9e-e5c2239b2346";
46
47/// Root partition for 32-bit PowerPC
48pub const ROOT_PPC: &str = "1de3f1ef-fa98-47b5-8dcd-4a860a654d78";
49
50/// Root partition for 64-bit PowerPC Big Endian
51pub const ROOT_PPC64: &str = "912ade1d-a839-4913-8964-a10eee08fbd2";
52
53/// Root partition for 64-bit PowerPC Little Endian
54pub const ROOT_PPC64_LE: &str = "c31c45e6-3f39-412e-80fb-4809c4980599";
55
56/// Root partition for 32-bit RISC-V
57pub const ROOT_RISCV32: &str = "60d5a7fe-8e7d-435c-b714-3dd8162144e1";
58
59/// Root partition for 64-bit RISC-V
60pub const ROOT_RISCV64: &str = "72ec70a6-cf74-40e6-bd49-4bda08e8f224";
61
62/// Root partition for s390 architecture
63pub const ROOT_S390: &str = "08a7acea-624c-4a20-91e8-6e0fa67d23f9";
64
65/// Root partition for s390x architecture
66pub const ROOT_S390X: &str = "5eead9a9-fe09-4a1e-a1d7-520d00531306";
67
68/// Root partition for TILE-Gx architecture
69pub const ROOT_TILEGX: &str = "c50cdd70-3862-4cc3-90e1-809a8c93ee2c";
70
71/// Root partition for 32-bit x86
72pub const ROOT_X86: &str = "44479540-f297-41b2-9af7-d131d5f0458a";
73
74/// Root partition for 64-bit x86/AMD64
75pub const ROOT_X86_64: &str = "4f68bce3-e8cd-4db1-96e7-fbcaf984b709";
76
77// ============================================================================
78// USR PARTITIONS
79// ============================================================================
80
81/// /usr partition for Alpha architecture
82pub const USR_ALPHA: &str = "e18cf08c-33ec-4c0d-8246-c6c6fb3da024";
83
84/// /usr partition for ARC architecture
85pub const USR_ARC: &str = "7978a683-6316-4922-bbee-38bff5a2fecc";
86
87/// /usr partition for 32-bit ARM
88pub const USR_ARM: &str = "7d0359a3-02b3-4f0a-865c-654403e70625";
89
90/// /usr partition for 64-bit ARM/AArch64
91pub const USR_ARM64: &str = "b0e01050-ee5f-4390-949a-9101b17104e9";
92
93/// /usr partition for Itanium/IA-64
94pub const USR_IA64: &str = "4301d2a6-4e3b-4b2a-bb94-9e0b2c4225ea";
95
96/// /usr partition for 64-bit LoongArch
97pub const USR_LOONGARCH64: &str = "e611c702-575c-4cbe-9a46-434fa0bf7e3f";
98
99/// /usr partition for 32-bit MIPS Big Endian
100pub const USR_MIPS: &str = "773b2abc-2a99-4398-8bf5-03baac40d02b";
101
102/// /usr partition for 64-bit MIPS Big Endian
103pub const USR_MIPS64: &str = "57e13958-7331-4365-8e6e-35eeee17c61b";
104
105/// /usr partition for 32-bit MIPS Little Endian
106pub const USR_MIPS_LE: &str = "0f4868e9-9952-4706-979f-3ed3a473e947";
107
108/// /usr partition for 64-bit MIPS Little Endian
109pub const USR_MIPS64_LE: &str = "c97c1f32-ba06-40b4-9f22-236061b08aa8";
110
111/// /usr partition for PA-RISC
112pub const USR_PARISC: &str = "dc4a4480-6917-4262-a4ec-db9384949f25";
113
114/// /usr partition for 32-bit PowerPC
115pub const USR_PPC: &str = "7d14fec5-cc71-415d-9d6c-06bf0b3c3eaf";
116
117/// /usr partition for 64-bit PowerPC Big Endian
118pub const USR_PPC64: &str = "2c9739e2-f068-46b3-9fd0-01c5a9afbcca";
119
120/// /usr partition for 64-bit PowerPC Little Endian
121pub const USR_PPC64_LE: &str = "15bb03af-77e7-4d4a-b12b-c0d084f7491c";
122
123/// /usr partition for 32-bit RISC-V
124pub const USR_RISCV32: &str = "b933fb22-5c3f-4f91-af90-e2bb0fa50702";
125
126/// /usr partition for 64-bit RISC-V
127pub const USR_RISCV64: &str = "beaec34b-8442-439b-a40b-984381ed097d";
128
129/// /usr partition for s390
130pub const USR_S390: &str = "cd0f869b-d0fb-4ca0-b141-9ea87cc78d66";
131
132/// /usr partition for s390x
133pub const USR_S390X: &str = "8a4f5770-50aa-4ed3-874a-99b710db6fea";
134
135/// /usr partition for TILE-Gx
136pub const USR_TILEGX: &str = "55497029-c7c1-44cc-aa39-815ed1558630";
137
138/// /usr partition for 32-bit x86
139pub const USR_X86: &str = "75250d76-8cc6-458e-bd66-bd47cc81a812";
140
141/// /usr partition for 64-bit x86/AMD64
142pub const USR_X86_64: &str = "8484680c-9521-48c6-9c11-b0720656f69e";
143
144// ============================================================================
145// ROOT VERITY PARTITIONS
146// ============================================================================
147
148/// Root verity partition for Alpha
149pub const ROOT_VERITY_ALPHA: &str = "fc56d9e9-e6e5-4c06-be32-e74407ce09a5";
150
151/// Root verity partition for ARC
152pub const ROOT_VERITY_ARC: &str = "24b2d975-0f97-4521-afa1-cd531e421b8d";
153
154/// Root verity partition for 32-bit ARM
155pub const ROOT_VERITY_ARM: &str = "7386cdf2-203c-47a9-a498-f2ecce45a2d6";
156
157/// Root verity partition for 64-bit ARM/AArch64
158pub const ROOT_VERITY_ARM64: &str = "df3300ce-d69f-4c92-978c-9bfb0f38d820";
159
160/// Root verity partition for Itanium/IA-64
161pub const ROOT_VERITY_IA64: &str = "86ed10d5-b607-45bb-8957-d350f23d0571";
162
163/// Root verity partition for 64-bit LoongArch
164pub const ROOT_VERITY_LOONGARCH64: &str = "f3393b22-e9af-4613-a948-9d3bfbd0c535";
165
166/// Root verity partition for 32-bit MIPS Big Endian
167pub const ROOT_VERITY_MIPS: &str = "7a430799-f711-4c7e-8e5b-1d685bd48607";
168
169/// Root verity partition for 64-bit MIPS Big Endian
170pub const ROOT_VERITY_MIPS64: &str = "579536f8-6a33-4055-a95a-df2d5e2c42a8";
171
172/// Root verity partition for 32-bit MIPS Little Endian
173pub const ROOT_VERITY_MIPS_LE: &str = "d7d150d2-2a04-4a33-8f12-16651205ff7b";
174
175/// Root verity partition for 64-bit MIPS Little Endian
176pub const ROOT_VERITY_MIPS64_LE: &str = "16b417f8-3e06-4f57-8dd2-9b5232f41aa6";
177
178/// Root verity partition for PA-RISC
179pub const ROOT_VERITY_PARISC: &str = "d212a430-fbc5-49f9-a983-a7feef2b8d0e";
180
181/// Root verity partition for 32-bit PowerPC
182pub const ROOT_VERITY_PPC: &str = "98cfe649-1588-46dc-b2f0-add147424925";
183
184/// Root verity partition for 64-bit PowerPC Big Endian
185pub const ROOT_VERITY_PPC64: &str = "9225a9a3-3c19-4d89-b4f6-eeff88f17631";
186
187/// Root verity partition for 64-bit PowerPC Little Endian
188pub const ROOT_VERITY_PPC64_LE: &str = "906bd944-4589-4aae-a4e4-dd983917446a";
189
190/// Root verity partition for 32-bit RISC-V
191pub const ROOT_VERITY_RISCV32: &str = "ae0253be-1167-4007-ac68-43926c14c5de";
192
193/// Root verity partition for 64-bit RISC-V
194pub const ROOT_VERITY_RISCV64: &str = "b6ed5582-440b-4209-b8da-5ff7c419ea3d";
195
196/// Root verity partition for s390
197pub const ROOT_VERITY_S390: &str = "7ac63b47-b25c-463b-8df8-b4a94e6c90e1";
198
199/// Root verity partition for s390x
200pub const ROOT_VERITY_S390X: &str = "b325bfbe-c7be-4ab8-8357-139e652d2f6b";
201
202/// Root verity partition for TILE-Gx
203pub const ROOT_VERITY_TILEGX: &str = "966061ec-28e4-4b2e-b4a5-1f0a825a1d84";
204
205/// Root verity partition for 32-bit x86
206pub const ROOT_VERITY_X86: &str = "d13c5d3b-b5d1-422a-b29f-9454fdc89d76";
207
208/// Root verity partition for 64-bit x86/AMD64
209pub const ROOT_VERITY_X86_64: &str = "2c7357ed-ebd2-46d9-aec1-23d437ec2bf5";
210
211// ============================================================================
212// USR VERITY PARTITIONS
213// ============================================================================
214
215/// /usr verity partition for Alpha
216pub const USR_VERITY_ALPHA: &str = "8cce0d25-c0d0-4a44-bd87-46331bf1df67";
217
218/// /usr verity partition for ARC
219pub const USR_VERITY_ARC: &str = "fca0598c-d880-4591-8c16-4eda05c7347c";
220
221/// /usr verity partition for 32-bit ARM
222pub const USR_VERITY_ARM: &str = "c215d751-7bcd-4649-be90-6627490a4c05";
223
224/// /usr verity partition for 64-bit ARM/AArch64
225pub const USR_VERITY_ARM64: &str = "6e11a4e7-fbca-4ded-b9e9-e1a512bb664e";
226
227/// /usr verity partition for Itanium/IA-64
228pub const USR_VERITY_IA64: &str = "6a491e03-3be7-4545-8e38-83320e0ea880";
229
230/// /usr verity partition for 64-bit LoongArch
231pub const USR_VERITY_LOONGARCH64: &str = "f46b2c26-59ae-48f0-9106-c50ed47f673d";
232
233/// /usr verity partition for 32-bit MIPS Big Endian
234pub const USR_VERITY_MIPS: &str = "6e5a1bc8-d223-49b7-bca8-37a5fcceb996";
235
236/// /usr verity partition for 64-bit MIPS Big Endian
237pub const USR_VERITY_MIPS64: &str = "81cf9d90-7458-4df4-8dcf-c8a3a404f09b";
238
239/// /usr verity partition for 32-bit MIPS Little Endian
240pub const USR_VERITY_MIPS_LE: &str = "46b98d8d-b55c-4e8f-aab3-37fca7f80752";
241
242/// /usr verity partition for 64-bit MIPS Little Endian
243pub const USR_VERITY_MIPS64_LE: &str = "3c3d61fe-b5f3-414d-bb71-8739a694a4ef";
244
245/// /usr verity partition for PA-RISC
246pub const USR_VERITY_PARISC: &str = "5843d618-ec37-48d7-9f12-cea8e08768b2";
247
248/// /usr verity partition for 32-bit PowerPC
249pub const USR_VERITY_PPC: &str = "df765d00-270e-49e5-bc75-f47bb2118b09";
250
251/// /usr verity partition for 64-bit PowerPC Big Endian
252pub const USR_VERITY_PPC64: &str = "bdb528a5-a259-475f-a87d-da53fa736a07";
253
254/// /usr verity partition for 64-bit PowerPC Little Endian
255pub const USR_VERITY_PPC64_LE: &str = "ee2b9983-21e8-4153-86d9-b6901a54d1ce";
256
257/// /usr verity partition for 32-bit RISC-V
258pub const USR_VERITY_RISCV32: &str = "cb1ee4e3-8cd0-4136-a0a4-aa61a32e8730";
259
260/// /usr verity partition for 64-bit RISC-V
261pub const USR_VERITY_RISCV64: &str = "8f1056be-9b05-47c4-81d6-be53128e5b54";
262
263/// /usr verity partition for s390
264pub const USR_VERITY_S390: &str = "b663c618-e7bc-4d6d-90aa-11b756bb1797";
265
266/// /usr verity partition for s390x
267pub const USR_VERITY_S390X: &str = "31741cc4-1a2a-4111-a581-e00b447d2d06";
268
269/// /usr verity partition for TILE-Gx
270pub const USR_VERITY_TILEGX: &str = "2fb4bf56-07fa-42da-8132-6b139f2026ae";
271
272/// /usr verity partition for 32-bit x86
273pub const USR_VERITY_X86: &str = "8f461b0d-14ee-4e81-9aa9-049b6fb97abd";
274
275/// /usr verity partition for 64-bit x86/AMD64
276pub const USR_VERITY_X86_64: &str = "77ff5f63-e7b6-4633-acf4-1565b864c0e6";
277
278// ============================================================================
279// ROOT VERITY SIGNATURE PARTITIONS
280// ============================================================================
281
282/// Root verity signature partition for Alpha
283pub const ROOT_VERITY_SIG_ALPHA: &str = "d46495b7-a053-414f-80f7-700c99921ef8";
284
285/// Root verity signature partition for ARC
286pub const ROOT_VERITY_SIG_ARC: &str = "143a70ba-cbd3-4f06-919f-6c05683a78bc";
287
288/// Root verity signature partition for 32-bit ARM
289pub const ROOT_VERITY_SIG_ARM: &str = "42b0455f-eb11-491d-98d3-56145ba9d037";
290
291/// Root verity signature partition for 64-bit ARM/AArch64
292pub const ROOT_VERITY_SIG_ARM64: &str = "6db69de6-29f4-4758-a7a5-962190f00ce3";
293
294/// Root verity signature partition for Itanium/IA-64
295pub const ROOT_VERITY_SIG_IA64: &str = "e98b36ee-32ba-4882-9b12-0ce14655f46a";
296
297/// Root verity signature partition for 64-bit LoongArch
298pub const ROOT_VERITY_SIG_LOONGARCH64: &str = "5afb67eb-ecc8-4f85-ae8e-ac1e7c50e7d0";
299
300/// Root verity signature partition for 32-bit MIPS Big Endian
301pub const ROOT_VERITY_SIG_MIPS: &str = "bba210a2-9c5d-45ee-9e87-ff2ccbd002d0";
302
303/// Root verity signature partition for 64-bit MIPS Big Endian
304pub const ROOT_VERITY_SIG_MIPS64: &str = "43ce94d4-0f3d-4999-8250-b9deafd98e6e";
305
306/// Root verity signature partition for 32-bit MIPS Little Endian
307pub const ROOT_VERITY_SIG_MIPS_LE: &str = "c919cc1f-4456-4eff-918c-f75e94525ca5";
308
309/// Root verity signature partition for 64-bit MIPS Little Endian
310pub const ROOT_VERITY_SIG_MIPS64_LE: &str = "904e58ef-5c65-4a31-9c57-6af5fc7c5de7";
311
312/// Root verity signature partition for PA-RISC
313pub const ROOT_VERITY_SIG_PARISC: &str = "15de6170-65d3-431c-916e-b0dcd8393f25";
314
315/// Root verity signature partition for 32-bit PowerPC
316pub const ROOT_VERITY_SIG_PPC: &str = "1b31b5aa-add9-463a-b2ed-bd467fc857e7";
317
318/// Root verity signature partition for 64-bit PowerPC Big Endian
319pub const ROOT_VERITY_SIG_PPC64: &str = "f5e2c20c-45b2-4ffa-bce9-2a60737e1aaf";
320
321/// Root verity signature partition for 64-bit PowerPC Little Endian
322pub const ROOT_VERITY_SIG_PPC64_LE: &str = "d4a236e7-e873-4c07-bf1d-bf6cf7f1c3c6";
323
324/// Root verity signature partition for 32-bit RISC-V
325pub const ROOT_VERITY_SIG_RISCV32: &str = "3a112a75-8729-4380-b4cf-764d79934448";
326
327/// Root verity signature partition for 64-bit RISC-V
328pub const ROOT_VERITY_SIG_RISCV64: &str = "efe0f087-ea8d-4469-821a-4c2a96a8386a";
329
330/// Root verity signature partition for s390
331pub const ROOT_VERITY_SIG_S390: &str = "3482388e-4254-435a-a241-766a065f9960";
332
333/// Root verity signature partition for s390x
334pub const ROOT_VERITY_SIG_S390X: &str = "c80187a5-73a3-491a-901a-017c3fa953e9";
335
336/// Root verity signature partition for TILE-Gx
337pub const ROOT_VERITY_SIG_TILEGX: &str = "b3671439-97b0-4a53-90f7-2d5a8f3ad47b";
338
339/// Root verity signature partition for 32-bit x86
340pub const ROOT_VERITY_SIG_X86: &str = "5996fc05-109c-48de-808b-23fa0830b676";
341
342/// Root verity signature partition for 64-bit x86/AMD64
343pub const ROOT_VERITY_SIG_X86_64: &str = "41092b05-9fc8-4523-994f-2def0408b176";
344
345// ============================================================================
346// USR VERITY SIGNATURE PARTITIONS
347// ============================================================================
348
349/// /usr verity signature partition for Alpha
350pub const USR_VERITY_SIG_ALPHA: &str = "5c6e1c76-076a-457a-a0fe-f3b4cd21ce6e";
351
352/// /usr verity signature partition for ARC
353pub const USR_VERITY_SIG_ARC: &str = "94f9a9a1-9971-427a-a400-50cb297f0f35";
354
355/// /usr verity signature partition for 32-bit ARM
356pub const USR_VERITY_SIG_ARM: &str = "d7ff812f-37d1-4902-a810-d76ba57b975a";
357
358/// /usr verity signature partition for 64-bit ARM/AArch64
359pub const USR_VERITY_SIG_ARM64: &str = "c23ce4ff-44bd-4b00-b2d4-b41b3419e02a";
360
361/// /usr verity signature partition for Itanium/IA-64
362pub const USR_VERITY_SIG_IA64: &str = "8de58bc2-2a43-460d-b14e-a76e4a17b47f";
363
364/// /usr verity signature partition for 64-bit LoongArch
365pub const USR_VERITY_SIG_LOONGARCH64: &str = "b024f315-d330-444c-8461-44bbde524e99";
366
367/// /usr verity signature partition for 32-bit MIPS Big Endian
368pub const USR_VERITY_SIG_MIPS: &str = "97ae158d-f216-497b-8057-f7f905770f54";
369
370/// /usr verity signature partition for 64-bit MIPS Big Endian
371pub const USR_VERITY_SIG_MIPS64: &str = "05816ce2-dd40-4ac6-a61d-37d32dc1ba7d";
372
373/// /usr verity signature partition for 32-bit MIPS Little Endian
374pub const USR_VERITY_SIG_MIPS_LE: &str = "3e23ca0b-a4bc-4b4e-8087-5ab6a26aa8a9";
375
376/// /usr verity signature partition for 64-bit MIPS Little Endian
377pub const USR_VERITY_SIG_MIPS64_LE: &str = "f2c2c7ee-adcc-4351-b5c6-ee9816b66e16";
378
379/// /usr verity signature partition for PA-RISC
380pub const USR_VERITY_SIG_PARISC: &str = "450dd7d1-3224-45ec-9cf2-a43a346d71ee";
381
382/// /usr verity signature partition for 32-bit PowerPC
383pub const USR_VERITY_SIG_PPC: &str = "7007891d-d371-4a80-86a4-5cb875b9302e";
384
385/// /usr verity signature partition for 64-bit PowerPC Big Endian
386pub const USR_VERITY_SIG_PPC64: &str = "0b888863-d7f8-4d9e-9766-239fce4d58af";
387
388/// /usr verity signature partition for 64-bit PowerPC Little Endian
389pub const USR_VERITY_SIG_PPC64_LE: &str = "c8bfbd1e-268e-4521-8bba-bf314c399557";
390
391/// /usr verity signature partition for 32-bit RISC-V
392pub const USR_VERITY_SIG_RISCV32: &str = "c3836a13-3137-45ba-b583-b16c50fe5eb4";
393
394/// /usr verity signature partition for 64-bit RISC-V
395pub const USR_VERITY_SIG_RISCV64: &str = "d2f9000a-7a18-453f-b5cd-4d32f77a7b32";
396
397/// /usr verity signature partition for s390
398pub const USR_VERITY_SIG_S390: &str = "17440e4f-a8d0-467f-a46e-3912ae6ef2c5";
399
400/// /usr verity signature partition for s390x
401pub const USR_VERITY_SIG_S390X: &str = "3f324816-667b-46ae-86ee-9b0c0c6c11b4";
402
403/// /usr verity signature partition for TILE-Gx
404pub const USR_VERITY_SIG_TILEGX: &str = "4ede75e2-6ccc-4cc8-b9c7-70334b087510";
405
406/// /usr verity signature partition for 32-bit x86
407pub const USR_VERITY_SIG_X86: &str = "974a71c0-de41-43c3-be5d-5c5ccd1ad2c0";
408
409/// /usr verity signature partition for 64-bit x86/AMD64
410pub const USR_VERITY_SIG_X86_64: &str = "e7bb33fb-06cf-4e81-8273-e543b413e2e2";
411
412// ============================================================================
413// OTHER SPECIAL PARTITION TYPES
414// ============================================================================
415
416/// EFI System Partition (ESP) for UEFI boot
417pub const ESP: &str = "c12a7328-f81f-11d2-ba4b-00a0c93ec93b";
418
419/// Extended Boot Loader Partition
420pub const XBOOTLDR: &str = "bc13c2ff-59e6-4262-a352-b275fd6f7172";
421
422/// Swap partition
423pub const SWAP: &str = "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f";
424
425/// Home partition (/home)
426pub const HOME: &str = "933ac7e1-2eb4-4f13-b844-0e14e2aef915";
427
428/// Server data partition (/srv)
429pub const SRV: &str = "3b8f8425-20e0-4f3b-907f-1a25a76f98e8";
430
431/// Variable data partition (/var)
432pub const VAR: &str = "4d21b016-b534-45c2-a9fb-5c16e091fd2d";
433
434/// Temporary data partition (/var/tmp)
435pub const TMP: &str = "7ec6f557-3bc5-4aca-b293-16ef5df639d1";
436
437/// Generic Linux filesystem data partition
438pub const LINUX_DATA: &str = "0fc63daf-8483-4772-8e79-3d69d8477de4";
439
440// ============================================================================
441// ARCHITECTURE-SPECIFIC HELPERS
442// ============================================================================
443
444/// Returns the root partition GUID for the current architecture.
445///
446/// This is a compile-time constant function that selects the appropriate
447/// root partition type GUID based on the target architecture and endianness.
448pub const fn this_arch_root() -> &'static str {
449    cfg_if::cfg_if! {
450        if #[cfg(target_arch = "x86_64")] {
451            ROOT_X86_64
452        } else if #[cfg(target_arch = "aarch64")] {
453            ROOT_ARM64
454        } else if #[cfg(target_arch = "s390x")] {
455            ROOT_S390X
456        } else if #[cfg(all(target_arch = "powerpc64", target_endian = "big"))] {
457            ROOT_PPC64
458        } else if #[cfg(all(target_arch = "powerpc64", target_endian = "little"))] {
459            ROOT_PPC64_LE
460        } else {
461            compile_error!("Unsupported architecture")
462        }
463    }
464}
465
466#[cfg(test)]
467mod test {
468    use super::*;
469
470    #[test]
471    #[ignore = "Only run manually to validate against upstream spec"]
472    fn test_uuids_against_spec() {
473        // This test validates our partition type UUIDs against the upstream
474        // Discoverable Partitions Specification. The spec is committed to the
475        // repo at fixtures/discoverable_partitions_specification.md
476        //
477        // Spec source: https://github.com/uapi-group/specifications/blob/6f3a5dd31009456561eaa9f6fcfe7769ab97eb50/specs/discoverable_partitions_specification.md
478
479        let spec_content = include_str!("fixtures/discoverable_partitions_specification.md");
480
481        // Parse the markdown tables and extract partition name -> UUID mappings
482        let mut spec_uuids: std::collections::HashMap<&str, &str> =
483            std::collections::HashMap::new();
484
485        // Regex to match table rows with partition type UUIDs
486        // Format: | _Name_ | `uuid` ... | ... | ... |
487        let re = regex::Regex::new(
488            r"(?m)^\|\s*_(.+?)_\s*\|\s*`([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})`"
489        )
490        .unwrap();
491
492        for cap in re.captures_iter(&spec_content) {
493            let name = cap.get(1).unwrap().as_str();
494            let uuid = cap.get(2).unwrap().as_str();
495            spec_uuids.insert(name, uuid);
496        }
497
498        // Verify we parsed a reasonable number of entries
499        assert!(
500            spec_uuids.len() > 100,
501            "Expected to parse over 100 UUIDs, got {}",
502            spec_uuids.len()
503        );
504
505        // Now cross-reference our constants against the spec
506        macro_rules! check_uuid {
507            ($name:expr, $const_val:expr) => {
508                if let Some(&spec_uuid) = spec_uuids.get($name) {
509                    assert_eq!(
510                        $const_val, spec_uuid,
511                        "UUID mismatch for {}: our value '{}' != spec value '{}'",
512                        $name, $const_val, spec_uuid
513                    );
514                } else {
515                    panic!("No spec entry found for {}", $name);
516                }
517            };
518        }
519
520        // Root Partitions
521        check_uuid!("Root Partition (Alpha)", ROOT_ALPHA);
522        check_uuid!("Root Partition (ARC)", ROOT_ARC);
523        check_uuid!("Root Partition (32-bit ARM)", ROOT_ARM);
524        check_uuid!("Root Partition (64-bit ARM/AArch64)", ROOT_ARM64);
525        check_uuid!("Root Partition (Itanium/IA-64)", ROOT_IA64);
526        check_uuid!("Root Partition (LoongArch 64-bit)", ROOT_LOONGARCH64);
527        check_uuid!(
528            "Root Partition (32-bit MIPS LittleEndian (mipsel))",
529            ROOT_MIPS_LE
530        );
531        check_uuid!(
532            "Root Partition (64-bit MIPS LittleEndian (mips64el))",
533            ROOT_MIPS64_LE
534        );
535        check_uuid!("Root Partition (32-bit MIPS BigEndian (mips))", ROOT_MIPS);
536        check_uuid!(
537            "Root Partition (64-bit MIPS BigEndian (mips64))",
538            ROOT_MIPS64
539        );
540        check_uuid!("Root Partition (HPPA/PARISC)", ROOT_PARISC);
541        check_uuid!("Root Partition (32-bit PowerPC)", ROOT_PPC);
542        check_uuid!("Root Partition (64-bit PowerPC BigEndian)", ROOT_PPC64);
543        check_uuid!(
544            "Root Partition (64-bit PowerPC LittleEndian)",
545            ROOT_PPC64_LE
546        );
547        check_uuid!("Root Partition (RISC-V 32-bit)", ROOT_RISCV32);
548        check_uuid!("Root Partition (RISC-V 64-bit)", ROOT_RISCV64);
549        check_uuid!("Root Partition (s390)", ROOT_S390);
550        check_uuid!("Root Partition (s390x)", ROOT_S390X);
551        check_uuid!("Root Partition (TILE-Gx)", ROOT_TILEGX);
552        check_uuid!("Root Partition (x86)", ROOT_X86);
553        check_uuid!("Root Partition (amd64/x86_64)", ROOT_X86_64);
554
555        // USR Partitions
556        check_uuid!("`/usr/` Partition (Alpha)", USR_ALPHA);
557        check_uuid!("`/usr/` Partition (ARC)", USR_ARC);
558        check_uuid!("`/usr/` Partition (32-bit ARM)", USR_ARM);
559        check_uuid!("`/usr/` Partition (64-bit ARM/AArch64)", USR_ARM64);
560        check_uuid!("`/usr/` Partition (Itanium/IA-64)", USR_IA64);
561        check_uuid!("`/usr/` Partition (LoongArch 64-bit)", USR_LOONGARCH64);
562        check_uuid!("`/usr/` Partition (32-bit MIPS BigEndian (mips))", USR_MIPS);
563        check_uuid!(
564            "`/usr/` Partition (64-bit MIPS BigEndian (mips64))",
565            USR_MIPS64
566        );
567        check_uuid!(
568            "`/usr/` Partition (32-bit MIPS LittleEndian (mipsel))",
569            USR_MIPS_LE
570        );
571        check_uuid!(
572            "`/usr/` Partition (64-bit MIPS LittleEndian (mips64el))",
573            USR_MIPS64_LE
574        );
575        check_uuid!("`/usr/` Partition (HPPA/PARISC)", USR_PARISC);
576        check_uuid!("`/usr/` Partition (32-bit PowerPC)", USR_PPC);
577        check_uuid!("`/usr/` Partition (64-bit PowerPC BigEndian)", USR_PPC64);
578        check_uuid!(
579            "`/usr/` Partition (64-bit PowerPC LittleEndian)",
580            USR_PPC64_LE
581        );
582        check_uuid!("`/usr/` Partition (RISC-V 32-bit)", USR_RISCV32);
583        check_uuid!("`/usr/` Partition (RISC-V 64-bit)", USR_RISCV64);
584        check_uuid!("`/usr/` Partition (s390)", USR_S390);
585        check_uuid!("`/usr/` Partition (s390x)", USR_S390X);
586        check_uuid!("`/usr/` Partition (TILE-Gx)", USR_TILEGX);
587        check_uuid!("`/usr/` Partition (x86)", USR_X86);
588        check_uuid!("`/usr/` Partition (amd64/x86_64)", USR_X86_64);
589
590        // Root Verity Partitions
591        check_uuid!("Root Verity Partition (Alpha)", ROOT_VERITY_ALPHA);
592        check_uuid!("Root Verity Partition (ARC)", ROOT_VERITY_ARC);
593        check_uuid!("Root Verity Partition (32-bit ARM)", ROOT_VERITY_ARM);
594        check_uuid!(
595            "Root Verity Partition (64-bit ARM/AArch64)",
596            ROOT_VERITY_ARM64
597        );
598        check_uuid!("Root Verity Partition (Itanium/IA-64)", ROOT_VERITY_IA64);
599        check_uuid!(
600            "Root Verity Partition (LoongArch 64-bit)",
601            ROOT_VERITY_LOONGARCH64
602        );
603        check_uuid!(
604            "Root Verity Partition (32-bit MIPS BigEndian (mips))",
605            ROOT_VERITY_MIPS
606        );
607        check_uuid!(
608            "Root Verity Partition (64-bit MIPS BigEndian (mips64))",
609            ROOT_VERITY_MIPS64
610        );
611        check_uuid!(
612            "Root Verity Partition (32-bit MIPS LittleEndian (mipsel))",
613            ROOT_VERITY_MIPS_LE
614        );
615        check_uuid!(
616            "Root Verity Partition (64-bit MIPS LittleEndian (mips64el))",
617            ROOT_VERITY_MIPS64_LE
618        );
619        check_uuid!("Root Verity Partition (HPPA/PARISC)", ROOT_VERITY_PARISC);
620        check_uuid!("Root Verity Partition (32-bit PowerPC)", ROOT_VERITY_PPC);
621        check_uuid!(
622            "Root Verity Partition (64-bit PowerPC BigEndian)",
623            ROOT_VERITY_PPC64
624        );
625        check_uuid!(
626            "Root Verity Partition (64-bit PowerPC LittleEndian)",
627            ROOT_VERITY_PPC64_LE
628        );
629        check_uuid!("Root Verity Partition (RISC-V 32-bit)", ROOT_VERITY_RISCV32);
630        check_uuid!("Root Verity Partition (RISC-V 64-bit)", ROOT_VERITY_RISCV64);
631        check_uuid!("Root Verity Partition (s390)", ROOT_VERITY_S390);
632        check_uuid!("Root Verity Partition (s390x)", ROOT_VERITY_S390X);
633        check_uuid!("Root Verity Partition (TILE-Gx)", ROOT_VERITY_TILEGX);
634        check_uuid!("Root Verity Partition (x86)", ROOT_VERITY_X86);
635        check_uuid!("Root Verity Partition (amd64/x86_64)", ROOT_VERITY_X86_64);
636
637        // USR Verity Partitions
638        check_uuid!("`/usr/` Verity Partition (Alpha)", USR_VERITY_ALPHA);
639        check_uuid!("`/usr/` Verity Partition (ARC)", USR_VERITY_ARC);
640        check_uuid!("`/usr/` Verity Partition (32-bit ARM)", USR_VERITY_ARM);
641        check_uuid!(
642            "`/usr/` Verity Partition (64-bit ARM/AArch64)",
643            USR_VERITY_ARM64
644        );
645        check_uuid!("`/usr/` Verity Partition (Itanium/IA-64)", USR_VERITY_IA64);
646        check_uuid!(
647            "`/usr/` Verity Partition (LoongArch 64-bit)",
648            USR_VERITY_LOONGARCH64
649        );
650        check_uuid!(
651            "`/usr/` Verity Partition (32-bit MIPS BigEndian (mips))",
652            USR_VERITY_MIPS
653        );
654        check_uuid!(
655            "`/usr/` Verity Partition (64-bit MIPS BigEndian (mips64))",
656            USR_VERITY_MIPS64
657        );
658        check_uuid!(
659            "`/usr/` Verity Partition (32-bit MIPS LittleEndian (mipsel))",
660            USR_VERITY_MIPS_LE
661        );
662        check_uuid!(
663            "`/usr/` Verity Partition (64-bit MIPS LittleEndian (mips64el))",
664            USR_VERITY_MIPS64_LE
665        );
666        check_uuid!("`/usr/` Verity Partition (HPPA/PARISC)", USR_VERITY_PARISC);
667        check_uuid!("`/usr/` Verity Partition (32-bit PowerPC)", USR_VERITY_PPC);
668        check_uuid!(
669            "`/usr/` Verity Partition (64-bit PowerPC BigEndian)",
670            USR_VERITY_PPC64
671        );
672        check_uuid!(
673            "`/usr/` Verity Partition (64-bit PowerPC LittleEndian)",
674            USR_VERITY_PPC64_LE
675        );
676        check_uuid!(
677            "`/usr/` Verity Partition (RISC-V 32-bit)",
678            USR_VERITY_RISCV32
679        );
680        check_uuid!(
681            "`/usr/` Verity Partition (RISC-V 64-bit)",
682            USR_VERITY_RISCV64
683        );
684        check_uuid!("`/usr/` Verity Partition (s390)", USR_VERITY_S390);
685        check_uuid!("`/usr/` Verity Partition (s390x)", USR_VERITY_S390X);
686        check_uuid!("`/usr/` Verity Partition (TILE-Gx)", USR_VERITY_TILEGX);
687        check_uuid!("`/usr/` Verity Partition (x86)", USR_VERITY_X86);
688        check_uuid!("`/usr/` Verity Partition (amd64/x86_64)", USR_VERITY_X86_64);
689
690        // Root Verity Signature Partitions
691        check_uuid!(
692            "Root Verity Signature Partition (Alpha)",
693            ROOT_VERITY_SIG_ALPHA
694        );
695        check_uuid!("Root Verity Signature Partition (ARC)", ROOT_VERITY_SIG_ARC);
696        check_uuid!(
697            "Root Verity Signature Partition (32-bit ARM)",
698            ROOT_VERITY_SIG_ARM
699        );
700        check_uuid!(
701            "Root Verity Signature Partition (64-bit ARM/AArch64)",
702            ROOT_VERITY_SIG_ARM64
703        );
704        check_uuid!(
705            "Root Verity Signature Partition (Itanium/IA-64)",
706            ROOT_VERITY_SIG_IA64
707        );
708        check_uuid!(
709            "Root Verity Signature Partition (LoongArch 64-bit)",
710            ROOT_VERITY_SIG_LOONGARCH64
711        );
712        check_uuid!(
713            "Root Verity Signature Partition (32-bit MIPS BigEndian (mips))",
714            ROOT_VERITY_SIG_MIPS
715        );
716        check_uuid!(
717            "Root Verity Signature Partition (64-bit MIPS BigEndian (mips64))",
718            ROOT_VERITY_SIG_MIPS64
719        );
720        check_uuid!(
721            "Root Verity Signature Partition (32-bit MIPS LittleEndian (mipsel))",
722            ROOT_VERITY_SIG_MIPS_LE
723        );
724        check_uuid!(
725            "Root Verity Signature Partition (64-bit MIPS LittleEndian (mips64el))",
726            ROOT_VERITY_SIG_MIPS64_LE
727        );
728        check_uuid!(
729            "Root Verity Signature Partition (HPPA/PARISC)",
730            ROOT_VERITY_SIG_PARISC
731        );
732        check_uuid!(
733            "Root Verity Signature Partition (32-bit PowerPC)",
734            ROOT_VERITY_SIG_PPC
735        );
736        check_uuid!(
737            "Root Verity Signature Partition (64-bit PowerPC BigEndian)",
738            ROOT_VERITY_SIG_PPC64
739        );
740        check_uuid!(
741            "Root Verity Signature Partition (64-bit PowerPC LittleEndian)",
742            ROOT_VERITY_SIG_PPC64_LE
743        );
744        check_uuid!(
745            "Root Verity Signature Partition (RISC-V 32-bit)",
746            ROOT_VERITY_SIG_RISCV32
747        );
748        check_uuid!(
749            "Root Verity Signature Partition (RISC-V 64-bit)",
750            ROOT_VERITY_SIG_RISCV64
751        );
752        check_uuid!(
753            "Root Verity Signature Partition (s390)",
754            ROOT_VERITY_SIG_S390
755        );
756        check_uuid!(
757            "Root Verity Signature Partition (s390x)",
758            ROOT_VERITY_SIG_S390X
759        );
760        check_uuid!(
761            "Root Verity Signature Partition (TILE-Gx)",
762            ROOT_VERITY_SIG_TILEGX
763        );
764        check_uuid!("Root Verity Signature Partition (x86)", ROOT_VERITY_SIG_X86);
765        check_uuid!(
766            "Root Verity Signature Partition (amd64/x86_64)",
767            ROOT_VERITY_SIG_X86_64
768        );
769
770        // USR Verity Signature Partitions
771        check_uuid!(
772            "`/usr/` Verity Signature Partition (Alpha)",
773            USR_VERITY_SIG_ALPHA
774        );
775        check_uuid!(
776            "`/usr/` Verity Signature Partition (ARC)",
777            USR_VERITY_SIG_ARC
778        );
779        check_uuid!(
780            "`/usr/` Verity Signature Partition (32-bit ARM)",
781            USR_VERITY_SIG_ARM
782        );
783        check_uuid!(
784            "`/usr/` Verity Signature Partition (64-bit ARM/AArch64)",
785            USR_VERITY_SIG_ARM64
786        );
787        check_uuid!(
788            "`/usr/` Verity Signature Partition (Itanium/IA-64)",
789            USR_VERITY_SIG_IA64
790        );
791        check_uuid!(
792            "`/usr/` Verity Signature Partition (LoongArch 64-bit)",
793            USR_VERITY_SIG_LOONGARCH64
794        );
795        check_uuid!(
796            "`/usr/` Verity Signature Partition (32-bit MIPS BigEndian (mips))",
797            USR_VERITY_SIG_MIPS
798        );
799        check_uuid!(
800            "`/usr/` Verity Signature Partition (64-bit MIPS BigEndian (mips64))",
801            USR_VERITY_SIG_MIPS64
802        );
803        check_uuid!(
804            "`/usr/` Verity Signature Partition (32-bit MIPS LittleEndian (mipsel))",
805            USR_VERITY_SIG_MIPS_LE
806        );
807        check_uuid!(
808            "`/usr/` Verity Signature Partition (64-bit MIPS LittleEndian (mips64el))",
809            USR_VERITY_SIG_MIPS64_LE
810        );
811        check_uuid!(
812            "`/usr/` Verity Signature Partition (HPPA/PARISC)",
813            USR_VERITY_SIG_PARISC
814        );
815        check_uuid!(
816            "`/usr/` Verity Signature Partition (32-bit PowerPC)",
817            USR_VERITY_SIG_PPC
818        );
819        check_uuid!(
820            "`/usr/` Verity Signature Partition (64-bit PowerPC BigEndian)",
821            USR_VERITY_SIG_PPC64
822        );
823        check_uuid!(
824            "`/usr/` Verity Signature Partition (64-bit PowerPC LittleEndian)",
825            USR_VERITY_SIG_PPC64_LE
826        );
827        check_uuid!(
828            "`/usr/` Verity Signature Partition (RISC-V 32-bit)",
829            USR_VERITY_SIG_RISCV32
830        );
831        check_uuid!(
832            "`/usr/` Verity Signature Partition (RISC-V 64-bit)",
833            USR_VERITY_SIG_RISCV64
834        );
835        check_uuid!(
836            "`/usr/` Verity Signature Partition (s390)",
837            USR_VERITY_SIG_S390
838        );
839        check_uuid!(
840            "`/usr/` Verity Signature Partition (s390x)",
841            USR_VERITY_SIG_S390X
842        );
843        check_uuid!(
844            "`/usr/` Verity Signature Partition (TILE-Gx)",
845            USR_VERITY_SIG_TILEGX
846        );
847        check_uuid!(
848            "`/usr/` Verity Signature Partition (x86)",
849            USR_VERITY_SIG_X86
850        );
851        check_uuid!(
852            "`/usr/` Verity Signature Partition (amd64/x86_64)",
853            USR_VERITY_SIG_X86_64
854        );
855
856        // Other special partition types
857        check_uuid!("EFI System Partition", ESP);
858        check_uuid!("Extended Boot Loader Partition", XBOOTLDR);
859        check_uuid!("Swap", SWAP);
860        check_uuid!("Home Partition", HOME);
861        check_uuid!("Server Data Partition", SRV);
862        check_uuid!("Variable Data Partition", VAR);
863        check_uuid!("Temporary Data Partition", TMP);
864        check_uuid!("Generic Linux Data Partition", LINUX_DATA);
865    }
866}