--- libaitio/src/aio.c 2012/08/02 00:47:47 1.6 +++ libaitio/src/aio.c 2014/02/08 22:06:17 1.9 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aio.c,v 1.6 2012/08/02 00:47:47 misho Exp $ +* $Id: aio.c,v 1.9 2014/02/08 22:06:17 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Copyright 2004 - 2014 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -60,7 +60,7 @@ struct timespec aiots = { 10, 0 }; * @update = Update file handle position !0 * return: -1 error or !=-1 readed bytes */ -inline int +int io_rread(int fd, void * __restrict buf, size_t nbytes, off_t offset, int update) { int ret; @@ -139,7 +139,7 @@ io_rread(int fd, void * __restrict buf, size_t nbytes, * @update = Update file handle position !0 * return: -1 error or !=-1 written bytes */ -inline int +int io_rwrite(int fd, void * __restrict buf, size_t nbytes, off_t offset, int update) { int ret; @@ -207,7 +207,7 @@ io_rwrite(int fd, void * __restrict buf, size_t nbytes * @sig = Event for completed operations, may be =NULL * return: -1 error or 0 ok */ -inline int +int io_aiobulk(int mode, struct aiocb ** __restrict acbs, int nacb, struct sigevent *sig) { int ret; @@ -271,20 +271,20 @@ io_rreadv(int fd, struct iovec * __restrict bufs, int if (!update) lseek(fd, old, SEEK_SET); - acb = io_calloc(sizeof(void*), nbufs); + acb = e_calloc(sizeof(void*), nbufs); if (!acb) { LOGERR; return -1; } memset(acb, 0, sizeof(void*) * nbufs); for (i = 0, off = offset; i < nbufs; off += bufs[i++].iov_len) { - acb[i] = io_malloc(sizeof(struct aiocb)); + acb[i] = e_malloc(sizeof(struct aiocb)); if (!acb[i]) { LOGERR; for (i = 0; i < nbufs; i++) if (acb[i]) - io_free(acb[i]); - io_free(acb); + e_free(acb[i]); + e_free(acb); return -1; } else memset(acb[i], 0, sizeof(struct aiocb)); @@ -300,8 +300,8 @@ io_rreadv(int fd, struct iovec * __restrict bufs, int LOGERR; for (i = 0; i < nbufs; i++) if (acb[i]) - io_free(acb[i]); - io_free(acb); + e_free(acb[i]); + e_free(acb); return -1; } @@ -309,9 +309,9 @@ io_rreadv(int fd, struct iovec * __restrict bufs, int bufs[i].iov_len = aio_return(acb[i]); offset += bufs[i].iov_len; if (acb[i]) - io_free(acb[i]); + e_free(acb[i]); } - io_free(acb); + e_free(acb); #else ret = preadv(fd, bufs, nbufs, offset); if (ret == -1) { @@ -362,20 +362,20 @@ io_rwritev(int fd, struct iovec * __restrict bufs, int } #ifdef AIO_OPS - acb = io_calloc(sizeof(void*), nbufs); + acb = e_calloc(sizeof(void*), nbufs); if (!acb) { LOGERR; return -1; } else memset(acb, 0, sizeof(void*) * nbufs); for (i = 0, off = offset; i < nbufs; off += bufs[i++].iov_len) { - acb[i] = io_malloc(sizeof(struct aiocb)); + acb[i] = e_malloc(sizeof(struct aiocb)); if (!acb[i]) { LOGERR; for (i = 0; i < nbufs; i++) if (acb[i]) - io_free(acb[i]); - io_free(acb); + e_free(acb[i]); + e_free(acb); return -1; } else memset(acb[i], 0, sizeof(struct aiocb)); @@ -391,8 +391,8 @@ io_rwritev(int fd, struct iovec * __restrict bufs, int LOGERR; for (i = 0; i < nbufs; i++) if (acb[i]) - io_free(acb[i]); - io_free(acb); + e_free(acb[i]); + e_free(acb); return -1; } @@ -400,9 +400,9 @@ io_rwritev(int fd, struct iovec * __restrict bufs, int bufs[i].iov_len = aio_return(acb[i]); offset += bufs[i].iov_len; if (acb[i]) - io_free(acb[i]); + e_free(acb[i]); } - io_free(acb); + e_free(acb); #else ret = pwritev(fd, bufs, nbufs, offset); if (ret == -1) {