aio.h (5447a9afc4150693d3909a8632891061147e170d) | aio.h (f2e5dca46b5ba4588c0756c5f272123585cbbf23) |
---|---|
1/* 2 * QEMU aio implementation 3 * 4 * Copyright IBM, Corp. 2008 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 60 unchanged lines hidden (view full) --- 69 70 /* GPollFDs for aio_poll() */ 71 GArray *pollfds; 72 73 /* Thread pool for performing work and receiving completion callbacks */ 74 struct ThreadPool *thread_pool; 75} AioContext; 76 | 1/* 2 * QEMU aio implementation 3 * 4 * Copyright IBM, Corp. 2008 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 60 unchanged lines hidden (view full) --- 69 70 /* GPollFDs for aio_poll() */ 71 GArray *pollfds; 72 73 /* Thread pool for performing work and receiving completion callbacks */ 74 struct ThreadPool *thread_pool; 75} AioContext; 76 |
77/* Returns 1 if there are still outstanding AIO requests; 0 otherwise */ 78typedef int (AioFlushEventNotifierHandler)(EventNotifier *e); 79 | |
80/** 81 * aio_context_new: Allocate a new AioContext. 82 * 83 * AioContext provide a mini event-loop that can be waited on synchronously. 84 * They also provide bottom halves, a service to execute a piece of code 85 * as soon as possible. 86 */ 87AioContext *aio_context_new(void); --- 105 unchanged lines hidden (view full) --- 193 * operations, it may not be possible to make any progress without 194 * blocking. If @blocking is true, this function will wait until one 195 * or more AIO events have completed, to ensure something has moved 196 * before returning. 197 */ 198bool aio_poll(AioContext *ctx, bool blocking); 199 200#ifdef CONFIG_POSIX | 77/** 78 * aio_context_new: Allocate a new AioContext. 79 * 80 * AioContext provide a mini event-loop that can be waited on synchronously. 81 * They also provide bottom halves, a service to execute a piece of code 82 * as soon as possible. 83 */ 84AioContext *aio_context_new(void); --- 105 unchanged lines hidden (view full) --- 190 * operations, it may not be possible to make any progress without 191 * blocking. If @blocking is true, this function will wait until one 192 * or more AIO events have completed, to ensure something has moved 193 * before returning. 194 */ 195bool aio_poll(AioContext *ctx, bool blocking); 196 197#ifdef CONFIG_POSIX |
201/* Returns 1 if there are still outstanding AIO requests; 0 otherwise */ 202typedef int (AioFlushHandler)(void *opaque); 203 | |
204/* Register a file descriptor and associated callbacks. Behaves very similarly 205 * to qemu_set_fd_handler2. Unlike qemu_set_fd_handler2, these callbacks will 206 * be invoked when using qemu_aio_wait(). 207 * 208 * Code that invokes AIO completion functions should rely on this function 209 * instead of qemu_set_fd_handler[2]. 210 */ 211void aio_set_fd_handler(AioContext *ctx, 212 int fd, 213 IOHandler *io_read, 214 IOHandler *io_write, | 198/* Register a file descriptor and associated callbacks. Behaves very similarly 199 * to qemu_set_fd_handler2. Unlike qemu_set_fd_handler2, these callbacks will 200 * be invoked when using qemu_aio_wait(). 201 * 202 * Code that invokes AIO completion functions should rely on this function 203 * instead of qemu_set_fd_handler[2]. 204 */ 205void aio_set_fd_handler(AioContext *ctx, 206 int fd, 207 IOHandler *io_read, 208 IOHandler *io_write, |
215 AioFlushHandler *io_flush, | |
216 void *opaque); 217#endif 218 219/* Register an event notifier and associated callbacks. Behaves very similarly 220 * to event_notifier_set_handler. Unlike event_notifier_set_handler, these callbacks 221 * will be invoked when using qemu_aio_wait(). 222 * 223 * Code that invokes AIO completion functions should rely on this function 224 * instead of event_notifier_set_handler. 225 */ 226void aio_set_event_notifier(AioContext *ctx, 227 EventNotifier *notifier, | 209 void *opaque); 210#endif 211 212/* Register an event notifier and associated callbacks. Behaves very similarly 213 * to event_notifier_set_handler. Unlike event_notifier_set_handler, these callbacks 214 * will be invoked when using qemu_aio_wait(). 215 * 216 * Code that invokes AIO completion functions should rely on this function 217 * instead of event_notifier_set_handler. 218 */ 219void aio_set_event_notifier(AioContext *ctx, 220 EventNotifier *notifier, |
228 EventNotifierHandler *io_read, 229 AioFlushEventNotifierHandler *io_flush); | 221 EventNotifierHandler *io_read); |
230 231/* Return a GSource that lets the main loop poll the file descriptors attached 232 * to this AioContext. 233 */ 234GSource *aio_get_g_source(AioContext *ctx); 235 236/* Return the ThreadPool bound to this AioContext */ 237struct ThreadPool *aio_get_thread_pool(AioContext *ctx); 238 239/* Functions to operate on the main QEMU AioContext. */ 240 241bool qemu_aio_wait(void); 242void qemu_aio_set_event_notifier(EventNotifier *notifier, | 222 223/* Return a GSource that lets the main loop poll the file descriptors attached 224 * to this AioContext. 225 */ 226GSource *aio_get_g_source(AioContext *ctx); 227 228/* Return the ThreadPool bound to this AioContext */ 229struct ThreadPool *aio_get_thread_pool(AioContext *ctx); 230 231/* Functions to operate on the main QEMU AioContext. */ 232 233bool qemu_aio_wait(void); 234void qemu_aio_set_event_notifier(EventNotifier *notifier, |
243 EventNotifierHandler *io_read, 244 AioFlushEventNotifierHandler *io_flush); | 235 EventNotifierHandler *io_read); |
245 246#ifdef CONFIG_POSIX 247void qemu_aio_set_fd_handler(int fd, 248 IOHandler *io_read, 249 IOHandler *io_write, | 236 237#ifdef CONFIG_POSIX 238void qemu_aio_set_fd_handler(int fd, 239 IOHandler *io_read, 240 IOHandler *io_write, |
250 AioFlushHandler *io_flush, | |
251 void *opaque); 252#endif 253 254#endif | 241 void *opaque); 242#endif 243 244#endif |