[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen master] 9pfs: add cleanup operation for proxy backend driver



commit 898ae90a44551d25b8e956fd87372d303c82fe68
Author:     Li Qiang <liq3ea@xxxxxxxxx>
AuthorDate: Wed Nov 23 13:53:34 2016 +0100
Commit:     Greg Kurz <groug@xxxxxxxx>
CommitDate: Wed Nov 23 13:53:34 2016 +0100

    9pfs: add cleanup operation for proxy backend driver
    
    In the init operation of proxy backend dirver, it allocates a
    V9fsProxy struct and some other resources. We should free these
    resources when the 9pfs device is unrealized. This is what this
    patch does.
    
    Signed-off-by: Li Qiang <liq3ea@xxxxxxxxx>
    Reviewed-by: Greg Kurz <groug@xxxxxxxx>
    Signed-off-by: Greg Kurz <groug@xxxxxxxx>
---
 hw/9pfs/9p-proxy.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c
index f2417b7..f4aa7a9 100644
--- a/hw/9pfs/9p-proxy.c
+++ b/hw/9pfs/9p-proxy.c
@@ -1168,9 +1168,22 @@ static int proxy_init(FsContext *ctx)
     return 0;
 }
 
+static void proxy_cleanup(FsContext *ctx)
+{
+    V9fsProxy *proxy = ctx->private;
+
+    g_free(proxy->out_iovec.iov_base);
+    g_free(proxy->in_iovec.iov_base);
+    if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) {
+        close(proxy->sockfd);
+    }
+    g_free(proxy);
+}
+
 FileOperations proxy_ops = {
     .parse_opts   = proxy_parse_opts,
     .init         = proxy_init,
+    .cleanup      = proxy_cleanup,
     .lstat        = proxy_lstat,
     .readlink     = proxy_readlink,
     .close        = proxy_close,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.