2 * Block layer I/O functions
4 * Copyright (c) 2003 Fabrice Bellard
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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
25 #ifndef BLOCK_COROUTINES_H
26 #define BLOCK_COROUTINES_H
28 #include "block/block_int.h"
30 /* For blk_bs() in generated block/block-gen.c */
31 #include "sysemu/block-backend.h"
34 * I/O API functions. These functions are thread-safe.
36 * See include/block/block-io.h for more information about
40 int coroutine_fn GRAPH_RDLOCK
41 bdrv_co_check(BlockDriverState
*bs
, BdrvCheckResult
*res
, BdrvCheckMode fix
);
43 int coroutine_fn GRAPH_RDLOCK
44 bdrv_co_invalidate_cache(BlockDriverState
*bs
, Error
**errp
);
47 bdrv_co_common_block_status_above(BlockDriverState
*bs
,
48 BlockDriverState
*base
,
55 BlockDriverState
**file
,
58 int coroutine_fn GRAPH_RDLOCK
59 bdrv_co_readv_vmstate(BlockDriverState
*bs
, QEMUIOVector
*qiov
, int64_t pos
);
61 int coroutine_fn GRAPH_RDLOCK
62 bdrv_co_writev_vmstate(BlockDriverState
*bs
, QEMUIOVector
*qiov
, int64_t pos
);
65 nbd_co_do_establish_connection(BlockDriverState
*bs
, bool blocking
,
70 * "I/O or GS" API functions. These functions can run without
71 * the BQL, but only in one specific iothread/main loop.
73 * See include/block/block-io.h for more information about
74 * the "I/O or GS" API.
77 int co_wrapper_mixed_bdrv_rdlock
78 bdrv_common_block_status_above(BlockDriverState
*bs
,
79 BlockDriverState
*base
,
86 BlockDriverState
**file
,
89 nbd_do_establish_connection(BlockDriverState
*bs
, bool blocking
, Error
**errp
);
91 #endif /* BLOCK_COROUTINES_H */