1 /* 2 * Block layer I/O functions 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 * THE SOFTWARE. 23 */ 24 25 #ifndef BLOCK_COROUTINES_INT_H 26 #define BLOCK_COROUTINES_INT_H 27 28 #include "block/block_int.h" 29 30 /* For blk_bs() in generated block/block-gen.c */ 31 #include "sysemu/block-backend.h" 32 33 int coroutine_fn bdrv_co_check(BlockDriverState *bs, 34 BdrvCheckResult *res, BdrvCheckMode fix); 35 int coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs, Error **errp); 36 37 int generated_co_wrapper 38 bdrv_preadv(BdrvChild *child, int64_t offset, unsigned int bytes, 39 QEMUIOVector *qiov, BdrvRequestFlags flags); 40 int generated_co_wrapper 41 bdrv_pwritev(BdrvChild *child, int64_t offset, unsigned int bytes, 42 QEMUIOVector *qiov, BdrvRequestFlags flags); 43 44 int coroutine_fn 45 bdrv_co_common_block_status_above(BlockDriverState *bs, 46 BlockDriverState *base, 47 bool include_base, 48 bool want_zero, 49 int64_t offset, 50 int64_t bytes, 51 int64_t *pnum, 52 int64_t *map, 53 BlockDriverState **file, 54 int *depth); 55 int generated_co_wrapper 56 bdrv_common_block_status_above(BlockDriverState *bs, 57 BlockDriverState *base, 58 bool include_base, 59 bool want_zero, 60 int64_t offset, 61 int64_t bytes, 62 int64_t *pnum, 63 int64_t *map, 64 BlockDriverState **file, 65 int *depth); 66 67 int coroutine_fn bdrv_co_readv_vmstate(BlockDriverState *bs, 68 QEMUIOVector *qiov, int64_t pos); 69 int coroutine_fn bdrv_co_writev_vmstate(BlockDriverState *bs, 70 QEMUIOVector *qiov, int64_t pos); 71 72 int generated_co_wrapper 73 nbd_do_establish_connection(BlockDriverState *bs, Error **errp); 74 int coroutine_fn 75 nbd_co_do_establish_connection(BlockDriverState *bs, Error **errp); 76 77 78 int generated_co_wrapper 79 blk_do_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, 80 QEMUIOVector *qiov, BdrvRequestFlags flags); 81 int coroutine_fn 82 blk_co_do_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, 83 QEMUIOVector *qiov, BdrvRequestFlags flags); 84 85 86 int generated_co_wrapper 87 blk_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes, 88 QEMUIOVector *qiov, size_t qiov_offset, 89 BdrvRequestFlags flags); 90 int coroutine_fn 91 blk_co_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes, 92 QEMUIOVector *qiov, size_t qiov_offset, 93 BdrvRequestFlags flags); 94 95 int generated_co_wrapper 96 blk_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf); 97 int coroutine_fn 98 blk_co_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf); 99 100 int generated_co_wrapper 101 blk_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes); 102 int coroutine_fn 103 blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes); 104 105 int generated_co_wrapper blk_do_flush(BlockBackend *blk); 106 int coroutine_fn blk_co_do_flush(BlockBackend *blk); 107 108 #endif /* BLOCK_COROUTINES_INT_H */ 109