qcow2: Add function for refcount order amendment
[qemu.git] / block / qed-gencb.c
blobb817a8bf5092ca05c24ed9b0c6775fb4738fbb27
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 "qed.h"
16 void *gencb_alloc(size_t len, BlockCompletionFunc *cb, void *opaque)
18 GenericCB *gencb = g_malloc(len);
19 gencb->cb = cb;
20 gencb->opaque = opaque;
21 return gencb;
24 void gencb_complete(void *opaque, int ret)
26 GenericCB *gencb = opaque;
27 BlockCompletionFunc *cb = gencb->cb;
28 void *user_opaque = gencb->opaque;
30 g_free(gencb);
31 cb(user_opaque, ret);