Lines Matching refs:block
467 void PrepareReadBlock(IoBlock* block, uint64_t id) { in PrepareReadBlock()
468 block->pending = false; in PrepareReadBlock()
469 block->payload = std::make_shared<Block>(kUsbReadSize); in PrepareReadBlock()
470 block->control.aio_data = static_cast<uint64_t>(TransferId::read(id)); in PrepareReadBlock()
471 block->control.aio_buf = reinterpret_cast<uintptr_t>(block->payload->data()); in PrepareReadBlock()
472 block->control.aio_nbytes = block->payload->size(); in PrepareReadBlock()
476 IoBlock block; in CreateReadBlock() local
477 PrepareReadBlock(&block, id); in CreateReadBlock()
478 block.control.aio_rw_flags = 0; in CreateReadBlock()
479 block.control.aio_lio_opcode = IOCB_CMD_PREAD; in CreateReadBlock()
480 block.control.aio_reqprio = 0; in CreateReadBlock()
481 block.control.aio_fildes = read_fd_.get(); in CreateReadBlock()
482 block.control.aio_offset = 0; in CreateReadBlock()
483 block.control.aio_flags = IOCB_FLAG_RESFD; in CreateReadBlock()
484 block.control.aio_resfd = worker_event_fd_.get(); in CreateReadBlock()
485 return block; in CreateReadBlock()
521 IoBlock* block = &read_requests_[read_idx]; in HandleRead() local
522 block->pending = false; in HandleRead()
523 block->payload->resize(size); in HandleRead()
526 if (block->id().id != needed_read_id_) { in HandleRead()
527 LOG(VERBOSE) << "read " << block->id().id << " completed while waiting for " in HandleRead()
543 void ProcessRead(IoBlock* block) { in ProcessRead()
544 if (!block->payload->empty()) { in ProcessRead()
546 CHECK_EQ(sizeof(amessage), block->payload->size()); in ProcessRead()
548 memcpy(&msg, block->payload->data(), sizeof(amessage)); in ProcessRead()
553 Block payload = std::move(*block->payload); in ProcessRead()
571 PrepareReadBlock(block, block->id().id + kUsbReadQueueDepth); in ProcessRead()
572 SubmitRead(block); in ProcessRead()
575 bool SubmitRead(IoBlock* block) { in SubmitRead()
576 block->pending = true; in SubmitRead()
577 struct iocb* iocb = &block->control; in SubmitRead()
610 auto block = std::make_unique<IoBlock>(); in CreateWriteBlock() local
611 block->payload = std::move(payload); in CreateWriteBlock()
612 block->control.aio_data = static_cast<uint64_t>(TransferId::write(id)); in CreateWriteBlock()
613 block->control.aio_rw_flags = 0; in CreateWriteBlock()
614 block->control.aio_lio_opcode = IOCB_CMD_PWRITE; in CreateWriteBlock()
615 block->control.aio_reqprio = 0; in CreateWriteBlock()
616 block->control.aio_fildes = write_fd_.get(); in CreateWriteBlock()
617 block->control.aio_buf = reinterpret_cast<uintptr_t>(block->payload->data() + offset); in CreateWriteBlock()
618 block->control.aio_nbytes = len; in CreateWriteBlock()
619 block->control.aio_offset = 0; in CreateWriteBlock()
620 block->control.aio_flags = IOCB_FLAG_RESFD; in CreateWriteBlock()
621 block->control.aio_resfd = worker_event_fd_.get(); in CreateWriteBlock()
622 return block; in CreateWriteBlock()
626 std::shared_ptr<Block> block = std::make_shared<Block>(std::move(payload)); in CreateWriteBlock() local
627 size_t len = block->size(); in CreateWriteBlock()
628 return CreateWriteBlock(std::move(block), 0, len, id); in CreateWriteBlock()