diff options
| author | Bobby <[email protected]> | 2026-07-12 05:17:19 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-07-12 05:17:19 +0530 |
| commit | cfcee2cbb3f6daeb20ee62fcc411c99ca02f7dec (patch) | |
| tree | bb4580d0c719ed6e3659f38e552c23cd9ac692cb /shared/fs/afs/write | |
| parent | 174951500db9ee02ad537cf163d83f9b8dcd9b82 (diff) | |
| download | akiba-cfcee2cbb3f6daeb20ee62fcc411c99ca02f7dec.tar.xz akiba-cfcee2cbb3f6daeb20ee62fcc411c99ca02f7dec.zip | |
Sweep: extract crimson/render strings, move pure-constant files into constants/ subfolders, strip explanatory comments and multi-line headers tree-wide, zig fmt
Diffstat (limited to 'shared/fs/afs/write')
| -rw-r--r-- | shared/fs/afs/write/allocate.zig | 8 | ||||
| -rw-r--r-- | shared/fs/afs/write/stack.zig | 4 | ||||
| -rw-r--r-- | shared/fs/afs/write/unit.zig | 5 | ||||
| -rw-r--r-- | shared/fs/afs/write/write.zig | 3 |
4 files changed, 0 insertions, 20 deletions
diff --git a/shared/fs/afs/write/allocate.zig b/shared/fs/afs/write/allocate.zig index 2377f4f..9573a88 100644 --- a/shared/fs/afs/write/allocate.zig +++ b/shared/fs/afs/write/allocate.zig @@ -5,7 +5,6 @@ pub const AllocationError = error{ InvalidCell, }; -/// Allocation bitmap operations pub const AllocationMap = struct { bitmap: []u8, total_cells: u32, @@ -19,7 +18,6 @@ pub const AllocationMap = struct { }; } - /// Mark a cell as allocated pub fn mark_allocated(self: *AllocationMap, cell: u32) void { if (cell >= self.total_cells) return; const byte_index = cell / 8; @@ -27,7 +25,6 @@ pub const AllocationMap = struct { self.bitmap[byte_index] |= @as(u8, 1) << bit_index; } - /// Mark a cell as free pub fn mark_free(self: *AllocationMap, cell: u32) void { if (cell >= self.total_cells) return; const byte_index = cell / 8; @@ -35,7 +32,6 @@ pub const AllocationMap = struct { self.bitmap[byte_index] &= ~(@as(u8, 1) << bit_index); } - /// Check if a cell is allocated pub fn is_allocated(self: *const AllocationMap, cell: u32) bool { if (cell >= self.total_cells) return true; const byte_index = cell / 8; @@ -43,7 +39,6 @@ pub const AllocationMap = struct { return (self.bitmap[byte_index] & (@as(u8, 1) << bit_index)) != 0; } - /// Allocate a contiguous range of cells pub fn allocate_cells(self: *AllocationMap, count: u32) AllocationError!u32 { if (count == 0) return self.next_free; @@ -61,7 +56,6 @@ pub const AllocationMap = struct { return start; } - /// Mark a range of cells as allocated (for reserved areas) pub fn reserve_range(self: *AllocationMap, start: u32, count: u32) void { var i: u32 = 0; while (i < count) : (i += 1) { @@ -69,7 +63,6 @@ pub const AllocationMap = struct { } } - /// Get count of free cells pub fn free_count(self: *const AllocationMap) u32 { var count: u32 = 0; var i: u32 = 0; @@ -82,7 +75,6 @@ pub const AllocationMap = struct { } }; -/// Calculate bitmap size needed for a given number of cells pub fn bitmap_size(total_cells: u32) u32 { return (total_cells + 7) / 8; } diff --git a/shared/fs/afs/write/stack.zig b/shared/fs/afs/write/stack.zig index 69afd53..0507bae 100644 --- a/shared/fs/afs/write/stack.zig +++ b/shared/fs/afs/write/stack.zig @@ -10,7 +10,6 @@ const IndexKey = types.IndexKey; const Permissions = types.Permissions; const ChannelInfo = types.ChannelInfo; -/// Create a stack record pub fn create_stack_record( node_id: u32, timestamp: u64, @@ -40,7 +39,6 @@ pub fn create_stack_record( }; } -/// Create a unit record pub fn create_unit_record( node_id: u32, timestamp: u64, @@ -73,7 +71,6 @@ pub fn create_unit_record( }; } -/// Create an index key for a catalog entry pub fn create_index_key( parent_node_id: u32, identity: []const u8, @@ -91,7 +88,6 @@ pub fn create_index_key( return key; } -/// Get the size of an index key in bytes pub fn index_key_size(identity_len: usize) usize { return 8 + identity_len * 2; } diff --git a/shared/fs/afs/write/unit.zig b/shared/fs/afs/write/unit.zig index a20da4e..0162219 100644 --- a/shared/fs/afs/write/unit.zig +++ b/shared/fs/afs/write/unit.zig @@ -15,7 +15,6 @@ pub const WriteError = error{ InvalidCell, }; -/// Write data to a span pub fn write_span( writer: *const BlockWriter, span: *const SpanDescriptor, @@ -29,7 +28,6 @@ pub fn write_span( var current_cell = span.start_cell; while (bytes_written < bytes_to_write) { - // Clear cell buffer for (cell_buffer) |*b| { b.* = 0; } @@ -37,7 +35,6 @@ pub fn write_span( const bytes_remaining = bytes_to_write - bytes_written; const bytes_to_copy = if (bytes_remaining < writer.cell_size) bytes_remaining else writer.cell_size; - // Copy data to cell buffer var i: u64 = 0; while (i < bytes_to_copy) : (i += 1) { cell_buffer[@intCast(i)] = data[@intCast(bytes_written + i)]; @@ -54,13 +51,11 @@ pub fn write_span( return bytes_written; } -/// Calculate number of cells needed for a given size pub fn cells_needed(size: u64, cell_size: u32) u32 { if (size == 0) return 0; return @intCast((size + cell_size - 1) / cell_size); } -/// Create a channel info for inline data pub fn create_channel_info( logical_size: u64, start_cell: u64, diff --git a/shared/fs/afs/write/write.zig b/shared/fs/afs/write/write.zig index b33ed3b..c4c1727 100644 --- a/shared/fs/afs/write/write.zig +++ b/shared/fs/afs/write/write.zig @@ -4,18 +4,15 @@ pub const unit = @import("unit.zig"); pub const allocate = @import("allocate.zig"); pub const stack = @import("stack.zig"); -// Unit operations pub const write_span = unit.write_span; pub const cells_needed = unit.cells_needed; pub const create_channel_info = unit.create_channel_info; pub const WriteError = unit.WriteError; -// Allocation operations pub const AllocationMap = allocate.AllocationMap; pub const AllocationError = allocate.AllocationError; pub const bitmap_size = allocate.bitmap_size; -// Stack operations pub const create_stack_record = stack.create_stack_record; pub const create_unit_record = stack.create_unit_record; pub const create_index_key = stack.create_index_key; |
