aio.h (dc0b0616f726956001be09e9a65a6e0b0bd939db) | aio.h (dcc772e2f2b7c2a68644133fea2b874f6751a57b) |
---|---|
1/* 2 * QEMU aio implementation 3 * 4 * Copyright IBM, Corp. 2008 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * 9 * This work is licensed under the terms of the GNU GPL, version 2. See 10 * the COPYING file in the top-level directory. 11 * 12 */ 13 14#ifndef QEMU_AIO_H 15#define QEMU_AIO_H 16 17#include "qemu-common.h" 18#include "qemu/queue.h" 19#include "qemu/event_notifier.h" | 1/* 2 * QEMU aio implementation 3 * 4 * Copyright IBM, Corp. 2008 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * 9 * This work is licensed under the terms of the GNU GPL, version 2. See 10 * the COPYING file in the top-level directory. 11 * 12 */ 13 14#ifndef QEMU_AIO_H 15#define QEMU_AIO_H 16 17#include "qemu-common.h" 18#include "qemu/queue.h" 19#include "qemu/event_notifier.h" |
20#include "qemu/thread.h" |
|
20 21typedef struct BlockDriverAIOCB BlockDriverAIOCB; 22typedef void BlockDriverCompletionFunc(void *opaque, int ret); 23 24typedef struct AIOCBInfo { 25 void (*cancel)(BlockDriverAIOCB *acb); 26 size_t aiocb_size; 27} AIOCBInfo; --- 20 unchanged lines hidden (view full) --- 48 QLIST_HEAD(, AioHandler) aio_handlers; 49 50 /* This is a simple lock used to protect the aio_handlers list. 51 * Specifically, it's used to ensure that no callbacks are removed while 52 * we're walking and dispatching callbacks. 53 */ 54 int walking_handlers; 55 | 21 22typedef struct BlockDriverAIOCB BlockDriverAIOCB; 23typedef void BlockDriverCompletionFunc(void *opaque, int ret); 24 25typedef struct AIOCBInfo { 26 void (*cancel)(BlockDriverAIOCB *acb); 27 size_t aiocb_size; 28} AIOCBInfo; --- 20 unchanged lines hidden (view full) --- 49 QLIST_HEAD(, AioHandler) aio_handlers; 50 51 /* This is a simple lock used to protect the aio_handlers list. 52 * Specifically, it's used to ensure that no callbacks are removed while 53 * we're walking and dispatching callbacks. 54 */ 55 int walking_handlers; 56 |
57 /* lock to protect between bh's adders and deleter */ 58 QemuMutex bh_lock; |
|
56 /* Anchor of the list of Bottom Halves belonging to the context */ 57 struct QEMUBH *first_bh; 58 59 /* A simple lock used to protect the first_bh list, and ensure that 60 * no callbacks are removed while we're walking and dispatching callbacks. 61 */ 62 int walking_bh; 63 --- 58 unchanged lines hidden (view full) --- 122 * a bottom half calls it already. 123 */ 124void aio_notify(AioContext *ctx); 125 126/** 127 * aio_bh_poll: Poll bottom halves for an AioContext. 128 * 129 * These are internal functions used by the QEMU main loop. | 59 /* Anchor of the list of Bottom Halves belonging to the context */ 60 struct QEMUBH *first_bh; 61 62 /* A simple lock used to protect the first_bh list, and ensure that 63 * no callbacks are removed while we're walking and dispatching callbacks. 64 */ 65 int walking_bh; 66 --- 58 unchanged lines hidden (view full) --- 125 * a bottom half calls it already. 126 */ 127void aio_notify(AioContext *ctx); 128 129/** 130 * aio_bh_poll: Poll bottom halves for an AioContext. 131 * 132 * These are internal functions used by the QEMU main loop. |
133 * And notice that multiple occurrences of aio_bh_poll cannot 134 * be called concurrently |
|
130 */ 131int aio_bh_poll(AioContext *ctx); 132 133/** 134 * qemu_bh_schedule: Schedule a bottom half. 135 * 136 * Scheduling a bottom half interrupts the main loop and causes the 137 * execution of the callback that was passed to qemu_bh_new. --- 20 unchanged lines hidden (view full) --- 158void qemu_bh_cancel(QEMUBH *bh); 159 160/** 161 *qemu_bh_delete: Cancel execution of a bottom half and free its resources. 162 * 163 * Deleting a bottom half frees the memory that was allocated for it by 164 * qemu_bh_new. It also implies canceling the bottom half if it was 165 * scheduled. | 135 */ 136int aio_bh_poll(AioContext *ctx); 137 138/** 139 * qemu_bh_schedule: Schedule a bottom half. 140 * 141 * Scheduling a bottom half interrupts the main loop and causes the 142 * execution of the callback that was passed to qemu_bh_new. --- 20 unchanged lines hidden (view full) --- 163void qemu_bh_cancel(QEMUBH *bh); 164 165/** 166 *qemu_bh_delete: Cancel execution of a bottom half and free its resources. 167 * 168 * Deleting a bottom half frees the memory that was allocated for it by 169 * qemu_bh_new. It also implies canceling the bottom half if it was 170 * scheduled. |
171 * This func is async. The bottom half will do the delete action at the finial 172 * end. |
|
166 * 167 * @bh: The bottom half to be deleted. 168 */ 169void qemu_bh_delete(QEMUBH *bh); 170 171/* Return whether there are any pending callbacks from the GSource 172 * attached to the AioContext. 173 * --- 74 unchanged lines hidden --- | 173 * 174 * @bh: The bottom half to be deleted. 175 */ 176void qemu_bh_delete(QEMUBH *bh); 177 178/* Return whether there are any pending callbacks from the GSource 179 * attached to the AioContext. 180 * --- 74 unchanged lines hidden --- |