diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2011-09-19 14:03:37 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2011-12-22 11:53:58 +0100 |
commit | af49bbbe78b16673cea13fea7f4d7d3433bf2646 (patch) | |
tree | 371c77c1d9ca3e4afa27903a5d57d16b374670c2 /nbd.h | |
parent | a030b347aaa84e2d1b42c9cb2bc9e2d8bec50046 (diff) |
qemu-nbd: introduce NBDExport
Wrap the common parameters of nbd_trip and nbd_negotiate in a
single opaque struct.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'nbd.h')
-rw-r--r-- | nbd.h | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -67,15 +67,20 @@ int tcp_socket_incoming_spec(const char *address_and_port); int unix_socket_outgoing(const char *path); int unix_socket_incoming(const char *path); -int nbd_negotiate(int csock, off_t size, uint32_t flags); int nbd_receive_negotiate(int csock, const char *name, uint32_t *flags, off_t *size, size_t *blocksize); int nbd_init(int fd, int csock, uint32_t flags, off_t size, size_t blocksize); int nbd_send_request(int csock, struct nbd_request *request); int nbd_receive_reply(int csock, struct nbd_reply *reply); -int nbd_trip(BlockDriverState *bs, int csock, off_t size, uint64_t dev_offset, - uint32_t nbdflags, uint8_t *data); int nbd_client(int fd); int nbd_disconnect(int fd); +typedef struct NBDExport NBDExport; + +NBDExport *nbd_export_new(BlockDriverState *bs, off_t dev_offset, + off_t size, uint32_t nbdflags); +void nbd_export_close(NBDExport *exp); +int nbd_negotiate(NBDExport *exp, int csock); +int nbd_trip(NBDExport *exp, int csock); + #endif |