mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-07 14:24:43 +00:00
This is a breaking change. This commit applies the following rules to std.os.uefi: * avoid redundant names in the namespace such as "protocol.FooProtocol" * don't initialize struct field to undefined. do that at the initialization site if you want that, or create a named constant that sets all the fields to undefined. * avoid the word "data", "info", "context", "state", "details", or "config" in the type name, especially if a word from that category is already in the type name. * embrace tree structure After following these rules, `usingnamespace` disappeared naturally. This commit eliminates 26/53 (49%) instances of `usingnamespace` in the standard library. All these uses were due to not understanding how to properly use namespaces. I did not test this commit. The standard library UEFI code is experimental and pull requests have been accepted with minimal vetting. Users of std.os.uefi will need to submit follow-up pull requests to fix up whatever regressions this commit introduces, this time without abusing namespaces (pun intended).
48 lines
1.7 KiB
Zig
48 lines
1.7 KiB
Zig
const std = @import("std");
|
|
const uefi = std.os.uefi;
|
|
const Guid = uefi.Guid;
|
|
const Event = uefi.Event;
|
|
const Status = uefi.Status;
|
|
const cc = uefi.cc;
|
|
|
|
pub const Ip6Config = extern struct {
|
|
_set_data: *const fn (*const Ip6Config, DataType, usize, *const anyopaque) callconv(cc) Status,
|
|
_get_data: *const fn (*const Ip6Config, DataType, *usize, ?*const anyopaque) callconv(cc) Status,
|
|
_register_data_notify: *const fn (*const Ip6Config, DataType, Event) callconv(cc) Status,
|
|
_unregister_data_notify: *const fn (*const Ip6Config, DataType, Event) callconv(cc) Status,
|
|
|
|
pub fn setData(self: *const Ip6Config, data_type: DataType, data_size: usize, data: *const anyopaque) Status {
|
|
return self._set_data(self, data_type, data_size, data);
|
|
}
|
|
|
|
pub fn getData(self: *const Ip6Config, data_type: DataType, data_size: *usize, data: ?*const anyopaque) Status {
|
|
return self._get_data(self, data_type, data_size, data);
|
|
}
|
|
|
|
pub fn registerDataNotify(self: *const Ip6Config, data_type: DataType, event: Event) Status {
|
|
return self._register_data_notify(self, data_type, event);
|
|
}
|
|
|
|
pub fn unregisterDataNotify(self: *const Ip6Config, data_type: DataType, event: Event) Status {
|
|
return self._unregister_data_notify(self, data_type, event);
|
|
}
|
|
|
|
pub const guid align(8) = Guid{
|
|
.time_low = 0x937fe521,
|
|
.time_mid = 0x95ae,
|
|
.time_high_and_version = 0x4d1a,
|
|
.clock_seq_high_and_reserved = 0x89,
|
|
.clock_seq_low = 0x29,
|
|
.node = [_]u8{ 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a },
|
|
};
|
|
|
|
pub const DataType = enum(u32) {
|
|
InterfaceInfo,
|
|
AltInterfaceId,
|
|
Policy,
|
|
DupAddrDetectTransmits,
|
|
ManualAddress,
|
|
Gateway,
|
|
DnsServer,
|
|
};
|
|
};
|