root / block / qed-gencb.c @ eae041fe
History | View | Annotate | Download (688 Bytes)
1 | 298800ca | Stefan Hajnoczi | /*
|
---|---|---|---|
2 | 298800ca | Stefan Hajnoczi | * QEMU Enhanced Disk Format
|
3 | 298800ca | Stefan Hajnoczi | *
|
4 | 298800ca | Stefan Hajnoczi | * Copyright IBM, Corp. 2010
|
5 | 298800ca | Stefan Hajnoczi | *
|
6 | 298800ca | Stefan Hajnoczi | * Authors:
|
7 | 298800ca | Stefan Hajnoczi | * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
|
8 | 298800ca | Stefan Hajnoczi | *
|
9 | 298800ca | Stefan Hajnoczi | * This work is licensed under the terms of the GNU LGPL, version 2 or later.
|
10 | 298800ca | Stefan Hajnoczi | * See the COPYING.LIB file in the top-level directory.
|
11 | 298800ca | Stefan Hajnoczi | *
|
12 | 298800ca | Stefan Hajnoczi | */
|
13 | 298800ca | Stefan Hajnoczi | |
14 | 298800ca | Stefan Hajnoczi | #include "qed.h" |
15 | 298800ca | Stefan Hajnoczi | |
16 | 298800ca | Stefan Hajnoczi | void *gencb_alloc(size_t len, BlockDriverCompletionFunc *cb, void *opaque) |
17 | 298800ca | Stefan Hajnoczi | { |
18 | 7267c094 | Anthony Liguori | GenericCB *gencb = g_malloc(len); |
19 | 298800ca | Stefan Hajnoczi | gencb->cb = cb; |
20 | 298800ca | Stefan Hajnoczi | gencb->opaque = opaque; |
21 | 298800ca | Stefan Hajnoczi | return gencb;
|
22 | 298800ca | Stefan Hajnoczi | } |
23 | 298800ca | Stefan Hajnoczi | |
24 | 298800ca | Stefan Hajnoczi | void gencb_complete(void *opaque, int ret) |
25 | 298800ca | Stefan Hajnoczi | { |
26 | 298800ca | Stefan Hajnoczi | GenericCB *gencb = opaque; |
27 | 298800ca | Stefan Hajnoczi | BlockDriverCompletionFunc *cb = gencb->cb; |
28 | 298800ca | Stefan Hajnoczi | void *user_opaque = gencb->opaque;
|
29 | 298800ca | Stefan Hajnoczi | |
30 | 7267c094 | Anthony Liguori | g_free(gencb); |
31 | 298800ca | Stefan Hajnoczi | cb(user_opaque, ret); |
32 | 298800ca | Stefan Hajnoczi | } |