4 #include "qemu-common.h"
6 #include "block/block_int.h"
8 /* #define DEBUG_NBD */
10 #if defined(DEBUG_NBD)
11 #define logout(fmt, ...) \
12 fprintf(stderr, "nbd\t%-24s" fmt, __func__, ##__VA_ARGS__)
14 #define logout(fmt, ...) ((void)0)
17 #define MAX_NBD_REQUESTS 16
19 typedef struct NbdClientSession {
27 Coroutine *send_coroutine;
30 Coroutine *recv_coroutine[MAX_NBD_REQUESTS];
31 struct nbd_reply reply;
36 NbdClientSession *nbd_get_client_session(BlockDriverState *bs);
38 int nbd_client_init(BlockDriverState *bs, int sock, const char *export_name,
40 void nbd_client_close(BlockDriverState *bs);
42 int nbd_client_co_discard(BlockDriverState *bs, int64_t sector_num,
44 int nbd_client_co_flush(BlockDriverState *bs);
45 int nbd_client_co_writev(BlockDriverState *bs, int64_t sector_num,
46 int nb_sectors, QEMUIOVector *qiov);
47 int nbd_client_co_readv(BlockDriverState *bs, int64_t sector_num,
48 int nb_sectors, QEMUIOVector *qiov);
50 void nbd_client_detach_aio_context(BlockDriverState *bs);
51 void nbd_client_attach_aio_context(BlockDriverState *bs,
52 AioContext *new_context);
54 #endif /* NBD_CLIENT_H */