virtio: Rework queue_dequeue to return a boolean.

It previously returned the cookie directly, which made it impossible
to distinguish between a NULL cookie and the function not having
anything to dequeue. This lead to some code setting a cookie that was
not actually used.

Return the dequeue status as a boolean and provide the cookie with an
optionally handed in pointer instead and adjust all users.

Change-Id: Iaac1726ac4bc7ae42bb96b8f0915852b6def5822
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1814
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Michael Lotz
2019-09-02 14:30:29 +00:00
committed by waddlesplash
parent 26c0b5e701
commit 9a2911ca8c
9 changed files with 38 additions and 45 deletions
+2 -1
View File
@@ -134,7 +134,8 @@ typedef struct {
uint16 (*queue_size)(virtio_queue queue);
void* (*queue_dequeue)(virtio_queue queue, uint32* _usedLength);
bool (*queue_dequeue)(virtio_queue queue, void** _cookie,
uint32* _usedLength);
} virtio_device_interface;