libqos: add a simple first-fit memory allocator
authorJohn Snow <jsnow@redhat.com>
Fri, 1 Aug 2014 15:38:58 +0000 (11:38 -0400)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 8 Sep 2014 10:12:43 +0000 (11:12 +0100)
commitec2f160538a24b72767e2afd1f0ba3085a35b79d
treeb94718ea238b83be87eeabfdfa945f5b8130c664
parent53b33231f76e85984eb18a4c63fd132d0d4e3f40
libqos: add a simple first-fit memory allocator

Implement a simple first-fit memory allocator that
attempts to keep track of leased blocks of memory
in order to be able to re-use blocks.

Additionally, allow the user to specify when
initializing the device that upon cleanup,
we would like to assert that there are no
blocks in use. This may be useful for identifying
problems in qtests that use more complicated
set-up and tear-down routines.

This functionality is used in my upcoming ahci-test v2
patch set, but I didn't see fit to enable it for any
existing tests, which will continue to operate the
same as they have prior.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
tests/libqos/malloc-pc.c
tests/libqos/malloc-pc.h