MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / WriteBlockGroupDescriptor

Method WriteBlockGroupDescriptor

Kernel/src/fs/ext2.cpp:134–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132 }
133
134 void Ext2Volume::WriteBlockGroupDescriptor(uint32_t index){
135 uint32_t firstBlockGroup = LocationToBlock(EXT2_SUPERBLOCK_LOCATION) + 1;
136 uint32_t block = firstBlockGroup + LocationToBlock(index * sizeof(ext2_blockgrp_desc_t));
137 uint8_t buffer[blocksize];
138
139 if(ReadBlockCached(block, buffer)){
140 Log::Info("[Ext2] WriteBlock: Error reading block %d", block);
141 return;
142 }
143
144 memcpy(buffer + ((index * sizeof(ext2_blockgrp_desc_t)) % blocksize), &blockGroups[index], sizeof(ext2_blockgrp_desc_t));
145
146 if(WriteBlock(block, buffer)){
147 Log::Info("[Ext2] WriteBlock: Error writing block %d", block);
148 return;
149 }
150 }
151
152 uint32_t Ext2Volume::GetInodeBlock(uint32_t index, ext2_inode_t& ino){
153 uint32_t blocksPerPointer = blocksize / sizeof(uint32_t); // Amount of blocks in a indirect block table

Callers

nothing calls this directly

Calls 2

InfoFunction · 0.85
memcpyFunction · 0.85

Tested by

no test coverage detected