Patchwork [12/12] nbd: add nbd_export_get_blockdev

login
register
mail settings
Submitter Paolo Bonzini
Date Sept. 19, 2012, 1:49 p.m.
Message ID <1348062596-30446-13-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/185059/
State New
Headers show

Comments

Paolo Bonzini - Sept. 19, 2012, 1:49 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 nbd.c | 7 ++++++-
 nbd.h | 2 ++
 2 file modificati, 8 inserzioni(+). 1 rimozione(-)

Patch

diff --git a/nbd.c b/nbd.c
index 6f60dcf..57edfde 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 f0edb9c..344f05b 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);