vmstate_register_with_alias_id: Take an Error **
[qemu.git] / block / qed-gencb.c
blobfaf8ecc84068a908c25d83609909ed93dd56b483
1 /*
2 * QEMU Enhanced Disk Format
4 * Copyright IBM, Corp. 2010
6 * Authors:
7 * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
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.
14 #include "qemu/osdep.h"
15 #include "qed.h"
17 void *gencb_alloc(size_t len, BlockCompletionFunc *cb, void *opaque)
19 GenericCB *gencb = g_malloc(len);
20 gencb->cb = cb;
21 gencb->opaque = opaque;
22 return gencb;
25 void gencb_complete(void *opaque, int ret)
27 GenericCB *gencb = opaque;
28 BlockCompletionFunc *cb = gencb->cb;
29 void *user_opaque = gencb->opaque;
31 g_free(gencb);
32 cb(user_opaque, ret);