aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-05-20 12:24:05 +0200
committerKevin Wolf <kwolf@redhat.com>2014-08-15 15:07:15 +0200
commit7d2a35cc921ea4832083a7e8598461868bb538ce (patch)
tree0aabab68f9ae59485bba04d9fe374ed0e603af1e /include
parent23d20b5b4fb7bde102e6779b7a13b88375e4db66 (diff)
block: Introduce qemu_try_blockalign()
This function returns NULL instead of aborting when an allocation fails. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net>
Diffstat (limited to 'include')
-rw-r--r--include/block/block.h1
-rw-r--r--include/qemu/osdep.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/include/block/block.h b/include/block/block.h
index d4c816d738..e94b701667 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -455,6 +455,7 @@ void bdrv_img_create(const char *filename, const char *fmt,
size_t bdrv_opt_mem_align(BlockDriverState *bs);
void bdrv_set_guest_block_size(BlockDriverState *bs, int align);
void *qemu_blockalign(BlockDriverState *bs, size_t size);
+void *qemu_try_blockalign(BlockDriverState *bs, size_t size);
bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov);
struct HBitmapIter;
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 8480d523f0..9dd43fc2db 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -95,6 +95,7 @@ typedef signed int int_fast16_t;
#define qemu_printf printf
int qemu_daemon(int nochdir, int noclose);
+void *qemu_try_memalign(size_t alignment, size_t size);
void *qemu_memalign(size_t alignment, size_t size);
void *qemu_anon_ram_alloc(size_t size);
void qemu_vfree(void *ptr);