- Timestamp:
- Jul 10, 2009 9:54:21 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/linux/fileaio-linux.cpp
r21504 r21505 63 63 #include "internal/fileaio.h" 64 64 65 /* Prevent including some header files the C++ compiler doesn't like. */66 #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H67 #define _LINUX_BYTEORDER_SWABB_H68 #include <linux/aio_abi.h>69 65 #include <unistd.h> 70 66 #include <sys/syscall.h> … … 77 73 * Structures and Typedefs * 78 74 *******************************************************************************/ 75 /** The async I/O context handle */ 76 typedef unsigned long LNXKAIOCONTEXT; 77 78 /** 79 * Supported commands for the iocbs 80 */ 81 enum 82 { 83 LNXKAIO_IOCB_CMD_READ = 0, 84 LNXKAIO_IOCB_CMD_WRITE 85 }; 86 79 87 /** 80 88 * The iocb structure of a request which is passed to the kernel. … … 167 175 { 168 176 /** Handle to the async I/O context. */ 169 aio_context_tAioContext;177 LNXKAIOCONTEXT AioContext; 170 178 /** Maximum number of requests this context can handle. */ 171 179 int cRequestsMax; … … 195 203 RTFILEAIOREQSTATE enmState; 196 204 /** The I/O context this request is associated with. */ 197 aio_context_tAioContext;205 LNXKAIOCONTEXT AioContext; 198 206 /** Return code the request completed with. */ 199 207 int Rc; … … 219 227 * Creates a new async I/O context. 220 228 */ 221 DECLINLINE(int) rtFileAsyncIoLinuxCreate(unsigned cEvents, aio_context_t*pAioContext)229 DECLINLINE(int) rtFileAsyncIoLinuxCreate(unsigned cEvents, LNXKAIOCONTEXT *pAioContext) 222 230 { 223 231 int rc = syscall(__NR_io_setup, cEvents, pAioContext); … … 231 239 * Destroys a async I/O context. 232 240 */ 233 DECLINLINE(int) rtFileAsyncIoLinuxDestroy( aio_context_tAioContext)241 DECLINLINE(int) rtFileAsyncIoLinuxDestroy(LNXKAIOCONTEXT AioContext) 234 242 { 235 243 int rc = syscall(__NR_io_destroy, AioContext); … … 243 251 * Submits an array of I/O requests to the kernel. 244 252 */ 245 DECLINLINE(int) rtFileAsyncIoLinuxSubmit( aio_context_tAioContext, long cReqs, LNXKAIOIOCB **ppIoCB, int *pcSubmitted)253 DECLINLINE(int) rtFileAsyncIoLinuxSubmit(LNXKAIOCONTEXT AioContext, long cReqs, LNXKAIOIOCB **ppIoCB, int *pcSubmitted) 246 254 { 247 255 int rc = syscall(__NR_io_submit, AioContext, cReqs, ppIoCB); … … 257 265 * Cancels a I/O request. 258 266 */ 259 DECLINLINE(int) rtFileAsyncIoLinuxCancel( aio_context_tAioContext, PLNXKAIOIOCB pIoCB, PLNXKAIOIOEVENT pIoResult)267 DECLINLINE(int) rtFileAsyncIoLinuxCancel(LNXKAIOCONTEXT AioContext, PLNXKAIOIOCB pIoCB, PLNXKAIOIOEVENT pIoResult) 260 268 { 261 269 int rc = syscall(__NR_io_cancel, AioContext, pIoCB, pIoResult); … … 270 278 * @returns Number of events (natural number w/ 0), IPRT error code (negative). 271 279 */ 272 DECLINLINE(int) rtFileAsyncIoLinuxGetEvents( aio_context_tAioContext, long cReqsMin, long cReqs,280 DECLINLINE(int) rtFileAsyncIoLinuxGetEvents(LNXKAIOCONTEXT AioContext, long cReqsMin, long cReqs, 273 281 PLNXKAIOIOEVENT paIoResults, struct timespec *pTimeout) 274 282 { … … 289 297 * completion port. 290 298 */ 291 aio_context_tAioContext = 0;299 LNXKAIOCONTEXT AioContext = 0; 292 300 rc = rtFileAsyncIoLinuxCreate(1, &AioContext); 293 301 if (RT_FAILURE(rc)) … … 385 393 void *pvBuf, size_t cbRead, void *pvUser) 386 394 { 387 return rtFileAioReqPrepareTransfer(hReq, hFile, IOCB_CMD_PREAD,395 return rtFileAioReqPrepareTransfer(hReq, hFile, LNXKAIO_IOCB_CMD_READ, 388 396 off, pvBuf, cbRead, pvUser); 389 397 } … … 393 401 void *pvBuf, size_t cbWrite, void *pvUser) 394 402 { 395 return rtFileAioReqPrepareTransfer(hReq, hFile, IOCB_CMD_PWRITE,403 return rtFileAioReqPrepareTransfer(hReq, hFile, LNXKAIO_IOCB_CMD_WRITE, 396 404 off, pvBuf, cbWrite, pvUser); 397 405 }
Note:
See TracChangeset
for help on using the changeset viewer.