rng: switch request queue to QSIMPLEQ

QSIMPLEQ supports appending to tail in O(1) and is intrusive so
it doesn't require extra memory allocations for the bookkeeping
data.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Message-Id: <1457010971-24771-1-git-send-email-lprosek@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
This commit is contained in:
Ladi Prosek 2016-03-03 14:16:11 +01:00 committed by Amit Shah
parent 97556fe80e
commit 443590c204
4 changed files with 19 additions and 16 deletions

View file

@ -39,6 +39,7 @@ struct RngRequest
void *opaque;
size_t offset;
size_t size;
QSIMPLEQ_ENTRY(RngRequest) next;
};
struct RngBackendClass
@ -56,7 +57,7 @@ struct RngBackend
/*< protected >*/
bool opened;
GSList *requests;
QSIMPLEQ_HEAD(requests, RngRequest) requests;
};