aboutsummaryrefslogtreecommitdiff
path: root/mirai.old/fs/afs/info.zig
blob: 8d9889e1223c60381bbe1cc33999a1ec06492dbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! AFS disk info operations

const fs = @import("../../common/constants/fs.zig");
const types = @import("types.zig");

pub fn get_disk_info(afs: anytype) types.DiskInfo {
    const cluster_size: u64 = @as(u64, afs.sectors_per_cluster) * fs.SECTOR_SIZE;
    const total = @as(u64, afs.total_clusters) * cluster_size;
    const used = @as(u64, afs.used_clusters) * cluster_size;

    return types.DiskInfo{
        .total_bytes = total,
        .used_bytes = used,
    };
}