io.c (02b351d8466a26c93bf35ff8fd5c316e6aee8c0f) io.c (c2b38b277a7882a592f4f2ec955084b2b756daaa)
1/*
2 * Block layer I/O functions
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 2225 unchanged lines hidden (view full) ---

2234
2235 co = qemu_coroutine_create(bdrv_aio_flush_co_entry, acb);
2236 qemu_coroutine_enter(co);
2237
2238 bdrv_co_maybe_schedule_bh(acb);
2239 return &acb->common;
2240}
2241
1/*
2 * Block layer I/O functions
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 2225 unchanged lines hidden (view full) ---

2234
2235 co = qemu_coroutine_create(bdrv_aio_flush_co_entry, acb);
2236 qemu_coroutine_enter(co);
2237
2238 bdrv_co_maybe_schedule_bh(acb);
2239 return &acb->common;
2240}
2241
2242void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs,
2243 BlockCompletionFunc *cb, void *opaque)
2244{
2245 BlockAIOCB *acb;
2246
2247 acb = g_malloc(aiocb_info->aiocb_size);
2248 acb->aiocb_info = aiocb_info;
2249 acb->bs = bs;
2250 acb->cb = cb;
2251 acb->opaque = opaque;
2252 acb->refcnt = 1;
2253 return acb;
2254}
2255
2256void qemu_aio_ref(void *p)
2257{
2258 BlockAIOCB *acb = p;
2259 acb->refcnt++;
2260}
2261
2262void qemu_aio_unref(void *p)
2263{
2264 BlockAIOCB *acb = p;
2265 assert(acb->refcnt > 0);
2266 if (--acb->refcnt == 0) {
2267 g_free(acb);
2268 }
2269}
2270
2271/**************************************************************/
2272/* Coroutine block device emulation */
2273
2274typedef struct FlushCo {
2275 BlockDriverState *bs;
2276 int ret;
2277} FlushCo;
2278

--- 394 unchanged lines hidden ---
2242/**************************************************************/
2243/* Coroutine block device emulation */
2244
2245typedef struct FlushCo {
2246 BlockDriverState *bs;
2247 int ret;
2248} FlushCo;
2249

--- 394 unchanged lines hidden ---