5 #include "block/block_int.h"
6 #include "io/channel-socket.h"
8 #define MAX_NBD_REQUESTS 16
12 uint64_t offset
; /* original offset of the request */
13 bool receiving
; /* waiting for connection_co? */
16 typedef struct NBDClientSession
{
17 QIOChannelSocket
*sioc
; /* The master data channel */
18 QIOChannel
*ioc
; /* The current I/O channel which may differ (eg TLS) */
23 Coroutine
*connection_co
;
26 NBDClientRequest requests
[MAX_NBD_REQUESTS
];
32 NBDClientSession
*nbd_get_client_session(BlockDriverState
*bs
);
34 int nbd_client_init(BlockDriverState
*bs
,
36 const char *export_name
,
37 QCryptoTLSCreds
*tlscreds
,
39 const char *x_dirty_bitmap
,
41 void nbd_client_close(BlockDriverState
*bs
);
43 int nbd_client_co_pdiscard(BlockDriverState
*bs
, int64_t offset
, int bytes
);
44 int nbd_client_co_flush(BlockDriverState
*bs
);
45 int nbd_client_co_pwritev(BlockDriverState
*bs
, uint64_t offset
,
46 uint64_t bytes
, QEMUIOVector
*qiov
, int flags
);
47 int nbd_client_co_pwrite_zeroes(BlockDriverState
*bs
, int64_t offset
,
48 int bytes
, BdrvRequestFlags flags
);
49 int nbd_client_co_preadv(BlockDriverState
*bs
, uint64_t offset
,
50 uint64_t bytes
, QEMUIOVector
*qiov
, int flags
);
52 void nbd_client_detach_aio_context(BlockDriverState
*bs
);
53 void nbd_client_attach_aio_context(BlockDriverState
*bs
,
54 AioContext
*new_context
);
56 int coroutine_fn
nbd_client_co_block_status(BlockDriverState
*bs
,
58 int64_t offset
, int64_t bytes
,
59 int64_t *pnum
, int64_t *map
,
60 BlockDriverState
**file
);
62 #endif /* NBD_CLIENT_H */