From: Li Qiang <liq3ea@gmail.com>
To: groug@kaod.org, qemu-devel@nongnu.org
Cc: liqiang6-s@360.cn, Li Qiang <liq3ea@gmail.com>
Subject: [Qemu-devel] [PATCH v2 3/3] 9pfs: add cleanup operation for proxy backend driver
Date: Mon, 14 Nov 2016 21:13:53 -0500 [thread overview]
Message-ID: <1479176033-36604-4-git-send-email-liq3ea@gmail.com> (raw)
In-Reply-To: <1479176033-36604-1-git-send-email-liq3ea@gmail.com>
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@gmail.com>
---
hw/9pfs/9p-proxy.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c
index f2417b7..4b22f57 100644
--- a/hw/9pfs/9p-proxy.c
+++ b/hw/9pfs/9p-proxy.c
@@ -1168,9 +1168,19 @@ static int proxy_init(FsContext *ctx)
return 0;
}
+static void proxy_cleanup(FsContext *ctx)
+{
+ V9fsProxy *proxy = ctx->private;
+ close(proxy->sockfd);
+ g_free(proxy->in_iovec.iov_base);
+ g_free(proxy->out_iovec.iov_base);
+ 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,
--
1.8.3.1
next prev parent reply other threads:[~2016-11-15 2:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-15 2:13 [Qemu-devel] [PATCH v2 0/3] 9pfs: add cleanup operation in handle/proxy backend Li Qiang
2016-11-15 2:13 ` [Qemu-devel] [PATCH v2 1/3] 9pfs: add cleanup operation in FileOperations Li Qiang
2016-11-15 2:13 ` [Qemu-devel] [PATCH v2 2/3] 9pfs: add cleanup operation for handle backend driver Li Qiang
2016-11-15 10:22 ` Greg Kurz
2016-11-15 2:13 ` Li Qiang [this message]
2016-11-15 10:26 ` [Qemu-devel] [PATCH v2 3/3] 9pfs: add cleanup operation for proxy " Greg Kurz
2016-11-15 10:16 ` [Qemu-devel] [PATCH v2 0/3] 9pfs: add cleanup operation in handle/proxy backend Greg Kurz
2016-11-15 10:21 ` Li Qiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479176033-36604-4-git-send-email-liq3ea@gmail.com \
--to=liq3ea@gmail.com \
--cc=groug@kaod.org \
--cc=liqiang6-s@360.cn \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).