Patchwork [04/12] nbd: make refcount interface public

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

Comments

Paolo Bonzini - Sept. 19, 2012, 1:49 p.m.
After the next patch, the close callback will have to release its
reference.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 nbd.c | 4 ++--
 nbd.h | 3 +++
 2 file modificati, 5 inserzioni(+), 2 rimozioni(-)

Patch

diff --git a/nbd.c b/nbd.c
index 83200bd..4aeb80a 100644
--- a/nbd.c
+++ b/nbd.c
@@ -647,12 +647,12 @@  static ssize_t nbd_send_reply(int csock, struct nbd_reply *reply)
 
 #define MAX_NBD_REQUESTS 16
 
-static void nbd_client_get(NBDClient *client)
+void nbd_client_get(NBDClient *client)
 {
     client->refcount++;
 }
 
-static void nbd_client_put(NBDClient *client)
+void nbd_client_put(NBDClient *client)
 {
     if (--client->refcount == 0) {
         g_free(client);
diff --git a/nbd.h b/nbd.h
index 40d58d3..a9038dc 100644
--- a/nbd.h
+++ b/nbd.h
@@ -81,7 +81,10 @@  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);
+
 NBDClient *nbd_client_new(NBDExport *exp, int csock,
                           void (*close)(NBDClient *));
+void nbd_client_get(NBDClient *client);
+void nbd_client_put(NBDClient *client);
 
 #endif