style: rename kind to type

This commit is contained in:
Loïc Grégoire
2026-03-29 17:43:20 -04:00
parent 503c47ed8e
commit 3a98bd0674
3 changed files with 10 additions and 10 deletions
+7 -7
View File
@@ -9,7 +9,7 @@ const ke = b.ke;
/// Header for waitable objects. /// Header for waitable objects.
/// This must be added to any structured which is considered waitable. /// This must be added to any structured which is considered waitable.
pub const DispatchHeader = struct { pub const DispatchHeader = struct {
pub const Kind = enum { pub const Type = enum {
/// When signaled, `signaled` is kept high and all waiters are woken up. /// When signaled, `signaled` is kept high and all waiters are woken up.
Notification, Notification,
/// When signaled, `signaled` is decreased until 0, and a single waiter is woken up. /// When signaled, `signaled` is decreased until 0, and a single waiter is woken up.
@@ -18,23 +18,23 @@ pub const DispatchHeader = struct {
/// List of WaitBlocks. /// List of WaitBlocks.
waitblocks: rtl.List, waitblocks: rtl.List,
/// Kind of object. /// Type of object.
kind: Kind, type: Type,
/// Lock protecting the object. /// Lock protecting the object.
lock: ke.SpinLock, lock: ke.SpinLock,
/// Signaled count. /// Signaled count.
signaled: u32, signaled: u32,
/// Initialize a waitable object. /// Initialize a waitable object.
pub fn init(obj: *DispatchHeader, kind: Kind) void { pub fn init(obj: *DispatchHeader, kind: Type) void {
obj.kind = kind; obj.type = kind;
obj.lock = ke.SpinLock.init(); obj.lock = ke.SpinLock.init();
obj.signaled = 0; obj.signaled = 0;
obj.waitblocks.init(); obj.waitblocks.init();
} }
fn consume(self: *DispatchHeader) void { fn consume(self: *DispatchHeader) void {
switch (self.kind) { switch (self.type) {
.Synchronization => self.signaled -= 1, .Synchronization => self.signaled -= 1,
.Notification => { .Notification => {
// Object remains signaled. // Object remains signaled.
@@ -192,7 +192,7 @@ pub fn wait_any(objects: []*DispatchHeader, timeout: ?b.Nanoseconds, waitblocks:
/// Satisfy a wait on an object. /// Satisfy a wait on an object.
pub fn satisfy_wait(obj: *DispatchHeader) void { pub fn satisfy_wait(obj: *DispatchHeader) void {
const all = obj.kind == .Notification; const all = obj.type == .Notification;
// Go through (potentially) all wait blocks and try to satisfy them. // Go through (potentially) all wait blocks and try to satisfy them.
while (!obj.waitblocks.is_empty() and obj.signaled > 0) { while (!obj.waitblocks.is_empty() and obj.signaled > 0) {
+2 -2
View File
@@ -41,7 +41,7 @@ pub const BootInfo = struct {
pub const MemMap = struct { pub const MemMap = struct {
/// A memory map entry. /// A memory map entry.
pub const Entry = struct { pub const Entry = struct {
pub const Kind = enum { pub const Type = enum {
Free, Free,
Reserved, Reserved,
LoaderReclaimable, LoaderReclaimable,
@@ -50,7 +50,7 @@ pub const BootInfo = struct {
Kernel, Kernel,
}; };
kind: Kind, type: Type,
base: usize, base: usize,
size: usize, size: usize,
}; };
+1 -1
View File
@@ -81,7 +81,7 @@ pub fn early_init() linksection(b.init) void {
global_state.boot_info.memory_map.entry_count = 1; global_state.boot_info.memory_map.entry_count = 1;
global_state.boot_info.memory_map.entries[0].base = phys_base; global_state.boot_info.memory_map.entries[0].base = phys_base;
global_state.boot_info.memory_map.entries[0].size = global_state.params.mem_size; global_state.boot_info.memory_map.entries[0].size = global_state.params.mem_size;
global_state.boot_info.memory_map.entries[0].kind = .Free; global_state.boot_info.memory_map.entries[0].type = .Free;
global_state.phys_memory_memfd = memfd; global_state.phys_memory_memfd = memfd;
global_state.phys_base = phys_base; global_state.phys_base = phys_base;