From 4440391d81cfbc3d5231495fde2416a71f644da4 Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Sun, 18 Sep 2022 20:21:59 +0200 Subject: [PATCH 1/3] fix: wrap function pointers in std.meta.FnPtr --- lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig | 4 ++-- lib/std/os/uefi/tables/boot_services.zig | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig b/lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig index 59d6e1a8d2..d6a6941657 100644 --- a/lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig +++ b/lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig @@ -10,7 +10,7 @@ pub const SimpleTextInputExProtocol = extern struct { _read_key_stroke_ex: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status), wait_for_key_ex: Event, _set_state: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status), - _register_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const KeyData, fn (*const KeyData) callconv(.C) usize, **anyopaque) callconv(.C) Status), + _register_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const KeyData, std.meta.FnPtr(fn (*const KeyData) callconv(.C) usize), **anyopaque) callconv(.C) Status), _unregister_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status), /// Resets the input device hardware. @@ -29,7 +29,7 @@ pub const SimpleTextInputExProtocol = extern struct { } /// Register a notification function for a particular keystroke for the input device. - pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: fn (*const KeyData) callconv(.C) usize, handle: **anyopaque) Status { + pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: std.meta.FnPtr(fn (*const KeyData) callconv(.C) usize), handle: **anyopaque) Status { return self._register_key_notify(self, key_data, notify, handle); } diff --git a/lib/std/os/uefi/tables/boot_services.zig b/lib/std/os/uefi/tables/boot_services.zig index 068cd1272c..810477453d 100644 --- a/lib/std/os/uefi/tables/boot_services.zig +++ b/lib/std/os/uefi/tables/boot_services.zig @@ -191,7 +191,7 @@ pub const BootServices = extern struct { pub const tpl_high_level: usize = 31; }; -pub const EfiEventNotify = fn (event: Event, ctx: *anyopaque) callconv(.C) void; +pub const EfiEventNotify = std.meta.FnPtr(fn (event: Event, ctx: *anyopaque) callconv(.C) void); pub const TimerDelay = enum(u32) { TimerCancel, From a56a51e48fc9c9f4f35e396864043d2c81af2dc0 Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Sun, 18 Sep 2022 20:25:07 +0200 Subject: [PATCH 2/3] fix: wrong return type for _poll See page 1055 of . --- lib/std/os/uefi/protocols/managed_network_protocol.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/os/uefi/protocols/managed_network_protocol.zig b/lib/std/os/uefi/protocols/managed_network_protocol.zig index 1c9aa6cb8a..873ca7f335 100644 --- a/lib/std/os/uefi/protocols/managed_network_protocol.zig +++ b/lib/std/os/uefi/protocols/managed_network_protocol.zig @@ -15,7 +15,7 @@ pub const ManagedNetworkProtocol = extern struct { _transmit: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status), _receive: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status), _cancel: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status), - _poll: std.meta.FnPtr(fn (*const ManagedNetworkProtocol) callconv(.C) usize), + _poll: std.meta.FnPtr(fn (*const ManagedNetworkProtocol) callconv(.C) Status), /// Returns the operational parameters for the current MNP child driver. /// May also support returning the underlying SNP driver mode data. From 47e72132e2861146491a3dc98035b297713ac492 Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Sun, 18 Sep 2022 20:29:11 +0200 Subject: [PATCH 3/3] fix: wrong amount of arguments passed to function I don't know why that one argument was discarded. Is there a reason? It failed to compile. --- lib/std/os/uefi/protocols/managed_network_protocol.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/std/os/uefi/protocols/managed_network_protocol.zig b/lib/std/os/uefi/protocols/managed_network_protocol.zig index 873ca7f335..3f35f03b50 100644 --- a/lib/std/os/uefi/protocols/managed_network_protocol.zig +++ b/lib/std/os/uefi/protocols/managed_network_protocol.zig @@ -31,8 +31,7 @@ pub const ManagedNetworkProtocol = extern struct { /// Translates an IP multicast address to a hardware (MAC) multicast address. /// This function may be unsupported in some MNP implementations. pub fn mcastIpToMac(self: *const ManagedNetworkProtocol, ipv6flag: bool, ipaddress: *const anyopaque, mac_address: *MacAddress) Status { - _ = mac_address; - return self._mcast_ip_to_mac(self, ipv6flag, ipaddress); + return self._mcast_ip_to_mac(self, ipv6flag, ipaddress, mac_address); } /// Enables and disables receive filters for multicast address.