/* For regular files, no data transfer shall occur past the offset maximum established in the open file description associated with aiocbp->aio_fildes.  */
int aio_write(struct aiocb *cb)
/* For regular files, no data transfer shall occur past the offset maximum established in the open file description associated with aiocbp->aio_fildes.  */
int aio_write(struct aiocb *cb)
{
    int oflags;
    rt_ubase_t level;
    if (!cb || (cb->aio_buf == NULL)) return -EINVAL;
    oflags = fcntl(cb->aio_fildes, F_GETFL, 0);
    if ((oflags & O_ACCMODE) != O_WRONLY ||
        (oflags & O_ACCMODE) != O_RDWR)
        return -EINVAL;
    level = rt_hw_interrupt_disable();
    cb->aio_result = -EINPROGRESS;
    rt_hw_interrupt_enable(level);
    rt_work_init(&(cb->aio_work), aio_write_work, cb);
    rt_workqueue_dowork(aio_queue, &(cb->aio_work));
    return 0;
}