[Yunq] Add support for repeated nested fields
This commit is contained in:
parent
05f2403dc2
commit
9c860dd6a4
14 changed files with 207 additions and 61 deletions
|
|
@ -35,26 +35,21 @@ glcr::Status DenaliServer::HandleReadMany(const ReadManyRequest& req,
|
|||
ReadResponse& resp) {
|
||||
ASSIGN_OR_RETURN(AhciPort * device, driver_.GetDevice(req.device_id()));
|
||||
|
||||
if (req.lba().size() != req.sector_cnt().size()) {
|
||||
return glcr::InvalidArgument("LBA and Sector Cnt must be the same length.");
|
||||
}
|
||||
|
||||
uint64_t sector_cnt = 0;
|
||||
for (uint64_t cnt : req.sector_cnt()) {
|
||||
sector_cnt += cnt;
|
||||
for (auto& block : req.blocks()) {
|
||||
sector_cnt += block.size();
|
||||
}
|
||||
uint64_t region_paddr;
|
||||
mmth::OwnedMemoryRegion region = mmth::OwnedMemoryRegion::ContiguousPhysical(
|
||||
sector_cnt * 512, ®ion_paddr);
|
||||
|
||||
for (uint64_t i = 0; i < req.lba().size(); i++) {
|
||||
uint64_t lba = req.lba().at(i);
|
||||
uint64_t size = req.sector_cnt().at(i);
|
||||
ASSIGN_OR_RETURN(auto semaphore,
|
||||
device->IssueRead(lba, size, region_paddr));
|
||||
for (auto& block : req.blocks()) {
|
||||
ASSIGN_OR_RETURN(
|
||||
auto semaphore,
|
||||
device->IssueRead(block.lba(), block.size(), region_paddr));
|
||||
semaphore->Wait();
|
||||
|
||||
region_paddr += size * 512;
|
||||
region_paddr += block.size() * 512;
|
||||
}
|
||||
|
||||
resp.set_device_id(req.device_id());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue