MCPcopy Create free account
hub / github.com/Bananymous/banan-os / initialize

Method initialize

kernel/kernel/FS/FAT/FileSystem.cpp:103–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101 return fatfs;
102 }
103
104 BAN::ErrorOr<void> FATFS::initialize()
105 {
106 if (m_bpb.bytes_per_sector != m_block_device->blksize())
107 {
108 dwarnln("FileSystem sector size does not match with block device");
109 return BAN::Error::from_errno(ENOTSUP);
110 }
111
112 TRY(m_fat_two_sector_buffer.resize(m_bpb.bytes_per_sector * 2));
113 TRY(m_block_device->read_blocks(first_fat_sector(), 2, BAN::ByteSpan(m_fat_two_sector_buffer.span())));
114 m_fat_sector_buffer_current = 0;
115
116 FAT::DirectoryEntry root_entry {};
117 root_entry.attr = FAT::FileAttr::DIRECTORY;
118 m_root_inode = TRY(open_inode(nullptr, root_entry, 0, 0));
119
120 return {};
121 }
122
123 BAN::ErrorOr<BAN::RefPtr<FATInode>> FATFS::open_inode(BAN::RefPtr<FATInode> parent, const FAT::DirectoryEntry& entry, uint32_t cluster_index, uint32_t entry_index)

Callers 1

createMethod · 0.45

Calls 4

blksizeMethod · 0.45
resizeMethod · 0.45
read_blocksMethod · 0.45
spanMethod · 0.45

Tested by

no test coverage detected