File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,7 +132,10 @@ const ContentWriter = struct {
132132 for (data .partitions ) | mpart | {
133133 if (mpart ) | part | {
134134 try cw .code .writeAll (" part\n " );
135- try cw .code .print (" type {s}\n " , .{@tagName (part .type )});
135+ switch (part .type ) {
136+ .named = > | id | try cw .code .print (" type {s}\n " , .{@tagName (id )}),
137+ .custom = > | id | try cw .code .print (" type 0x{X:0>2}\n " , .{id }),
138+ }
136139 if (part .bootable ) {
137140 try cw .code .writeAll (" bootable\n " );
138141 }
@@ -337,17 +340,29 @@ pub const MbrPartTable = struct {
337340 bootloader : ? * const Content = null ,
338341 partitions : [4 ]? * const Partition ,
339342
343+ pub const PartType = enum (u8 ) {
344+ empty ,
345+ fat12 ,
346+ ntfs ,
347+ @"fat32-chs" ,
348+ @"fat32-lba" ,
349+ @"fat16-lba" ,
350+ @"linux-swa" ,
351+ @"linux-fs" ,
352+ @"linux-lvm" ,
353+ };
354+
340355 pub const Partition = struct {
341- type : enum {
342- empty ,
343- fat12 ,
344- ntfs ,
345- @ "fat32-chs" ,
346- @ "fat32-lba" ,
347- @ "fat16-lba" ,
348- @ "linux-swa" ,
349- @ "linux-fs" ,
350- @ "linux-lvm" ,
356+ type : union ( enum ) {
357+ named : PartType ,
358+ custom : u8 ,
359+
360+ pub fn predefined ( value : PartType ) @This () {
361+ return .{ . named = value };
362+ }
363+ pub fn id ( value : u8 ) @This () {
364+ return .{ . custom = value };
365+ }
351366 },
352367 bootable : bool = false ,
353368 size : ? u64 = null ,
You can’t perform that action at this time.
0 commit comments