aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-09-18 14:31:44 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-09-19 15:26:31 +0200
commit125afda8cbd228583c1e7c32c0f86eeb8de39c73 (patch)
tree03ba980b63821bb760ba4e88722cb8639cafde4f
parent6b8c01e781524ab713faa31a4fb5b20a745f638a (diff)
nbd: add nbd_export_get_blockdev
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--nbd.c7
-rw-r--r--nbd.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/nbd.c b/nbd.c
index 6f60dcfce5..57edfde0c9 100644
--- a/nbd.c
+++ b/nbd.c
@@ -914,6 +914,7 @@ void nbd_export_close(NBDExport *exp)
QTAILQ_FOREACH_SAFE(client, &exp->clients, next, next) {
nbd_client_close(client);
}
+ nbd_export_set_name(exp, NULL);
nbd_export_put(exp);
}
@@ -948,13 +949,17 @@ void nbd_export_put(NBDExport *exp)
}
}
+BlockDriverState *nbd_export_get_blockdev(NBDExport *exp)
+{
+ return exp->bs;
+}
+
void nbd_export_close_all(void)
{
NBDExport *exp, *next;
QTAILQ_FOREACH_SAFE(exp, &exports, next, next) {
nbd_export_close(exp);
- nbd_export_set_name(exp, NULL);
}
}
diff --git a/nbd.h b/nbd.h
index f0edb9cdf1..344f05b794 100644
--- a/nbd.h
+++ b/nbd.h
@@ -85,6 +85,8 @@ void nbd_export_close(NBDExport *exp);
void nbd_export_get(NBDExport *exp);
void nbd_export_put(NBDExport *exp);
+BlockDriverState *nbd_export_get_blockdev(NBDExport *exp);
+
NBDExport *nbd_export_find(const char *name);
void nbd_export_set_name(NBDExport *exp, const char *name);
void nbd_export_close_all(void);