static int aio_pthread_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) { struct aio_extra *aio_ex = (struct aio_extra *)aiocb->aio_sigevent.sigev_value.sival_ptr; struct aio_private_data *pd = NULL; int ret; if (!init_aio_threadpool(handle)) { return -1; } pd = create_private_data(aio_ex, aiocb); if (pd == NULL) { DEBUG(10, ("aio_pthread_write: Could not create private data.\n")); return -1; } pd->write_command = true; ret = pthreadpool_add_job(pool, pd->jobid, aio_worker, (void *)pd); if (ret) { errno = ret; return -1; } DEBUG(10, ("aio_pthread_write: jobid=%d pwrite requested " "of %llu bytes at offset %llu\n", pd->jobid, (unsigned long long)pd->aiocb->aio_nbytes, (unsigned long long)pd->aiocb->aio_offset)); return 0; }
static int open_async(const files_struct *fsp, int flags, mode_t mode) { struct aio_open_private_data *opd = NULL; int ret; if (!init_aio_threadpool(fsp->conn->sconn->ev_ctx, &open_pool, aio_open_handle_completion)) { return -1; } opd = create_private_open_data(fsp, flags, mode); if (opd == NULL) { DEBUG(10, ("open_async: Could not create private data.\n")); return -1; } ret = pthreadpool_add_job(open_pool, opd->jobid, aio_open_worker, (void *)opd); if (ret) { errno = ret; return -1; } DEBUG(5,("open_async: mid %llu jobid %d created for file %s/%s\n", (unsigned long long)opd->mid, opd->jobid, opd->dname, opd->fname)); /* Cause the calling code to reschedule us. */ errno = EINTR; /* Maps to NT_STATUS_RETRY. */ return -1; }