Changeset 18909 in vbox
- Timestamp:
- Apr 15, 2009 8:28:13 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 45971
- Location:
- trunk/include/iprt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/err.h
r18342 r18909 570 570 /** Tried to grow a file beyond the limit imposed by the process or the filesystem. */ 571 571 #define VERR_FILE_TOO_BIG (-128) 572 /** No pending request the aio context has to wait for completion. */ 573 #define VERR_FILE_AIO_NO_REQUEST (-129) 574 /** The request could not be canceled because it is already processed. */ 575 #define VERR_FILE_AIO_IN_PROGRESS (-130) 576 /** The request could not be canceled because it already completed. */ 577 #define VERR_FILE_AIO_COMPLETED (-131) 578 /** The I/O context couldn't be destroyed because there are still pending requests. */ 579 #define VERR_FILE_AIO_BUSY (-132) 572 580 /** @} */ 573 581 -
trunk/include/iprt/file.h
r18128 r18909 36 36 # include <iprt/fs.h> 37 37 #endif 38 39 /** @todo rename this file to iprt/file.h */40 38 41 39 __BEGIN_DECLS … … 146 144 */ 147 145 #define RTFILE_O_CREATE_MODE_SHIFT 20 146 /** Open file for async I/O 147 * @remark This flag may not be needed on all platforms, 148 * and will be ignored on those. 149 */ 150 #define RTFILE_O_ASYNC_IO 0x00040000 148 151 149 152 /** Mask of all valid flags. 150 153 * @remark This doesn't validate the access mode properly. 151 154 */ 152 #define RTFILE_O_VALID_MASK 0x1ff 3FB73155 #define RTFILE_O_VALID_MASK 0x1ff7FB73 153 156 154 157 /** @} */ … … 760 763 RTDECL(void) RTFileReadAllFree(void *pvFile, size_t cbFile); 761 764 765 /** @page pg_rt_asyncio RT File async I/O API 766 * 767 * @todo Write something 768 */ 769 770 /** 771 * Create a async I/O request handle. 772 * 773 * @returns IPRT status code. 774 * @param phRequest Where to store the request handle. 775 */ 776 RTDECL(int) RTFileAioReqCreate(PRTFILEAIOREQ phRequest); 777 778 /** 779 * Destroy a async I/O request handle. 780 * 781 * @returns nothing 782 * @param hRequest The request handle. 783 */ 784 RTDECL(void) RTFileAioReqDestroy(RTFILEAIOREQ hRequest); 785 786 /** 787 * Prepare a read task for a async request. 788 * 789 * @returns IPRT status code. 790 * @param hRequest The request handle. 791 * @param File The file to read from. 792 * @param off The offset to start reading at. 793 * @param pvBuf Where to store the read bits. 794 * @param cbRead Number of bytes to read. 795 * @param pvUser Opaque user data associated with this request which 796 * can be retrieved with RTFileAsyncRequestGetUser() 797 */ 798 RTDECL(int) RTFileAioReqPrepareRead(RTFILEAIOREQ hRequest, RTFILE File, 799 RTFOFF off, void *pvBuf, size_t cbRead, 800 void *pvUser); 801 802 /** 803 * Prepare a write task for a async request. 804 * 805 * @returns IPRT status code. 806 * @param hRequest The request handle. 807 * @param File The file to write to. 808 * @param off The offset to start writing at. 809 * @param pvBuf Where to store the written bits. 810 * @param cbRead Number of bytes to write. 811 * @param pvUser Opaque user data associated with this request which 812 * can be retrieved with RTFileAsyncRequestGetUser() 813 */ 814 RTDECL(int) RTFileAioReqPrepareWrite(RTFILEAIOREQ hRequest, RTFILE File, 815 RTFOFF off, void *pvBuf, size_t cbWrite, 816 void *pvUser); 817 818 /** 819 * Prepare a async flush of all cached data associated with a file handle. 820 * 821 * @returns IPRT status code. 822 * @param hRequest The request handle. 823 * @param File The file to flush. 824 * @param pvUser Opaque user data associated with this request which 825 * can be retrieved with RTFileAsyncRequestGetUser() 826 */ 827 RTDECL(int) RTFileAioReqPrepareFlush(RTFILEAIOREQ Request, RTFILE File, void *pvUser); 828 829 /** 830 * Get the opaque user data associated with the given request. 831 * 832 * @returns Opaque user data. 833 * @retval NULL if there is no user data associated with the given request. 834 * @param hRequest The request handle. 835 */ 836 RTDECL(void *) RTFileAioReqGetUser(RTFILEAIOREQ hRequest); 837 838 /** 839 * Cancels a pending request. 840 * 841 * @returns IPRT status code. 842 * @retval VINF_SUCCESS If the request was canceled. 843 * @retval VERR_FILE_AIO_IN_PROGRESS If the request could not be canceled because it is already processed. 844 * @retval VERR_FILE_AIO_COMPLETED If the request could not be canceled because it already completed. 845 * 846 * @param hRequest The request to cancel. 847 */ 848 RTDECL(int) RTFileAioReqCancel(RTFILEAIOREQ hRequest); 849 850 /** 851 * Get the status of a completed request. 852 * 853 * @returns The IPRT status code of the given request. 854 * @param hRequest The request handle. 855 * @param pcbTransferred Where to store the number of bytes transfered. 856 */ 857 RTDECL(int) RTFileAioReqGetRC(RTFILEAIOREQ hRequest, size_t *pcbTransfered); 858 859 /** 860 * Create an async I/O context. 861 * 862 * @returns IPRT status code. 863 * @param phAioContext Where to store the aio context handle. 864 * @param cAioReqsMax How many async I/O requests the context should be capable 865 * to handle. -1 means that the context should support an 866 * unlimited number of requests. 867 */ 868 RTDECL(int) RTFileAioCtxCreate(RTFILEAIOCTX phAioContext, int cAioReqsMax); 869 870 /** 871 * Destroy an async I/O context. 872 * 873 * @returns IPRT status code. 874 * @param hAioContext The aio context handle. 875 */ 876 RTDECL(int) RTFileAioCtxDestroy(RTFILEAIOCTX hAioContext); 877 878 /** 879 * Get the maximum number of requests one aio context can handle. 880 * 881 * @returns Maximum number of tasks the context can handle. 882 * -1 if there is no limit. 883 * 884 * @param hAioContext The aio context handle. 885 * If NIL_RTAIOCONTEXT is passed the maximum value 886 * which can be passed to RTFileAsyncIoContextCreate() 887 * is returned. 888 */ 889 RTDECL(int) RTFileAioCtxGetMaxRequestCount(RTFILEAIOCTX hAioContext); 890 891 /** 892 * Submit an array of requests to an aio context for processing. 893 * 894 * @returns IPRT status code. 895 * @param hAioContext The context handle. 896 * @param aRequests Array of requests to submit. 897 * @param cRequests Number of requests in the array. 898 */ 899 RTDECL(int) RTFileAioCtxSubmit(RTFILEAIOCTX hAioContext, RTFILEAIOREQ aRequests[], unsigned cRequests); 900 901 /** 902 * Wait for request completion. 903 * 904 * @returns IPRT status code. 905 * @retval VERR_NUMBER_TOO_BIG If cMinRequests or cMaxRequests exceeds limit. 906 * @retval VERR_TIMEOUT If the timeout value expired before at least cMinRequests requests finished. 907 * @retval VERR_INTERRUPTED If the completion context was interrupted with RTFileAsyncIoContextWakeup(). 908 * @retval VERR_FILE_AIO_NO_REQUEST If there is no pending request to wait for completion. 909 * 910 * @param hAioContext The aio context handle to get completed requests from. 911 * @param cMinRequests The minimum number of requests which have to complete until this function returns. 912 * @param apRequestsCompleted Where to store the completed tasks. 913 * @param cMaxRequests The maximum number of requests the array can hold. 914 * @param pcRequestsCompleted Where to store the number of requests completed. 915 * @param cMillisTimeout Maximum number of millisceonds to wait before returning. 916 * Use RT_INDEFINITE_WAIT to wait forever. 917 */ 918 RTDECL(int) RTFileAioCtxWaitForCompletion(RTFILEAIOCTX hAioContext, int cMinRequests, 919 RTFILEAIOREQ apRequestsCompleted[], int cMaxRequests, 920 int *pcRequestsCompleted, unsigned cMillisTimeout); 921 922 /** 923 * Let's return RTFileAsyncIoContextWaitForCompletion() immediateley. 924 * 925 * @returns IPRT status code. 926 * @param hAioContext The context handle to wakeup. 927 */ 928 RTDECL(int) RTFileAioCtxWakeup(RTFILEAIOCONTEXT hAioContext); 929 762 930 #endif /* IN_RING3 */ 763 931 -
trunk/include/iprt/types.h
r18481 r18909 1013 1013 #define NIL_RTFILE (~(RTFILE)0) 1014 1014 1015 /** Async I/O request handle. */ 1016 typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL *) RTFILEAIOREQ; 1017 /** Pointer to a async I/O request handle. */ 1018 typedef RTFILEAIOREQ *PRTFILEAIOREQ; 1019 /** Nil request handle. */ 1020 #define NIL_RTFILEAIOREQ 0 1021 1022 /** Async I/O completion context handle. */ 1023 typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL *) RTFILEAIOCTX; 1024 /** Pointer to a async I/O completion context handle. */ 1025 typedef RTFILEAIOCTX *PRTFILEAIOCTX; 1026 /** Nil context handle. */ 1027 #define NIL_RTFILEAIOCTX 0 1028 1015 1029 /** Loader module handle. */ 1016 1030 typedef R3PTRTYPE(struct RTLDRMODINTERNAL *) RTLDRMOD;
Note:
See TracChangeset
for help on using the changeset viewer.