MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / GetDesc

Method GetDesc

src/device/virtio/virt_queue/split.hpp:342–347  ·  view source on GitHub ↗

* @brief 获取描述符的可变引用 * * 用于设置描述符的 addr、len、flags 和 next 字段。 * 调用者必须确保索引有效(通过 AllocDesc() 分配)。 * * @param idx 描述符索引(必须 < queue_size) * @return 描述符的 volatile 引用(用于与设备共享内存) * @see virtio-v1.2#2.7.5 The Virtqueue Descriptor Table */

Source from the content-addressed store, hash-verified

340 * @see virtio-v1.2#2.7.5 The Virtqueue Descriptor Table
341 */
342 [[nodiscard]] auto GetDesc(uint16_t idx) -> Expected<volatile Desc*> {
343 if (idx >= queue_size_) {
344 return std::unexpected(Error{ErrorCode::kInvalidDescriptor});
345 }
346 return &desc_[idx];
347 }
348
349 /**
350 * @brief 获取描述符的只读引用

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected