blob: 7d7ac1ffc8e0a1497c76519c04be383d1d8ad3af [file] [log] [blame]
Stefan Hajnoczi298800c2010-12-06 16:08:01 +00001/*
2 * QEMU Enhanced Disk Format
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
8 *
9 * This work is licensed under the terms of the GNU LGPL, version 2 or later.
10 * See the COPYING.LIB file in the top-level directory.
11 *
12 */
13
14#include "qed.h"
15
16void *gencb_alloc(size_t len, BlockDriverCompletionFunc *cb, void *opaque)
17{
Anthony Liguori7267c092011-08-20 22:09:37 -050018 GenericCB *gencb = g_malloc(len);
Stefan Hajnoczi298800c2010-12-06 16:08:01 +000019 gencb->cb = cb;
20 gencb->opaque = opaque;
21 return gencb;
22}
23
24void gencb_complete(void *opaque, int ret)
25{
26 GenericCB *gencb = opaque;
27 BlockDriverCompletionFunc *cb = gencb->cb;
28 void *user_opaque = gencb->opaque;
29
Anthony Liguori7267c092011-08-20 22:09:37 -050030 g_free(gencb);
Stefan Hajnoczi298800c2010-12-06 16:08:01 +000031 cb(user_opaque, ret);
32}