diff options
Diffstat (limited to 'src/kernel/fs/marfs/disklevel.c')
-rw-r--r-- | src/kernel/fs/marfs/disklevel.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/kernel/fs/marfs/disklevel.c b/src/kernel/fs/marfs/disklevel.c index 106540e..f814f80 100644 --- a/src/kernel/fs/marfs/disklevel.c +++ b/src/kernel/fs/marfs/disklevel.c @@ -4,21 +4,23 @@ void marfs_format(void) { - // Create superblock - struct marfs_superblock sb; - sb.signature = 0x1083B99F34B59645; // Huh, magic?! - sb.n_inodes = (marfs_get_max_lba() - 2) >> 5; - sb.n_chunks = (marfs_get_max_lba() - (2 + sb.n_inodes)) >> 9; - sb.n_first_unallocated_inode = 0; - sb.s_first_inode = 2; - sb.s_first_chunk = 2 + sb.n_inodes; + // Create superblock + struct marfs_superblock sb; + sb.signature = 0x1083B99F34B59645; // Huh, magic?! + sb.n_inodes = (marfs_get_max_lba() - 2) >> 5; + sb.n_chunks = (marfs_get_max_lba() - (2 + sb.n_inodes)) >> 9; + sb.n_first_unallocated_inode = 0; + sb.s_first_inode = 2; + sb.s_first_chunk = 2 + sb.n_inodes; - // Write to disk - marfs_write_superblock(&sb); + // Write to disk + marfs_write_superblock(&sb); - // Initialize the inodes - for (uint32_t i = 0; i < sb.n_inodes; i++) ata_clear28(interface, 2 + i); + // Initialize the inodes + for (uint32_t i = 0; i < sb.n_inodes; i++) + ata_clear28(interface, 2 + i); - // Initialize the chunks - for (uint32_t i = 0; i < sb.n_chunks; i++) ata_clear28(interface, sb.s_first_chunk + i * 512); + // Initialize the chunks + for (uint32_t i = 0; i < sb.n_chunks; i++) + ata_clear28(interface, sb.s_first_chunk + i * 512); } |