]>
Commit | Line | Data |
---|---|---|
298800ca SH |
1 | /* |
2 | * QEMU Enhanced Disk Format | |
3 | * | |
4 | * Copyright IBM, Corp. 2010 | |
5 | * | |
6 | * Authors: | |
7 | * Stefan Hajnoczi <[email protected]> | |
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 | ||
80c71a24 | 14 | #include "qemu/osdep.h" |
298800ca SH |
15 | #include "qed.h" |
16 | ||
097310b5 | 17 | void *gencb_alloc(size_t len, BlockCompletionFunc *cb, void *opaque) |
298800ca | 18 | { |
7267c094 | 19 | GenericCB *gencb = g_malloc(len); |
298800ca SH |
20 | gencb->cb = cb; |
21 | gencb->opaque = opaque; | |
22 | return gencb; | |
23 | } | |
24 | ||
25 | void gencb_complete(void *opaque, int ret) | |
26 | { | |
27 | GenericCB *gencb = opaque; | |
097310b5 | 28 | BlockCompletionFunc *cb = gencb->cb; |
298800ca SH |
29 | void *user_opaque = gencb->opaque; |
30 | ||
7267c094 | 31 | g_free(gencb); |
298800ca SH |
32 | cb(user_opaque, ret); |
33 | } |