]> git.proxmox.com Git - mirror_qemu.git/blame - block/coroutines.h
Merge tag 'pull-riscv-to-apply-20231122' of https://github.com/alistair23/qemu into...
[mirror_qemu.git] / block / coroutines.h
CommitLineData
21c2283e
VSO
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
52581c71
MA
25#ifndef BLOCK_COROUTINES_H
26#define BLOCK_COROUTINES_H
21c2283e
VSO
27
28#include "block/block_int.h"
29
7d55a3bb
VSO
30/* For blk_bs() in generated block/block-gen.c */
31#include "sysemu/block-backend.h"
32
1581a70d
EGE
33/*
34 * I/O API functions. These functions are thread-safe.
35 *
36 * See include/block/block-io.h for more information about
37 * the I/O API.
38 */
39
1b3ff9fe
KW
40int coroutine_fn GRAPH_RDLOCK
41bdrv_co_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix);
42
43int coroutine_fn GRAPH_RDLOCK
44bdrv_co_invalidate_cache(BlockDriverState *bs, Error **errp);
21c2283e 45
7ff9579e 46int coroutine_fn GRAPH_RDLOCK
21c2283e
VSO
47bdrv_co_common_block_status_above(BlockDriverState *bs,
48 BlockDriverState *base,
3555a432 49 bool include_base,
21c2283e
VSO
50 bool want_zero,
51 int64_t offset,
52 int64_t bytes,
53 int64_t *pnum,
54 int64_t *map,
a92b1b06
EB
55 BlockDriverState **file,
56 int *depth);
1581a70d 57
1b3ff9fe
KW
58int coroutine_fn GRAPH_RDLOCK
59bdrv_co_readv_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos);
60
61int coroutine_fn GRAPH_RDLOCK
62bdrv_co_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos);
1581a70d 63
69aa0d37 64int coroutine_fn GRAPH_RDLOCK
8610b449
PB
65nbd_co_do_establish_connection(BlockDriverState *bs, bool blocking,
66 Error **errp);
1581a70d
EGE
67
68
1581a70d
EGE
69/*
70 * "I/O or GS" API functions. These functions can run without
71 * the BQL, but only in one specific iothread/main loop.
72 *
73 * See include/block/block-io.h for more information about
74 * the "I/O or GS" API.
75 */
76
90830f59 77int co_wrapper_mixed_bdrv_rdlock
21c2283e
VSO
78bdrv_common_block_status_above(BlockDriverState *bs,
79 BlockDriverState *base,
3555a432 80 bool include_base,
21c2283e
VSO
81 bool want_zero,
82 int64_t offset,
83 int64_t bytes,
84 int64_t *pnum,
85 int64_t *map,
a92b1b06
EB
86 BlockDriverState **file,
87 int *depth);
69aa0d37
EGE
88
89int co_wrapper_mixed_bdrv_rdlock
8610b449 90nbd_do_establish_connection(BlockDriverState *bs, bool blocking, Error **errp);
a71d597b 91
52581c71 92#endif /* BLOCK_COROUTINES_H */