| ... | @@ -3,6 +3,8 @@ | ... | @@ -3,6 +3,8 @@ |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. |
| 4 | // The MIT license requires this copyright notice to be included in all copies | 4 | // The MIT license requires this copyright notice to be included in all copies |
| 5 | // and substantial portions of the software. | 5 | // and substantial portions of the software. |
| | 6 | const std = @import("../std.zig"); |
| | 7 | |
| 6 | /// A protocol is an interface identified by a GUID. | 8 | /// A protocol is an interface identified by a GUID. |
| 7 | pub const protocols = @import("uefi/protocols.zig"); | 9 | pub const protocols = @import("uefi/protocols.zig"); |
| 8 | | 10 | |
| ... | @@ -33,10 +35,10 @@ pub const Guid = extern struct { | ... | @@ -33,10 +35,10 @@ pub const Guid = extern struct { |
| 33 | self: @This(), | 35 | self: @This(), |
| 34 | comptime f: []const u8, | 36 | comptime f: []const u8, |
| 35 | options: std.fmt.FormatOptions, | 37 | options: std.fmt.FormatOptions, |
| 36 | out_stream: anytype, | 38 | writer: anytype, |
| 37 | ) Errors!void { | 39 | ) !void { |
| 38 | if (f.len == 0) { | 40 | if (f.len == 0) { |
| 39 | return std.fmt.format(out_stream, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{ | 41 | return std.fmt.format(writer, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{ |
| 40 | self.time_low, | 42 | self.time_low, |
| 41 | self.time_mid, | 43 | self.time_mid, |
| 42 | self.time_high_and_version, | 44 | self.time_high_and_version, |
| ... | @@ -48,6 +50,15 @@ pub const Guid = extern struct { | ... | @@ -48,6 +50,15 @@ pub const Guid = extern struct { |
| 48 | @compileError("Unknown format character: '" ++ f ++ "'"); | 50 | @compileError("Unknown format character: '" ++ f ++ "'"); |
| 49 | } | 51 | } |
| 50 | } | 52 | } |
| | 53 | |
| | 54 | pub fn eql(a: std.os.uefi.Guid, b: std.os.uefi.Guid) bool { |
| | 55 | return a.time_low == b.time_low and |
| | 56 | a.time_mid == b.time_mid and |
| | 57 | a.time_high_and_version == b.time_high_and_version and |
| | 58 | a.clock_seq_high_and_reserved == b.clock_seq_high_and_reserved and |
| | 59 | a.clock_seq_low == b.clock_seq_low and |
| | 60 | std.mem.eql(u8, &a.node, &b.node); |
| | 61 | } |
| 51 | }; | 62 | }; |
| 52 | | 63 | |
| 53 | /// An EFI Handle represents a collection of related interfaces. | 64 | /// An EFI Handle represents a collection of related interfaces. |