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

Function Identify

Kernel/src/fs/ext2.cpp:15–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14namespace fs::Ext2{
15 int Identify(PartitionDevice* part){
16 ext2_superblock_t* superblock = (ext2_superblock_t*)kmalloc(sizeof(ext2_superblock_t));
17
18 if(part->ReadBlock(EXT2_SUPERBLOCK_LOCATION / part->parentDisk->blocksize, sizeof(ext2_superblock_t), superblock)){
19 return -1; // Disk Error
20 }
21
22 int isExt2 = 0;
23
24 if(superblock->magic == EXT2_SUPER_MAGIC){
25 isExt2 = 1;
26 }
27
28 kfree(superblock);
29
30 return isExt2;
31 }
32
33 Ext2Volume::Ext2Volume(PartitionDevice* part, const char* name){
34 this->part = part;

Callers 2

PortMethod · 0.50
InitializePartitionsMethod · 0.50

Calls 3

kmallocFunction · 0.85
kfreeFunction · 0.85
ReadBlockMethod · 0.45

Tested by

no test coverage detected