From 1743b515860ef645b285908ee367c5e343e0020c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 19 Sep 2011 14:33:23 +0200 Subject: qemu-nbd: move client handling to nbd.c This patch sets up the fd handler in nbd.c instead of qemu-nbd.c. It introduces NBDClient, which wraps the arguments to nbd_trip in a single structure, so that we can add a notifier to it. This way, qemu-nbd can know about disconnections. Signed-off-by: Paolo Bonzini --- nbd.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nbd.h') diff --git a/nbd.h b/nbd.h index c77c2fd..a8382f0 100644 --- a/nbd.h +++ b/nbd.h @@ -76,11 +76,12 @@ int nbd_client(int fd); int nbd_disconnect(int fd); typedef struct NBDExport NBDExport; +typedef struct NBDClient NBDClient; 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); +NBDClient *nbd_client_new(NBDExport *exp, int csock, + void (*close)(NBDClient *)); #endif -- cgit v1.1