13b491a90SEmanuele Giuseppe Esposito /* 23b491a90SEmanuele Giuseppe Esposito * QEMU System Emulator block driver 33b491a90SEmanuele Giuseppe Esposito * 43b491a90SEmanuele Giuseppe Esposito * Copyright (c) 2003 Fabrice Bellard 53b491a90SEmanuele Giuseppe Esposito * 63b491a90SEmanuele Giuseppe Esposito * Permission is hereby granted, free of charge, to any person obtaining a copy 73b491a90SEmanuele Giuseppe Esposito * of this software and associated documentation files (the "Software"), to deal 83b491a90SEmanuele Giuseppe Esposito * in the Software without restriction, including without limitation the rights 93b491a90SEmanuele Giuseppe Esposito * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 103b491a90SEmanuele Giuseppe Esposito * copies of the Software, and to permit persons to whom the Software is 113b491a90SEmanuele Giuseppe Esposito * furnished to do so, subject to the following conditions: 123b491a90SEmanuele Giuseppe Esposito * 133b491a90SEmanuele Giuseppe Esposito * The above copyright notice and this permission notice shall be included in 143b491a90SEmanuele Giuseppe Esposito * all copies or substantial portions of the Software. 153b491a90SEmanuele Giuseppe Esposito * 163b491a90SEmanuele Giuseppe Esposito * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 173b491a90SEmanuele Giuseppe Esposito * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 183b491a90SEmanuele Giuseppe Esposito * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 193b491a90SEmanuele Giuseppe Esposito * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 203b491a90SEmanuele Giuseppe Esposito * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 213b491a90SEmanuele Giuseppe Esposito * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 223b491a90SEmanuele Giuseppe Esposito * THE SOFTWARE. 233b491a90SEmanuele Giuseppe Esposito */ 243b491a90SEmanuele Giuseppe Esposito #ifndef BLOCK_COMMON_H 253b491a90SEmanuele Giuseppe Esposito #define BLOCK_COMMON_H 263b491a90SEmanuele Giuseppe Esposito 27e2c1c34fSMarkus Armbruster #include "qapi/qapi-types-block-core.h" 28e2c1c34fSMarkus Armbruster #include "qemu/queue.h" 293b491a90SEmanuele Giuseppe Esposito 303b491a90SEmanuele Giuseppe Esposito /* 311bd54201SEmanuele Giuseppe Esposito * co_wrapper{*}: Function specifiers used by block-coroutine-wrapper.py 323b491a90SEmanuele Giuseppe Esposito * 331bd54201SEmanuele Giuseppe Esposito * Function specifiers, which do nothing but mark functions to be 343b491a90SEmanuele Giuseppe Esposito * generated by scripts/block-coroutine-wrapper.py 353b491a90SEmanuele Giuseppe Esposito * 361bd54201SEmanuele Giuseppe Esposito * Usage: read docs/devel/block-coroutine-wrapper.rst 371bd54201SEmanuele Giuseppe Esposito * 38e6d3f7a6SEmanuele Giuseppe Esposito * There are 4 kind of specifiers: 3976a2f554SEmanuele Giuseppe Esposito * - co_wrapper functions can be called by only non-coroutine context, because 4076a2f554SEmanuele Giuseppe Esposito * they always generate a new coroutine. 4176a2f554SEmanuele Giuseppe Esposito * - co_wrapper_mixed functions can be called by both coroutine and 421bd54201SEmanuele Giuseppe Esposito * non-coroutine context. 43e6d3f7a6SEmanuele Giuseppe Esposito * - co_wrapper_bdrv_rdlock are co_wrapper functions but automatically take and 44e6d3f7a6SEmanuele Giuseppe Esposito * release the graph rdlock when creating a new coroutine 45e6d3f7a6SEmanuele Giuseppe Esposito * - co_wrapper_mixed_bdrv_rdlock are co_wrapper_mixed functions but 46e6d3f7a6SEmanuele Giuseppe Esposito * automatically take and release the graph rdlock when creating a new 47e6d3f7a6SEmanuele Giuseppe Esposito * coroutine. 480f3de970SAlberto Faria * 490f3de970SAlberto Faria * These functions should not be called from a coroutine_fn; instead, 500f3de970SAlberto Faria * call the wrapped function directly. 513b491a90SEmanuele Giuseppe Esposito */ 520f3de970SAlberto Faria #define co_wrapper no_coroutine_fn 530f3de970SAlberto Faria #define co_wrapper_mixed no_coroutine_fn coroutine_mixed_fn 540f3de970SAlberto Faria #define co_wrapper_bdrv_rdlock no_coroutine_fn 550f3de970SAlberto Faria #define co_wrapper_mixed_bdrv_rdlock no_coroutine_fn coroutine_mixed_fn 563b491a90SEmanuele Giuseppe Esposito 57d6ee2e32SKevin Wolf /* 58d6ee2e32SKevin Wolf * no_co_wrapper: Function specifier used by block-coroutine-wrapper.py 59d6ee2e32SKevin Wolf * 60d6ee2e32SKevin Wolf * Function specifier which does nothing but mark functions to be generated by 61d6ee2e32SKevin Wolf * scripts/block-coroutine-wrapper.py. 62d6ee2e32SKevin Wolf * 63d6ee2e32SKevin Wolf * A no_co_wrapper function declaration creates a coroutine_fn wrapper around 64d6ee2e32SKevin Wolf * functions that must not be called in coroutine context. It achieves this by 65d6ee2e32SKevin Wolf * scheduling a BH in the bottom half that runs the respective non-coroutine 66d6ee2e32SKevin Wolf * function. The coroutine yields after scheduling the BH and is reentered when 67d6ee2e32SKevin Wolf * the wrapped function returns. 68dea97c1fSKevin Wolf * 69e84c07bcSKevin Wolf * A no_co_wrapper_bdrv_rdlock function is a no_co_wrapper function that 70e84c07bcSKevin Wolf * automatically takes the graph rdlock when calling the wrapped function. In 71e84c07bcSKevin Wolf * the same way, no_co_wrapper_bdrv_wrlock functions automatically take the 72e84c07bcSKevin Wolf * graph wrlock. 73d6ee2e32SKevin Wolf */ 74d6ee2e32SKevin Wolf #define no_co_wrapper 75e84c07bcSKevin Wolf #define no_co_wrapper_bdrv_rdlock 76de903298SKevin Wolf #define no_co_wrapper_bdrv_wrlock 77d6ee2e32SKevin Wolf 780508d0beSEmanuele Giuseppe Esposito #include "block/blockjob.h" 790508d0beSEmanuele Giuseppe Esposito 803b491a90SEmanuele Giuseppe Esposito /* block.c */ 813b491a90SEmanuele Giuseppe Esposito typedef struct BlockDriver BlockDriver; 823b491a90SEmanuele Giuseppe Esposito typedef struct BdrvChild BdrvChild; 833b491a90SEmanuele Giuseppe Esposito typedef struct BdrvChildClass BdrvChildClass; 843b491a90SEmanuele Giuseppe Esposito 8572ca800eSSam Li typedef enum BlockZoneOp { 8672ca800eSSam Li BLK_ZO_OPEN, 8772ca800eSSam Li BLK_ZO_CLOSE, 8872ca800eSSam Li BLK_ZO_FINISH, 8972ca800eSSam Li BLK_ZO_RESET, 9072ca800eSSam Li } BlockZoneOp; 9172ca800eSSam Li 9272ca800eSSam Li typedef enum BlockZoneModel { 9372ca800eSSam Li BLK_Z_NONE = 0x0, /* Regular block device */ 9472ca800eSSam Li BLK_Z_HM = 0x1, /* Host-managed zoned block device */ 9572ca800eSSam Li BLK_Z_HA = 0x2, /* Host-aware zoned block device */ 9672ca800eSSam Li } BlockZoneModel; 9772ca800eSSam Li 9872ca800eSSam Li typedef enum BlockZoneState { 9972ca800eSSam Li BLK_ZS_NOT_WP = 0x0, 10072ca800eSSam Li BLK_ZS_EMPTY = 0x1, 10172ca800eSSam Li BLK_ZS_IOPEN = 0x2, 10272ca800eSSam Li BLK_ZS_EOPEN = 0x3, 10372ca800eSSam Li BLK_ZS_CLOSED = 0x4, 10472ca800eSSam Li BLK_ZS_RDONLY = 0xD, 10572ca800eSSam Li BLK_ZS_FULL = 0xE, 10672ca800eSSam Li BLK_ZS_OFFLINE = 0xF, 10772ca800eSSam Li } BlockZoneState; 10872ca800eSSam Li 10972ca800eSSam Li typedef enum BlockZoneType { 11072ca800eSSam Li BLK_ZT_CONV = 0x1, /* Conventional random writes supported */ 11172ca800eSSam Li BLK_ZT_SWR = 0x2, /* Sequential writes required */ 11272ca800eSSam Li BLK_ZT_SWP = 0x3, /* Sequential writes preferred */ 11372ca800eSSam Li } BlockZoneType; 11472ca800eSSam Li 11572ca800eSSam Li /* 11672ca800eSSam Li * Zone descriptor data structure. 11772ca800eSSam Li * Provides information on a zone with all position and size values in bytes. 11872ca800eSSam Li */ 11972ca800eSSam Li typedef struct BlockZoneDescriptor { 12072ca800eSSam Li uint64_t start; 12172ca800eSSam Li uint64_t length; 12272ca800eSSam Li uint64_t cap; 12372ca800eSSam Li uint64_t wp; 12472ca800eSSam Li BlockZoneType type; 12572ca800eSSam Li BlockZoneState state; 12672ca800eSSam Li } BlockZoneDescriptor; 12772ca800eSSam Li 128a3c41f06SSam Li /* 129a3c41f06SSam Li * Track write pointers of a zone in bytes. 130a3c41f06SSam Li */ 131a3c41f06SSam Li typedef struct BlockZoneWps { 132a3c41f06SSam Li CoMutex colock; 133a3c41f06SSam Li uint64_t wp[]; 134a3c41f06SSam Li } BlockZoneWps; 135a3c41f06SSam Li 1363b491a90SEmanuele Giuseppe Esposito typedef struct BlockDriverInfo { 1373b491a90SEmanuele Giuseppe Esposito /* in bytes, 0 if irrelevant */ 1383b491a90SEmanuele Giuseppe Esposito int cluster_size; 139c54483b6SAndrey Drobyshev /* 140c54483b6SAndrey Drobyshev * A fraction of cluster_size, if supported (currently QCOW2 only); if 141c54483b6SAndrey Drobyshev * disabled or unsupported, set equal to cluster_size. 142c54483b6SAndrey Drobyshev */ 143c54483b6SAndrey Drobyshev int subcluster_size; 1443b491a90SEmanuele Giuseppe Esposito /* offset at which the VM state can be saved (0 if not possible) */ 1453b491a90SEmanuele Giuseppe Esposito int64_t vm_state_offset; 1463b491a90SEmanuele Giuseppe Esposito bool is_dirty; 1473b491a90SEmanuele Giuseppe Esposito /* 1483b491a90SEmanuele Giuseppe Esposito * True if this block driver only supports compressed writes 1493b491a90SEmanuele Giuseppe Esposito */ 1503b491a90SEmanuele Giuseppe Esposito bool needs_compressed_writes; 1513b491a90SEmanuele Giuseppe Esposito } BlockDriverInfo; 1523b491a90SEmanuele Giuseppe Esposito 1533b491a90SEmanuele Giuseppe Esposito typedef struct BlockFragInfo { 1543b491a90SEmanuele Giuseppe Esposito uint64_t allocated_clusters; 1553b491a90SEmanuele Giuseppe Esposito uint64_t total_clusters; 1563b491a90SEmanuele Giuseppe Esposito uint64_t fragmented_clusters; 1573b491a90SEmanuele Giuseppe Esposito uint64_t compressed_clusters; 1583b491a90SEmanuele Giuseppe Esposito } BlockFragInfo; 1593b491a90SEmanuele Giuseppe Esposito 1603b491a90SEmanuele Giuseppe Esposito typedef enum { 1613b491a90SEmanuele Giuseppe Esposito BDRV_REQ_COPY_ON_READ = 0x1, 1623b491a90SEmanuele Giuseppe Esposito BDRV_REQ_ZERO_WRITE = 0x2, 1633b491a90SEmanuele Giuseppe Esposito 1643b491a90SEmanuele Giuseppe Esposito /* 1653b491a90SEmanuele Giuseppe Esposito * The BDRV_REQ_MAY_UNMAP flag is used in write_zeroes requests to indicate 1663b491a90SEmanuele Giuseppe Esposito * that the block driver should unmap (discard) blocks if it is guaranteed 1673b491a90SEmanuele Giuseppe Esposito * that the result will read back as zeroes. The flag is only passed to the 1683b491a90SEmanuele Giuseppe Esposito * driver if the block device is opened with BDRV_O_UNMAP. 1693b491a90SEmanuele Giuseppe Esposito */ 1703b491a90SEmanuele Giuseppe Esposito BDRV_REQ_MAY_UNMAP = 0x4, 1713b491a90SEmanuele Giuseppe Esposito 172e8b65355SStefan Hajnoczi /* 173e8b65355SStefan Hajnoczi * An optimization hint when all QEMUIOVector elements are within 174e8b65355SStefan Hajnoczi * previously registered bdrv_register_buf() memory ranges. 175e8b65355SStefan Hajnoczi * 176e8b65355SStefan Hajnoczi * Code that replaces the user's QEMUIOVector elements with bounce buffers 177e8b65355SStefan Hajnoczi * must take care to clear this flag. 178e8b65355SStefan Hajnoczi */ 179e8b65355SStefan Hajnoczi BDRV_REQ_REGISTERED_BUF = 0x8, 180e8b65355SStefan Hajnoczi 1813b491a90SEmanuele Giuseppe Esposito BDRV_REQ_FUA = 0x10, 1823b491a90SEmanuele Giuseppe Esposito BDRV_REQ_WRITE_COMPRESSED = 0x20, 1833b491a90SEmanuele Giuseppe Esposito 1843b491a90SEmanuele Giuseppe Esposito /* 1853b491a90SEmanuele Giuseppe Esposito * Signifies that this write request will not change the visible disk 1863b491a90SEmanuele Giuseppe Esposito * content. 1873b491a90SEmanuele Giuseppe Esposito */ 1883b491a90SEmanuele Giuseppe Esposito BDRV_REQ_WRITE_UNCHANGED = 0x40, 1893b491a90SEmanuele Giuseppe Esposito 1903b491a90SEmanuele Giuseppe Esposito /* 1913b491a90SEmanuele Giuseppe Esposito * Forces request serialisation. Use only with write requests. 1923b491a90SEmanuele Giuseppe Esposito */ 1933b491a90SEmanuele Giuseppe Esposito BDRV_REQ_SERIALISING = 0x80, 1943b491a90SEmanuele Giuseppe Esposito 1953b491a90SEmanuele Giuseppe Esposito /* 1963b491a90SEmanuele Giuseppe Esposito * Execute the request only if the operation can be offloaded or otherwise 1973b491a90SEmanuele Giuseppe Esposito * be executed efficiently, but return an error instead of using a slow 1983b491a90SEmanuele Giuseppe Esposito * fallback. 1993b491a90SEmanuele Giuseppe Esposito */ 2003b491a90SEmanuele Giuseppe Esposito BDRV_REQ_NO_FALLBACK = 0x100, 2013b491a90SEmanuele Giuseppe Esposito 2023b491a90SEmanuele Giuseppe Esposito /* 2033b491a90SEmanuele Giuseppe Esposito * BDRV_REQ_PREFETCH makes sense only in the context of copy-on-read 2043b491a90SEmanuele Giuseppe Esposito * (i.e., together with the BDRV_REQ_COPY_ON_READ flag or when a COR 2053b491a90SEmanuele Giuseppe Esposito * filter is involved), in which case it signals that the COR operation 2063b491a90SEmanuele Giuseppe Esposito * need not read the data into memory (qiov) but only ensure they are 2073b491a90SEmanuele Giuseppe Esposito * copied to the top layer (i.e., that COR operation is done). 2083b491a90SEmanuele Giuseppe Esposito */ 2093b491a90SEmanuele Giuseppe Esposito BDRV_REQ_PREFETCH = 0x200, 2103b491a90SEmanuele Giuseppe Esposito 2113b491a90SEmanuele Giuseppe Esposito /* 2123b491a90SEmanuele Giuseppe Esposito * If we need to wait for other requests, just fail immediately. Used 21345e62b46SVladimir Sementsov-Ogievskiy * only together with BDRV_REQ_SERIALISING. Used only with requests aligned 21445e62b46SVladimir Sementsov-Ogievskiy * to request_alignment (corresponding assertions are in block/io.c). 2153b491a90SEmanuele Giuseppe Esposito */ 2163b491a90SEmanuele Giuseppe Esposito BDRV_REQ_NO_WAIT = 0x400, 2173b491a90SEmanuele Giuseppe Esposito 2183b491a90SEmanuele Giuseppe Esposito /* Mask of valid flags */ 2193b491a90SEmanuele Giuseppe Esposito BDRV_REQ_MASK = 0x7ff, 2203b491a90SEmanuele Giuseppe Esposito } BdrvRequestFlags; 2213b491a90SEmanuele Giuseppe Esposito 2223b491a90SEmanuele Giuseppe Esposito #define BDRV_O_NO_SHARE 0x0001 /* don't share permissions */ 2233b491a90SEmanuele Giuseppe Esposito #define BDRV_O_RDWR 0x0002 2243b491a90SEmanuele Giuseppe Esposito #define BDRV_O_RESIZE 0x0004 /* request permission for resizing the node */ 2253b491a90SEmanuele Giuseppe Esposito #define BDRV_O_SNAPSHOT 0x0008 /* open the file read only and save 2263b491a90SEmanuele Giuseppe Esposito writes in a snapshot */ 2273b491a90SEmanuele Giuseppe Esposito #define BDRV_O_TEMPORARY 0x0010 /* delete the file after use */ 2283b491a90SEmanuele Giuseppe Esposito #define BDRV_O_NOCACHE 0x0020 /* do not use the host page cache */ 2293b491a90SEmanuele Giuseppe Esposito #define BDRV_O_NATIVE_AIO 0x0080 /* use native AIO instead of the 2303b491a90SEmanuele Giuseppe Esposito thread pool */ 2313b491a90SEmanuele Giuseppe Esposito #define BDRV_O_NO_BACKING 0x0100 /* don't open the backing file */ 2323b491a90SEmanuele Giuseppe Esposito #define BDRV_O_NO_FLUSH 0x0200 /* disable flushing on this disk */ 2333b491a90SEmanuele Giuseppe Esposito #define BDRV_O_COPY_ON_READ 0x0400 /* copy read backing sectors into image */ 2343b491a90SEmanuele Giuseppe Esposito #define BDRV_O_INACTIVE 0x0800 /* consistency hint for migration handoff */ 2353b491a90SEmanuele Giuseppe Esposito #define BDRV_O_CHECK 0x1000 /* open solely for consistency check */ 2363b491a90SEmanuele Giuseppe Esposito #define BDRV_O_ALLOW_RDWR 0x2000 /* allow reopen to change from r/o to r/w */ 2373b491a90SEmanuele Giuseppe Esposito #define BDRV_O_UNMAP 0x4000 /* execute guest UNMAP/TRIM operations */ 2383b491a90SEmanuele Giuseppe Esposito #define BDRV_O_PROTOCOL 0x8000 /* if no block driver is explicitly given: 2393b491a90SEmanuele Giuseppe Esposito select an appropriate protocol driver, 2403b491a90SEmanuele Giuseppe Esposito ignoring the format layer */ 2413b491a90SEmanuele Giuseppe Esposito #define BDRV_O_NO_IO 0x10000 /* don't initialize for I/O */ 2423b491a90SEmanuele Giuseppe Esposito #define BDRV_O_AUTO_RDONLY 0x20000 /* degrade to read-only if opening 2433b491a90SEmanuele Giuseppe Esposito read-write fails */ 2443b491a90SEmanuele Giuseppe Esposito #define BDRV_O_IO_URING 0x40000 /* use io_uring instead of the thread pool */ 2453b491a90SEmanuele Giuseppe Esposito 246*0fd05c8dSVladimir Sementsov-Ogievskiy #define BDRV_O_CBW_DISCARD_SOURCE 0x80000 /* for copy-before-write filter */ 247*0fd05c8dSVladimir Sementsov-Ogievskiy 2483b491a90SEmanuele Giuseppe Esposito #define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH) 2493b491a90SEmanuele Giuseppe Esposito 2503b491a90SEmanuele Giuseppe Esposito 2513b491a90SEmanuele Giuseppe Esposito /* Option names of options parsed by the block layer */ 2523b491a90SEmanuele Giuseppe Esposito 2533b491a90SEmanuele Giuseppe Esposito #define BDRV_OPT_CACHE_WB "cache.writeback" 2543b491a90SEmanuele Giuseppe Esposito #define BDRV_OPT_CACHE_DIRECT "cache.direct" 2553b491a90SEmanuele Giuseppe Esposito #define BDRV_OPT_CACHE_NO_FLUSH "cache.no-flush" 2563b491a90SEmanuele Giuseppe Esposito #define BDRV_OPT_READ_ONLY "read-only" 2573b491a90SEmanuele Giuseppe Esposito #define BDRV_OPT_AUTO_READ_ONLY "auto-read-only" 2583b491a90SEmanuele Giuseppe Esposito #define BDRV_OPT_DISCARD "discard" 2593b491a90SEmanuele Giuseppe Esposito #define BDRV_OPT_FORCE_SHARE "force-share" 2603b491a90SEmanuele Giuseppe Esposito 2613b491a90SEmanuele Giuseppe Esposito 2623b491a90SEmanuele Giuseppe Esposito #define BDRV_SECTOR_BITS 9 2633b491a90SEmanuele Giuseppe Esposito #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) 2643b491a90SEmanuele Giuseppe Esposito 265a3c41f06SSam Li /* 266a3c41f06SSam Li * Get the first most significant bit of wp. If it is zero, then 267a3c41f06SSam Li * the zone type is SWR. 268a3c41f06SSam Li */ 269a3c41f06SSam Li #define BDRV_ZT_IS_CONV(wp) (wp & (1ULL << 63)) 270a3c41f06SSam Li 2713b491a90SEmanuele Giuseppe Esposito #define BDRV_REQUEST_MAX_SECTORS MIN_CONST(SIZE_MAX >> BDRV_SECTOR_BITS, \ 2723b491a90SEmanuele Giuseppe Esposito INT_MAX >> BDRV_SECTOR_BITS) 2733b491a90SEmanuele Giuseppe Esposito #define BDRV_REQUEST_MAX_BYTES (BDRV_REQUEST_MAX_SECTORS << BDRV_SECTOR_BITS) 2743b491a90SEmanuele Giuseppe Esposito 2753b491a90SEmanuele Giuseppe Esposito /* 2763b491a90SEmanuele Giuseppe Esposito * We want allow aligning requests and disk length up to any 32bit alignment 2773b491a90SEmanuele Giuseppe Esposito * and don't afraid of overflow. 2783b491a90SEmanuele Giuseppe Esposito * To achieve it, and in the same time use some pretty number as maximum disk 2793b491a90SEmanuele Giuseppe Esposito * size, let's define maximum "length" (a limit for any offset/bytes request and 2803b491a90SEmanuele Giuseppe Esposito * for disk size) to be the greatest power of 2 less than INT64_MAX. 2813b491a90SEmanuele Giuseppe Esposito */ 2823b491a90SEmanuele Giuseppe Esposito #define BDRV_MAX_ALIGNMENT (1L << 30) 2833b491a90SEmanuele Giuseppe Esposito #define BDRV_MAX_LENGTH (QEMU_ALIGN_DOWN(INT64_MAX, BDRV_MAX_ALIGNMENT)) 2843b491a90SEmanuele Giuseppe Esposito 2853b491a90SEmanuele Giuseppe Esposito /* 2863b491a90SEmanuele Giuseppe Esposito * Allocation status flags for bdrv_block_status() and friends. 2873b491a90SEmanuele Giuseppe Esposito * 2883b491a90SEmanuele Giuseppe Esposito * Public flags: 2893b491a90SEmanuele Giuseppe Esposito * BDRV_BLOCK_DATA: allocation for data at offset is tied to this layer 2903b491a90SEmanuele Giuseppe Esposito * BDRV_BLOCK_ZERO: offset reads as zero 2913b491a90SEmanuele Giuseppe Esposito * BDRV_BLOCK_OFFSET_VALID: an associated offset exists for accessing raw data 2923b491a90SEmanuele Giuseppe Esposito * BDRV_BLOCK_ALLOCATED: the content of the block is determined by this 2933b491a90SEmanuele Giuseppe Esposito * layer rather than any backing, set by block layer 2943b491a90SEmanuele Giuseppe Esposito * BDRV_BLOCK_EOF: the returned pnum covers through end of file for this 2953b491a90SEmanuele Giuseppe Esposito * layer, set by block layer 29628482891SAndrey Drobyshev via * BDRV_BLOCK_COMPRESSED: the underlying data is compressed; only valid for 29728482891SAndrey Drobyshev via * the formats supporting compression: qcow, qcow2 2983b491a90SEmanuele Giuseppe Esposito * 2993b491a90SEmanuele Giuseppe Esposito * Internal flags: 3003b491a90SEmanuele Giuseppe Esposito * BDRV_BLOCK_RAW: for use by passthrough drivers, such as raw, to request 3013b491a90SEmanuele Giuseppe Esposito * that the block layer recompute the answer from the returned 3023b491a90SEmanuele Giuseppe Esposito * BDS; must be accompanied by just BDRV_BLOCK_OFFSET_VALID. 3033b491a90SEmanuele Giuseppe Esposito * BDRV_BLOCK_RECURSE: request that the block layer will recursively search for 3043b491a90SEmanuele Giuseppe Esposito * zeroes in file child of current block node inside 3053b491a90SEmanuele Giuseppe Esposito * returned region. Only valid together with both 3063b491a90SEmanuele Giuseppe Esposito * BDRV_BLOCK_DATA and BDRV_BLOCK_OFFSET_VALID. Should not 3073b491a90SEmanuele Giuseppe Esposito * appear with BDRV_BLOCK_ZERO. 3083b491a90SEmanuele Giuseppe Esposito * 3093b491a90SEmanuele Giuseppe Esposito * If BDRV_BLOCK_OFFSET_VALID is set, the map parameter represents the 3103b491a90SEmanuele Giuseppe Esposito * host offset within the returned BDS that is allocated for the 3113b491a90SEmanuele Giuseppe Esposito * corresponding raw guest data. However, whether that offset 3123b491a90SEmanuele Giuseppe Esposito * actually contains data also depends on BDRV_BLOCK_DATA, as follows: 3133b491a90SEmanuele Giuseppe Esposito * 3143b491a90SEmanuele Giuseppe Esposito * DATA ZERO OFFSET_VALID 3153b491a90SEmanuele Giuseppe Esposito * t t t sectors read as zero, returned file is zero at offset 3163b491a90SEmanuele Giuseppe Esposito * t f t sectors read as valid from file at offset 3173b491a90SEmanuele Giuseppe Esposito * f t t sectors preallocated, read as zero, returned file not 3183b491a90SEmanuele Giuseppe Esposito * necessarily zero at offset 3193b491a90SEmanuele Giuseppe Esposito * f f t sectors preallocated but read from backing_hd, 3203b491a90SEmanuele Giuseppe Esposito * returned file contains garbage at offset 3213b491a90SEmanuele Giuseppe Esposito * t t f sectors preallocated, read as zero, unknown offset 3223b491a90SEmanuele Giuseppe Esposito * t f f sectors read from unknown file or offset 3233b491a90SEmanuele Giuseppe Esposito * f t f not allocated or unknown offset, read as zero 3243b491a90SEmanuele Giuseppe Esposito * f f f not allocated or unknown offset, read from backing_hd 3253b491a90SEmanuele Giuseppe Esposito */ 3263b491a90SEmanuele Giuseppe Esposito #define BDRV_BLOCK_DATA 0x01 3273b491a90SEmanuele Giuseppe Esposito #define BDRV_BLOCK_ZERO 0x02 3283b491a90SEmanuele Giuseppe Esposito #define BDRV_BLOCK_OFFSET_VALID 0x04 3293b491a90SEmanuele Giuseppe Esposito #define BDRV_BLOCK_RAW 0x08 3303b491a90SEmanuele Giuseppe Esposito #define BDRV_BLOCK_ALLOCATED 0x10 3313b491a90SEmanuele Giuseppe Esposito #define BDRV_BLOCK_EOF 0x20 3323b491a90SEmanuele Giuseppe Esposito #define BDRV_BLOCK_RECURSE 0x40 33328482891SAndrey Drobyshev via #define BDRV_BLOCK_COMPRESSED 0x80 3343b491a90SEmanuele Giuseppe Esposito 3353b491a90SEmanuele Giuseppe Esposito typedef QTAILQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue; 3363b491a90SEmanuele Giuseppe Esposito 3373b491a90SEmanuele Giuseppe Esposito typedef struct BDRVReopenState { 3383b491a90SEmanuele Giuseppe Esposito BlockDriverState *bs; 3393b491a90SEmanuele Giuseppe Esposito int flags; 3403b491a90SEmanuele Giuseppe Esposito BlockdevDetectZeroesOptions detect_zeroes; 3413b491a90SEmanuele Giuseppe Esposito bool backing_missing; 3423b491a90SEmanuele Giuseppe Esposito BlockDriverState *old_backing_bs; /* keep pointer for permissions update */ 3433b491a90SEmanuele Giuseppe Esposito BlockDriverState *old_file_bs; /* keep pointer for permissions update */ 3443b491a90SEmanuele Giuseppe Esposito QDict *options; 3453b491a90SEmanuele Giuseppe Esposito QDict *explicit_options; 3463b491a90SEmanuele Giuseppe Esposito void *opaque; 3473b491a90SEmanuele Giuseppe Esposito } BDRVReopenState; 3483b491a90SEmanuele Giuseppe Esposito 3493b491a90SEmanuele Giuseppe Esposito /* 3503b491a90SEmanuele Giuseppe Esposito * Block operation types 3513b491a90SEmanuele Giuseppe Esposito */ 3523b491a90SEmanuele Giuseppe Esposito typedef enum BlockOpType { 3533b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_BACKUP_SOURCE, 3543b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_BACKUP_TARGET, 3553b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_CHANGE, 3563b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_COMMIT_SOURCE, 3573b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_COMMIT_TARGET, 3583b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_DATAPLANE, 3593b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_DRIVE_DEL, 3603b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_EJECT, 3613b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, 3623b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, 3633b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE, 3643b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_MIRROR_SOURCE, 3653b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_MIRROR_TARGET, 3663b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_RESIZE, 3673b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_STREAM, 3683b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_REPLACE, 3693b491a90SEmanuele Giuseppe Esposito BLOCK_OP_TYPE_MAX, 3703b491a90SEmanuele Giuseppe Esposito } BlockOpType; 3713b491a90SEmanuele Giuseppe Esposito 3723b491a90SEmanuele Giuseppe Esposito /* Block node permission constants */ 3733b491a90SEmanuele Giuseppe Esposito enum { 3743b491a90SEmanuele Giuseppe Esposito /** 3753b491a90SEmanuele Giuseppe Esposito * A user that has the "permission" of consistent reads is guaranteed that 3763b491a90SEmanuele Giuseppe Esposito * their view of the contents of the block device is complete and 3773b491a90SEmanuele Giuseppe Esposito * self-consistent, representing the contents of a disk at a specific 3783b491a90SEmanuele Giuseppe Esposito * point. 3793b491a90SEmanuele Giuseppe Esposito * 3803b491a90SEmanuele Giuseppe Esposito * For most block devices (including their backing files) this is true, but 3813b491a90SEmanuele Giuseppe Esposito * the property cannot be maintained in a few situations like for 3823b491a90SEmanuele Giuseppe Esposito * intermediate nodes of a commit block job. 3833b491a90SEmanuele Giuseppe Esposito */ 3843b491a90SEmanuele Giuseppe Esposito BLK_PERM_CONSISTENT_READ = 0x01, 3853b491a90SEmanuele Giuseppe Esposito 3863b491a90SEmanuele Giuseppe Esposito /** This permission is required to change the visible disk contents. */ 3873b491a90SEmanuele Giuseppe Esposito BLK_PERM_WRITE = 0x02, 3883b491a90SEmanuele Giuseppe Esposito 3893b491a90SEmanuele Giuseppe Esposito /** 3903b491a90SEmanuele Giuseppe Esposito * This permission (which is weaker than BLK_PERM_WRITE) is both enough and 3913b491a90SEmanuele Giuseppe Esposito * required for writes to the block node when the caller promises that 3923b491a90SEmanuele Giuseppe Esposito * the visible disk content doesn't change. 3933b491a90SEmanuele Giuseppe Esposito * 3943b491a90SEmanuele Giuseppe Esposito * As the BLK_PERM_WRITE permission is strictly stronger, either is 3953b491a90SEmanuele Giuseppe Esposito * sufficient to perform an unchanging write. 3963b491a90SEmanuele Giuseppe Esposito */ 3973b491a90SEmanuele Giuseppe Esposito BLK_PERM_WRITE_UNCHANGED = 0x04, 3983b491a90SEmanuele Giuseppe Esposito 3993b491a90SEmanuele Giuseppe Esposito /** This permission is required to change the size of a block node. */ 4003b491a90SEmanuele Giuseppe Esposito BLK_PERM_RESIZE = 0x08, 4013b491a90SEmanuele Giuseppe Esposito 4023b491a90SEmanuele Giuseppe Esposito /** 4033b491a90SEmanuele Giuseppe Esposito * There was a now-removed bit BLK_PERM_GRAPH_MOD, with value of 0x10. QEMU 4043b491a90SEmanuele Giuseppe Esposito * 6.1 and earlier may still lock the corresponding byte in block/file-posix 4053b491a90SEmanuele Giuseppe Esposito * locking. So, implementing some new permission should be very careful to 4063b491a90SEmanuele Giuseppe Esposito * not interfere with this old unused thing. 4073b491a90SEmanuele Giuseppe Esposito */ 4083b491a90SEmanuele Giuseppe Esposito 4093b491a90SEmanuele Giuseppe Esposito BLK_PERM_ALL = 0x0f, 4103b491a90SEmanuele Giuseppe Esposito 4113b491a90SEmanuele Giuseppe Esposito DEFAULT_PERM_PASSTHROUGH = BLK_PERM_CONSISTENT_READ 4123b491a90SEmanuele Giuseppe Esposito | BLK_PERM_WRITE 4133b491a90SEmanuele Giuseppe Esposito | BLK_PERM_WRITE_UNCHANGED 4143b491a90SEmanuele Giuseppe Esposito | BLK_PERM_RESIZE, 4153b491a90SEmanuele Giuseppe Esposito 4163b491a90SEmanuele Giuseppe Esposito DEFAULT_PERM_UNCHANGED = BLK_PERM_ALL & ~DEFAULT_PERM_PASSTHROUGH, 4173b491a90SEmanuele Giuseppe Esposito }; 4183b491a90SEmanuele Giuseppe Esposito 4193b491a90SEmanuele Giuseppe Esposito /* 4203b491a90SEmanuele Giuseppe Esposito * Flags that parent nodes assign to child nodes to specify what kind of 4213b491a90SEmanuele Giuseppe Esposito * role(s) they take. 4223b491a90SEmanuele Giuseppe Esposito * 4233b491a90SEmanuele Giuseppe Esposito * At least one of DATA, METADATA, FILTERED, or COW must be set for 4243b491a90SEmanuele Giuseppe Esposito * every child. 42571ca4385SVladimir Sementsov-Ogievskiy * 42671ca4385SVladimir Sementsov-Ogievskiy * 42771ca4385SVladimir Sementsov-Ogievskiy * = Connection with bs->children, bs->file and bs->backing fields = 42871ca4385SVladimir Sementsov-Ogievskiy * 42971ca4385SVladimir Sementsov-Ogievskiy * 1. Filters 43071ca4385SVladimir Sementsov-Ogievskiy * 43171ca4385SVladimir Sementsov-Ogievskiy * Filter drivers have drv->is_filter = true. 43271ca4385SVladimir Sementsov-Ogievskiy * 43371ca4385SVladimir Sementsov-Ogievskiy * Filter node has exactly one FILTERED|PRIMARY child, and may have other 43471ca4385SVladimir Sementsov-Ogievskiy * children which must not have these bits (one example is the 43571ca4385SVladimir Sementsov-Ogievskiy * copy-before-write filter, which also has its target DATA child). 43671ca4385SVladimir Sementsov-Ogievskiy * 43771ca4385SVladimir Sementsov-Ogievskiy * Filter nodes never have COW children. 43871ca4385SVladimir Sementsov-Ogievskiy * 43971ca4385SVladimir Sementsov-Ogievskiy * For most filters, the filtered child is linked in bs->file, bs->backing is 44071ca4385SVladimir Sementsov-Ogievskiy * NULL. For some filters (as an exception), it is the other way around; those 44171ca4385SVladimir Sementsov-Ogievskiy * drivers will have drv->filtered_child_is_backing set to true (see that 44271ca4385SVladimir Sementsov-Ogievskiy * field’s documentation for what drivers this concerns) 44371ca4385SVladimir Sementsov-Ogievskiy * 44471ca4385SVladimir Sementsov-Ogievskiy * 2. "raw" driver (block/raw-format.c) 44571ca4385SVladimir Sementsov-Ogievskiy * 44671ca4385SVladimir Sementsov-Ogievskiy * Formally it's not a filter (drv->is_filter = false) 44771ca4385SVladimir Sementsov-Ogievskiy * 44871ca4385SVladimir Sementsov-Ogievskiy * bs->backing is always NULL 44971ca4385SVladimir Sementsov-Ogievskiy * 45071ca4385SVladimir Sementsov-Ogievskiy * Only has one child, linked in bs->file. Its role is either FILTERED|PRIMARY 45171ca4385SVladimir Sementsov-Ogievskiy * (like filter) or DATA|PRIMARY depending on options. 45271ca4385SVladimir Sementsov-Ogievskiy * 45371ca4385SVladimir Sementsov-Ogievskiy * 3. Other drivers 45471ca4385SVladimir Sementsov-Ogievskiy * 45571ca4385SVladimir Sementsov-Ogievskiy * Don't have any FILTERED children. 45671ca4385SVladimir Sementsov-Ogievskiy * 45771ca4385SVladimir Sementsov-Ogievskiy * May have at most one COW child. In this case it's linked in bs->backing. 45871ca4385SVladimir Sementsov-Ogievskiy * Otherwise bs->backing is NULL. COW child is never PRIMARY. 45971ca4385SVladimir Sementsov-Ogievskiy * 46071ca4385SVladimir Sementsov-Ogievskiy * May have at most one PRIMARY child. In this case it's linked in bs->file. 46171ca4385SVladimir Sementsov-Ogievskiy * Otherwise bs->file is NULL. 46271ca4385SVladimir Sementsov-Ogievskiy * 46371ca4385SVladimir Sementsov-Ogievskiy * May also have some other children that don't have the PRIMARY or COW bit set. 4643b491a90SEmanuele Giuseppe Esposito */ 4653b491a90SEmanuele Giuseppe Esposito enum BdrvChildRoleBits { 4663b491a90SEmanuele Giuseppe Esposito /* 4673b491a90SEmanuele Giuseppe Esposito * This child stores data. 4683b491a90SEmanuele Giuseppe Esposito * Any node may have an arbitrary number of such children. 4693b491a90SEmanuele Giuseppe Esposito */ 4703b491a90SEmanuele Giuseppe Esposito BDRV_CHILD_DATA = (1 << 0), 4713b491a90SEmanuele Giuseppe Esposito 4723b491a90SEmanuele Giuseppe Esposito /* 4733b491a90SEmanuele Giuseppe Esposito * This child stores metadata. 4743b491a90SEmanuele Giuseppe Esposito * Any node may have an arbitrary number of metadata-storing 4753b491a90SEmanuele Giuseppe Esposito * children. 4763b491a90SEmanuele Giuseppe Esposito */ 4773b491a90SEmanuele Giuseppe Esposito BDRV_CHILD_METADATA = (1 << 1), 4783b491a90SEmanuele Giuseppe Esposito 4793b491a90SEmanuele Giuseppe Esposito /* 4803b491a90SEmanuele Giuseppe Esposito * A child that always presents exactly the same visible data as 4813b491a90SEmanuele Giuseppe Esposito * the parent, e.g. by virtue of the parent forwarding all reads 4823b491a90SEmanuele Giuseppe Esposito * and writes. 4833b491a90SEmanuele Giuseppe Esposito * This flag is mutually exclusive with DATA, METADATA, and COW. 4843b491a90SEmanuele Giuseppe Esposito * Any node may have at most one filtered child at a time. 4853b491a90SEmanuele Giuseppe Esposito */ 4863b491a90SEmanuele Giuseppe Esposito BDRV_CHILD_FILTERED = (1 << 2), 4873b491a90SEmanuele Giuseppe Esposito 4883b491a90SEmanuele Giuseppe Esposito /* 4893b491a90SEmanuele Giuseppe Esposito * Child from which to read all data that isn't allocated in the 4903b491a90SEmanuele Giuseppe Esposito * parent (i.e., the backing child); such data is copied to the 4913b491a90SEmanuele Giuseppe Esposito * parent through COW (and optionally COR). 4923b491a90SEmanuele Giuseppe Esposito * This field is mutually exclusive with DATA, METADATA, and 4933b491a90SEmanuele Giuseppe Esposito * FILTERED. 4943b491a90SEmanuele Giuseppe Esposito * Any node may have at most one such backing child at a time. 4953b491a90SEmanuele Giuseppe Esposito */ 4963b491a90SEmanuele Giuseppe Esposito BDRV_CHILD_COW = (1 << 3), 4973b491a90SEmanuele Giuseppe Esposito 4983b491a90SEmanuele Giuseppe Esposito /* 4993b491a90SEmanuele Giuseppe Esposito * The primary child. For most drivers, this is the child whose 5003b491a90SEmanuele Giuseppe Esposito * filename applies best to the parent node. 5013b491a90SEmanuele Giuseppe Esposito * Any node may have at most one primary child at a time. 5023b491a90SEmanuele Giuseppe Esposito */ 5033b491a90SEmanuele Giuseppe Esposito BDRV_CHILD_PRIMARY = (1 << 4), 5043b491a90SEmanuele Giuseppe Esposito 5053b491a90SEmanuele Giuseppe Esposito /* Useful combination of flags */ 5063b491a90SEmanuele Giuseppe Esposito BDRV_CHILD_IMAGE = BDRV_CHILD_DATA 5073b491a90SEmanuele Giuseppe Esposito | BDRV_CHILD_METADATA 5083b491a90SEmanuele Giuseppe Esposito | BDRV_CHILD_PRIMARY, 5093b491a90SEmanuele Giuseppe Esposito }; 5103b491a90SEmanuele Giuseppe Esposito 5113b491a90SEmanuele Giuseppe Esposito /* Mask of BdrvChildRoleBits values */ 5123b491a90SEmanuele Giuseppe Esposito typedef unsigned int BdrvChildRole; 5133b491a90SEmanuele Giuseppe Esposito 5143b491a90SEmanuele Giuseppe Esposito typedef struct BdrvCheckResult { 5153b491a90SEmanuele Giuseppe Esposito int corruptions; 5163b491a90SEmanuele Giuseppe Esposito int leaks; 5173b491a90SEmanuele Giuseppe Esposito int check_errors; 5183b491a90SEmanuele Giuseppe Esposito int corruptions_fixed; 5193b491a90SEmanuele Giuseppe Esposito int leaks_fixed; 5203b491a90SEmanuele Giuseppe Esposito int64_t image_end_offset; 5213b491a90SEmanuele Giuseppe Esposito BlockFragInfo bfi; 5223b491a90SEmanuele Giuseppe Esposito } BdrvCheckResult; 5233b491a90SEmanuele Giuseppe Esposito 5243b491a90SEmanuele Giuseppe Esposito typedef enum { 5253b491a90SEmanuele Giuseppe Esposito BDRV_FIX_LEAKS = 1, 5263b491a90SEmanuele Giuseppe Esposito BDRV_FIX_ERRORS = 2, 5273b491a90SEmanuele Giuseppe Esposito } BdrvCheckMode; 5283b491a90SEmanuele Giuseppe Esposito 5293b491a90SEmanuele Giuseppe Esposito typedef struct BlockSizes { 5303b491a90SEmanuele Giuseppe Esposito uint32_t phys; 5313b491a90SEmanuele Giuseppe Esposito uint32_t log; 5323b491a90SEmanuele Giuseppe Esposito } BlockSizes; 5333b491a90SEmanuele Giuseppe Esposito 5343b491a90SEmanuele Giuseppe Esposito typedef struct HDGeometry { 5353b491a90SEmanuele Giuseppe Esposito uint32_t heads; 5363b491a90SEmanuele Giuseppe Esposito uint32_t sectors; 5373b491a90SEmanuele Giuseppe Esposito uint32_t cylinders; 5383b491a90SEmanuele Giuseppe Esposito } HDGeometry; 5393b491a90SEmanuele Giuseppe Esposito 5403b491a90SEmanuele Giuseppe Esposito /* 5413b491a90SEmanuele Giuseppe Esposito * Common functions that are neither I/O nor Global State. 5423b491a90SEmanuele Giuseppe Esposito * 5433b491a90SEmanuele Giuseppe Esposito * These functions must never call any function from other categories 5443b491a90SEmanuele Giuseppe Esposito * (I/O, "I/O or GS", Global State) except this one, but can be invoked by 5453b491a90SEmanuele Giuseppe Esposito * all of them. 5463b491a90SEmanuele Giuseppe Esposito */ 5473b491a90SEmanuele Giuseppe Esposito 5483b491a90SEmanuele Giuseppe Esposito char *bdrv_perm_names(uint64_t perm); 5493b491a90SEmanuele Giuseppe Esposito uint64_t bdrv_qapi_perm_to_blk_perm(BlockPermission qapi_perm); 5503b491a90SEmanuele Giuseppe Esposito 5513b491a90SEmanuele Giuseppe Esposito void bdrv_init_with_whitelist(void); 5523b491a90SEmanuele Giuseppe Esposito bool bdrv_uses_whitelist(void); 5533b491a90SEmanuele Giuseppe Esposito int bdrv_is_whitelisted(BlockDriver *drv, bool read_only); 5543b491a90SEmanuele Giuseppe Esposito 5553b491a90SEmanuele Giuseppe Esposito int bdrv_parse_aio(const char *mode, int *flags); 5563b491a90SEmanuele Giuseppe Esposito int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough); 5573b491a90SEmanuele Giuseppe Esposito int bdrv_parse_discard_flags(const char *mode, int *flags); 5583b491a90SEmanuele Giuseppe Esposito 5593b491a90SEmanuele Giuseppe Esposito int path_has_protocol(const char *path); 5603b491a90SEmanuele Giuseppe Esposito int path_is_absolute(const char *path); 5613b491a90SEmanuele Giuseppe Esposito char *path_combine(const char *base_path, const char *filename); 5623b491a90SEmanuele Giuseppe Esposito 5633b491a90SEmanuele Giuseppe Esposito char *bdrv_get_full_backing_filename_from_filename(const char *backed, 5643b491a90SEmanuele Giuseppe Esposito const char *backing, 5653b491a90SEmanuele Giuseppe Esposito Error **errp); 5663b491a90SEmanuele Giuseppe Esposito 5673b491a90SEmanuele Giuseppe Esposito #endif /* BLOCK_COMMON_H */ 568