Lines Matching refs:aio
74 static int afalg_init_aio(afalg_aio *aio);
184 static int afalg_setup_async_event_notification(afalg_aio *aio) in afalg_setup_async_event_notification() argument
200 &aio->efd, &custom); in afalg_setup_async_event_notification()
206 aio->efd = eventfd(0); in afalg_setup_async_event_notification()
207 if (aio->efd == -1) { in afalg_setup_async_event_notification()
215 aio->efd, custom, in afalg_setup_async_event_notification()
219 close(aio->efd); in afalg_setup_async_event_notification()
223 if (fcntl(aio->efd, F_SETFL, O_NONBLOCK) != 0) { in afalg_setup_async_event_notification()
228 aio->mode = MODE_ASYNC; in afalg_setup_async_event_notification()
231 aio->efd = eventfd(0); in afalg_setup_async_event_notification()
232 if (aio->efd == -1) { in afalg_setup_async_event_notification()
238 aio->mode = MODE_SYNC; in afalg_setup_async_event_notification()
243 static int afalg_init_aio(afalg_aio *aio) in afalg_init_aio() argument
248 aio->aio_ctx = 0; in afalg_init_aio()
249 r = io_setup(MAX_INFLIGHTS, &aio->aio_ctx); in afalg_init_aio()
256 memset(aio->cbt, 0, sizeof(aio->cbt)); in afalg_init_aio()
257 aio->efd = -1; in afalg_init_aio()
258 aio->mode = MODE_UNINIT; in afalg_init_aio()
263 static int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf, in afalg_fin_cipher_aio() argument
278 if (aio->mode == MODE_UNINIT) { in afalg_fin_cipher_aio()
279 r = afalg_setup_async_event_notification(aio); in afalg_fin_cipher_aio()
284 cb = &(aio->cbt[0 % MAX_INFLIGHTS]); in afalg_fin_cipher_aio()
297 cb->aio_resfd = aio->efd; in afalg_fin_cipher_aio()
303 r = io_read(aio->aio_ctx, 1, &cb); in afalg_fin_cipher_aio()
314 r = read(aio->efd, &eval, sizeof(eval)); in afalg_fin_cipher_aio()
336 r = io_getevents(aio->aio_ctx, 1, MAX_INFLIGHTS, in afalg_fin_cipher_aio()
349 r = io_read(aio->aio_ctx, 1, &cb); in afalg_fin_cipher_aio()
629 if (afalg_init_aio(&actx->aio) == 0) in afalg_cipher_init()
683 ret = afalg_fin_cipher_aio(&actx->aio, actx->sfd, out, inl); in afalg_do_cipher()
718 if (actx->aio.mode == MODE_SYNC) in afalg_cipher_cleanup()
719 close(actx->aio.efd); in afalg_cipher_cleanup()
720 io_destroy(actx->aio.aio_ctx); in afalg_cipher_cleanup()