1 | /* |
1 | /* |
2 | * libeio implementation |
2 | * libeio implementation |
3 | * |
3 | * |
4 | * Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann <libeio@schmorp.de> |
4 | * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2016 Marc Alexander Lehmann <libeio@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
1816 | : read (req->int1, req->ptr2, req->size); break; |
1816 | : read (req->int1, req->ptr2, req->size); break; |
1817 | case EIO_WRITE: req->result = req->offs >= 0 |
1817 | case EIO_WRITE: req->result = req->offs >= 0 |
1818 | ? pwrite (req->int1, req->ptr2, req->size, req->offs) |
1818 | ? pwrite (req->int1, req->ptr2, req->size, req->offs) |
1819 | : write (req->int1, req->ptr2, req->size); break; |
1819 | : write (req->int1, req->ptr2, req->size); break; |
1820 | |
1820 | |
|
|
1821 | case EIO_FCNTL: req->result = fcntl (req->int1, (int) req->int2, req->ptr2); break; |
|
|
1822 | case EIO_IOCTL: req->result = ioctl (req->int1, (unsigned long)req->int2, req->ptr2); break; |
|
|
1823 | |
1821 | case EIO_READAHEAD: req->result = readahead (req->int1, req->offs, req->size); break; |
1824 | case EIO_READAHEAD: req->result = readahead (req->int1, req->offs, req->size); break; |
1822 | case EIO_SENDFILE: req->result = eio__sendfile (req->int1, req->int2, req->offs, req->size); break; |
1825 | case EIO_SENDFILE: req->result = eio__sendfile (req->int1, req->int2, req->offs, req->size); break; |
1823 | |
1826 | |
1824 | #if HAVE_AT |
1827 | #if HAVE_AT |
1825 | |
1828 | |
… | |
… | |
2085 | eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data) |
2088 | eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data) |
2086 | { |
2089 | { |
2087 | REQ (EIO_WRITE); req->int1 = fd; req->offs = offset; req->size = length; req->ptr2 = buf; SEND; |
2090 | REQ (EIO_WRITE); req->int1 = fd; req->offs = offset; req->size = length; req->ptr2 = buf; SEND; |
2088 | } |
2091 | } |
2089 | |
2092 | |
|
|
2093 | eio_req *eio_fcntl (int fd, int cmd, void *arg, int pri, eio_cb cb, void *data) |
|
|
2094 | { |
|
|
2095 | REQ (EIO_IOCTL); req->int1 = fd; req->int2 = cmd; req->ptr2 = arg; SEND; |
|
|
2096 | } |
|
|
2097 | |
|
|
2098 | eio_req *eio_ioctl (int fd, unsigned long request, void *buf, int pri, eio_cb cb, void *data) |
|
|
2099 | { |
|
|
2100 | REQ (EIO_IOCTL); req->int1 = fd; req->int2 = request; req->ptr2 = buf; SEND; |
|
|
2101 | } |
|
|
2102 | |
2090 | eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data) |
2103 | eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data) |
2091 | { |
2104 | { |
2092 | REQ (EIO_FSTAT); req->int1 = fd; SEND; |
2105 | REQ (EIO_FSTAT); req->int1 = fd; SEND; |
2093 | } |
2106 | } |
2094 | |
2107 | |