VirtualBox

Changeset 42039 in vbox


Ignore:
Timestamp:
Jul 6, 2012 1:29:33 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
78939
Message:

Storage: New return status code when a free block is read

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r41976 r42039  
    15411541 * This usually indicates that there is a minor corruption in the image meta data. */
    15421542#define VERR_VD_READ_OUT_OF_RANGE                   (-3282)
     1543/** Block read was marked as free in the image and returned as a zero block. */
     1544#define VINF_VD_NEW_ZEROED_BLOCK                    3283
    15431545/** @} */
    15441546
  • trunk/include/VBox/vd.h

    r41576 r42039  
    210210 */
    211211#define VD_OPEN_FLAGS_IGNORE_FLUSH  RT_BIT(8)
     212/**
     213 * Return VINF_VD_NEW_ZEROED_BLOCK for reads from unallocated blocks.
     214 * The caller who uses the flag has to make sure that the read doesn't cross
     215 * a block boundary. Because the block size can differ between images reading one
     216 * sector at a time is the safest solution.
     217 */
     218#define VD_OPEN_FLAGS_INFORM_ABOUT_ZERO_BLOCKS RT_BIT(9)
    212219/** Mask of valid flags. */
    213 #define VD_OPEN_FLAGS_MASK          (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE | VD_OPEN_FLAGS_SEQUENTIAL | VD_OPEN_FLAGS_DISCARD | VD_OPEN_FLAGS_IGNORE_FLUSH)
     220#define VD_OPEN_FLAGS_MASK          (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE | VD_OPEN_FLAGS_SEQUENTIAL | VD_OPEN_FLAGS_DISCARD | VD_OPEN_FLAGS_IGNORE_FLUSH | VD_OPEN_FLAGS_INFORM_ABOUT_ZERO_BLOCKS)
    214221/** @}*/
    215222
  • trunk/src/VBox/Storage/VD.cpp

    r41785 r42039  
    990990                cbBufClear += cbThisRead;
    991991
    992             rc = VINF_SUCCESS;
     992            if (pImage->uOpenFlags & VD_OPEN_FLAGS_INFORM_ABOUT_ZERO_BLOCKS)
     993                rc = VINF_VD_NEW_ZEROED_BLOCK;
     994            else
     995                rc = VINF_SUCCESS;
    993996        }
    994997        else if (RT_SUCCESS(rc))
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette