Changeset 34786 in vbox
- Timestamp:
- Dec 7, 2010 2:49:17 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/err.h
r34418 r34786 660 660 /** The alignment is not really supported, however we got lucky with this 661 661 * allocation. */ 662 #define VINF_UNSUPPORTED_ALIGNMENT (97) 663 662 #define VINF_UNSUPPORTED_ALIGNMENT 97 663 /** Duplicate something. */ 664 #define VERR_DUPLICATE (-98) 665 /** Something is missing. */ 666 #define VERR_MISSING (-99) 664 667 /** @} */ 665 668 … … 751 754 /** Device or resource is busy. */ 752 755 #define VERR_RESOURCE_BUSY (-138) 756 /** A file operation was attempted on a non-file object. */ 757 #define VERR_NOT_A_FILE (-139) 758 /** A non-file operation was attempted on a file object. */ 759 #define VERR_IS_A_FILE (-140) 760 /** Unexpected filesystem object type. */ 761 #define VERR_UNEXPECTED_FS_OBJ_TYPE (-141) 762 /** A path does not start with a root specification. */ 763 #define VERR_PATH_DOES_NOT_START_WITH_ROOT (-142) 764 /** A path is relative, expected an absolute path. */ 765 #define VERR_PATH_IS_RELATIVE (-143) 766 /** A path is not relative (start with root), expected an relative path. */ 767 #define VERR_PATH_IS_NOT_RELATIVE (-144) 753 768 /** @} */ 754 769 … … 1377 1392 * @{ */ 1378 1393 /** The VFS chain specification does not have a valid prefix. */ 1379 #define VERR_VFS_CHAIN_NO_PREFIX (-22100)1394 #define VERR_VFS_CHAIN_NO_PREFIX (-22100) 1380 1395 /** The VFS chain specification is empty. */ 1381 1396 #define VERR_VFS_CHAIN_EMPTY (-22101) 1382 1397 /** Expected an element. */ 1383 #define VERR_VFS_CHAIN_EXPECTED_ELEMENT 1398 #define VERR_VFS_CHAIN_EXPECTED_ELEMENT (-22102) 1384 1399 /** The VFS object type is not known. */ 1385 1400 #define VERR_VFS_CHAIN_UNKNOWN_TYPE (-22103) -
trunk/include/iprt/vfs.h
r34535 r34786 149 149 * @param pObjInfo Where to return the info. 150 150 * @param enmAddAttr Which additional attributes should be retrieved. 151 * @sa RTFileQueryInfo, RTPathQueryInfo 151 * @sa RTVfsIoStrmQueryInfo, RTVfsFileQueryInfo, RTFileQueryInfo, 152 * RTPathQueryInfo 152 153 */ 153 154 RTDECL(int) RTVfsObjQueryInfo(RTVFSOBJ hVfsObj, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr); … … 516 517 * @param pcbRead Where to always store the number of bytes actually 517 518 * read. This can be NULL if @a fBlocking is true. 518 * @sa RTFileRead, RTPipeRead, RTPipeReadBlocking, RTSocketRead 519 * @sa RTVfsFileRead, RTFileRead, RTPipeRead, RTPipeReadBlocking, 520 * RTSocketRead 519 521 */ 520 522 RTDECL(int) RTVfsIoStrmRead(RTVFSIOSTREAM hVfsIos, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead); … … 533 535 * @param pcbRead Where to always store the number of bytes actually 534 536 * written. This can be NULL if @a fBlocking is true. 535 * @sa RTFileWrite, RTPipeWrite, RTPipeWriteBlocking, RTSocketWrite 537 * @sa RTVfsFileWrite, RTFileWrite, RTPipeWrite, RTPipeWriteBlocking, 538 * RTSocketWrite 536 539 */ 537 540 RTDECL(int) RTVfsIoStrmWrite(RTVFSIOSTREAM hVfsIos, const void *pvBuf, size_t cbToWrite, bool fBlocking, size_t *pcbWritten); … … 590 593 * @returns IPRT status code. 591 594 * @param hVfsIos The VFS I/O stream handle. 592 * @sa RT FileFlush, RTPipeFlush595 * @sa RTVfsFileFlush, RTFileFlush, RTPipeFlush 593 596 */ 594 597 RTDECL(int) RTVfsIoStrmFlush(RTVFSIOSTREAM hVfsIos); … … 605 608 * should be hidden from the caller (@c false). 606 609 * @param pfRetEvents Where to return the event mask. 607 * @sa RT PollSetAdd, RTPoll, RTPollNoResume.610 * @sa RTVfsFilePoll, RTPollSetAdd, RTPoll, RTPollNoResume. 608 611 */ 609 612 RTDECL(int) RTVfsIoStrmPoll(RTVFSIOSTREAM hVfsIos, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr, … … 692 695 RTDECL(uint32_t) RTVfsFileRelease(RTVFSFILE hVfsFile); 693 696 697 /** 698 * Query information about the object. 699 * 700 * @returns IPRT status code. 701 * @retval VERR_NOT_SUPPORTED if the @a enmAddAttr value is not handled by the 702 * implementation. 703 * 704 * @param hVfsObj The VFS object handle. 705 * @param pObjInfo Where to return the info. 706 * @param enmAddAttr Which additional attributes should be retrieved. 707 * @sa RTVfsObjQueryInfo, RTVfsFsStrmQueryInfo, RTVfsDirQueryInfo, 708 * RTVfsIoStrmQueryInfo, RTVfsFileQueryInfo, RTFileQueryInfo, 709 * RTPathQueryInfo. 710 */ 694 711 RTDECL(int) RTVfsFileQueryInfo(RTVFSFILE hVfsFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr); 712 713 /** 714 * Read bytes from the file at the current position. 715 * 716 * @returns IPRT status code. 717 * @retval VINF_SUCCESS and the number of bytes read written to @a pcbRead. 718 * @retval VINF_TRY_AGAIN if @a fBlocking is @c false, @a pcbRead is not NULL, 719 * and no data was available. @a *pcbRead will be set to 0. 720 * @retval VINF_EOF when trying to read __beyond__ the end of the file and 721 * @a pcbRead is not NULL (it will be set to the number of bytes read, 722 * or 0 if the end of the file was reached before this call). 723 * When the last byte of the read request is the last byte in the 724 * file, this status code will not be used. However, VINF_EOF is 725 * returned when attempting to read 0 bytes while standing at the end 726 * of the file. 727 * @retval VERR_EOF when trying to read __beyond__ the end of the file and 728 * @a pcbRead is NULL. 729 * @retval VERR_ACCESS_DENIED if the file is not readable. 730 * 731 * @param hVfsFile The VFS file handle. 732 * @param pvBuf Where to store the read bytes. 733 * @param cbToRead The number of bytes to read. 734 * @param fBlocking Whether the call is blocking (@c true) or not. If 735 * not, the @a pcbRead parameter must not be NULL. 736 * @param pcbRead Where to always store the number of bytes actually 737 * read. This can be NULL if @a fBlocking is true. 738 * @sa RTVfsIoStrmRead, RTFileRead, RTPipeRead, RTPipeReadBlocking, 739 * RTSocketRead 740 */ 695 741 RTDECL(int) RTVfsFileRead(RTVFSFILE hVfsFile, void *pvBuf, size_t cbToRead, size_t *pcbRead); 696 742 RTDECL(int) RTVfsFileReadAt(RTVFSFILE hVfsFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead); 743 744 /** 745 * Write bytes to the file at the current position. 746 * 747 * @returns IPRT status code. 748 * @retval VERR_ACCESS_DENIED if the file is not writable. 749 * 750 * @param hVfsFile The VFS file handle. 751 * @param pvBuf The bytes to write. 752 * @param cbToWrite The number of bytes to write. 753 * @param fBlocking Whether the call is blocking (@c true) or not. If 754 * not, the @a pcbWritten parameter must not be NULL. 755 * @param pcbRead Where to always store the number of bytes actually 756 * written. This can be NULL if @a fBlocking is true. 757 * @sa RTVfsIoStrmRead, RTFileWrite, RTPipeWrite, RTPipeWriteBlocking, 758 * RTSocketWrite 759 */ 697 760 RTDECL(int) RTVfsFileWrite(RTVFSFILE hVfsFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten); 698 761 RTDECL(int) RTVfsFileWriteAt(RTVFSFILE hVfsFile, RTFOFF off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten); 762 763 /** 764 * Flush any buffered data to the file. 765 * 766 * @returns IPRT status code. 767 * @param hVfsFile The VFS file handle. 768 * @sa RTVfsIoStrmFlush, RTFileFlush, RTPipeFlush 769 */ 699 770 RTDECL(int) RTVfsFileFlush(RTVFSFILE hVfsFile); 771 772 /** 773 * Poll for events. 774 * 775 * @returns IPRT status code. 776 * @param hVfsFile The VFS file handle. 777 * @param fEvents The events to poll for (RTPOLL_EVT_XXX). 778 * @param cMillies How long to wait for event to eventuate. 779 * @param fIntr Whether the wait is interruptible and can return 780 * VERR_INTERRUPTED (@c true) or if this condition 781 * should be hidden from the caller (@c false). 782 * @param pfRetEvents Where to return the event mask. 783 * @sa RTVfsIoStrmPoll, RTPollSetAdd, RTPoll, RTPollNoResume. 784 */ 700 785 RTDECL(RTFOFF) RTVfsFilePoll(RTVFSFILE hVfsFile, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr, 701 786 uint32_t *pfRetEvents); 787 788 /** 789 * Tells the current file position. 790 * 791 * @returns Zero or higher - where to return the file offset. Values 792 * below zero are IPRT status codes (VERR_XXX). 793 * @param hVfsFile The VFS file handle. 794 * @sa RTFileTell, RTVfsIoStrmTell. 795 */ 702 796 RTDECL(RTFOFF) RTVfsFileTell(RTVFSFILE hVfsFile); 703 797 -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r34535 r34786 2402 2402 2403 2403 2404 RTDECL(int) RTVfsFileQueryInfo(RTVFSFILE hVfsFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr) 2405 { 2406 RTVFSFILEINTERNAL *pThis = hVfsFile; 2407 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 2408 AssertReturn(pThis->uMagic == RTVFSFILE_MAGIC, VERR_INVALID_HANDLE); 2409 return RTVfsObjQueryInfo(&pThis->Stream.Base, pObjInfo, enmAddAttr); 2410 } 2411 2412 2413 RTDECL(int) RTVfsFileRead(RTVFSFILE hVfsFile, void *pvBuf, size_t cbToRead, size_t *pcbRead) 2414 { 2415 AssertPtrNullReturn(pcbRead, VERR_INVALID_POINTER); 2416 if (pcbRead) 2417 *pcbRead = 0; 2418 RTVFSFILEINTERNAL *pThis = hVfsFile; 2419 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 2420 AssertReturn(pThis->uMagic == RTVFSFILE_MAGIC, VERR_INVALID_HANDLE); 2421 return RTVfsIoStrmRead(&pThis->Stream, pvBuf, cbToRead, true /*fBlocking*/, pcbRead); 2422 } 2423 2424 2425 RTDECL(int) RTVfsFileWrite(RTVFSFILE hVfsFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten) 2426 { 2427 AssertPtrNullReturn(pcbWritten, VERR_INVALID_POINTER); 2428 if (pcbWritten) 2429 *pcbWritten = 0; 2430 RTVFSFILEINTERNAL *pThis = hVfsFile; 2431 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 2432 AssertReturn(pThis->uMagic == RTVFSFILE_MAGIC, VERR_INVALID_HANDLE); 2433 return RTVfsIoStrmWrite(&pThis->Stream, pvBuf, cbToWrite, true /*fBlocking*/, pcbWritten); 2434 } 2435 2436 2437 /// @todo RTDECL(int) RTVfsFileWriteAt(RTVFSFILE hVfsFile, RTFOFF off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten); 2438 /// @todo RTDECL(int) RTVfsFileReadAt(RTVFSFILE hVfsFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead); 2439 2440 2441 RTDECL(int) RTVfsFileFlush(RTVFSFILE hVfsFile) 2442 { 2443 RTVFSFILEINTERNAL *pThis = hVfsFile; 2444 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 2445 AssertReturn(pThis->uMagic == RTVFSFILE_MAGIC, VERR_INVALID_HANDLE); 2446 return RTVfsIoStrmFlush(&pThis->Stream); 2447 } 2448 2449 2450 RTDECL(RTFOFF) RTVfsFilePoll(RTVFSFILE hVfsFile, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr, 2451 uint32_t *pfRetEvents) 2452 { 2453 RTVFSFILEINTERNAL *pThis = hVfsFile; 2454 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 2455 AssertReturn(pThis->uMagic == RTVFSFILE_MAGIC, VERR_INVALID_HANDLE); 2456 return RTVfsIoStrmPoll(&pThis->Stream, fEvents, cMillies, fIntr, pfRetEvents); 2457 } 2458 2459 2460 RTDECL(RTFOFF) RTVfsFileTell(RTVFSFILE hVfsFile) 2461 { 2462 RTVFSFILEINTERNAL *pThis = hVfsFile; 2463 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 2464 AssertReturn(pThis->uMagic == RTVFSFILE_MAGIC, VERR_INVALID_HANDLE); 2465 return RTVfsIoStrmTell(&pThis->Stream); 2466 } 2467 2468 2404 2469 RTDECL(int) RTVfsFileSeek(RTVFSFILE hVfsFile, RTFOFF offSeek, uint32_t uMethod, uint64_t *poffActual) 2405 2470 {
Note:
See TracChangeset
for help on using the changeset viewer.