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

Method WriteDiskBlock

Kernel/src/storage/atadrive.cpp:70–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 }
69
70 int ATADiskDevice::WriteDiskBlock(uint64_t lba, uint32_t count, void* _buffer){
71 uint64_t blockCount = ((count / 512 * 512) < count) ? ((count / 512) + 1) : (count / 512);
72 uint8_t* buffer = reinterpret_cast<uint8_t*>(_buffer);
73
74 while(blockCount-- && count){
75 uint64_t size;
76 if(count < 512) size = count;
77 else size = 512;
78
79 if(!size) continue;
80
81 driveLock.Wait();
82 memcpy(prdBuffer, buffer, size);
83
84 if(ATA::Access(this, lba, 1, true)){
85 driveLock.Signal();
86 return 1; // Error Reading Sectors
87 }
88 driveLock.Signal();
89
90 buffer += size;
91 lba++;
92 }
93
94 return 0;
95 }
96}

Callers

nothing calls this directly

Calls 4

memcpyFunction · 0.85
AccessFunction · 0.85
SignalMethod · 0.80
WaitMethod · 0.45

Tested by

no test coverage detected