From patchwork Mon Aug 8 17:06:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 109007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1F1A7B6F6F for ; Tue, 9 Aug 2011 03:09:03 +1000 (EST) Received: from localhost ([::1]:59868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTK0-0006ys-Ez for incoming@patchwork.ozlabs.org; Mon, 08 Aug 2011 13:09:00 -0400 Received: from eggs.gnu.org ([140.186.70.92]:60157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTJq-0006mr-Nc for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:08:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqTJp-0002Ss-W2 for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:08:50 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:58799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTJp-0002Sl-D7 for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:08:49 -0400 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp06.au.ibm.com (8.14.4/8.13.1) with ESMTP id p78H7u9C021543 for ; Tue, 9 Aug 2011 03:07:56 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p78H6bQb1257544 for ; Tue, 9 Aug 2011 03:06:37 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p78H7Wkw027098 for ; Tue, 9 Aug 2011 03:07:33 +1000 Received: from skywalker.ibm.com ([9.80.65.225]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p78H6wk2025812; Tue, 9 Aug 2011 03:07:31 +1000 From: "Aneesh Kumar K.V" To: qemu-devel@nongnu.org Date: Mon, 8 Aug 2011 22:36:45 +0530 Message-Id: <1312823215-28675-19-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1312823215-28675-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1312823215-28675-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 202.81.31.148 Cc: aliguori@us.ibm.com, "Venkateswararao Jujjuri \(JV\)" , "Aneesh Kumar K.V" Subject: [Qemu-devel] [PATCH -V4 18/28] [virtio-9p] Remove post functions for v9fs_symlink X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Venkateswararao Jujjuri (JV) Signed-off-by: Venkateswararao Jujjuri " Signed-off-by: Aneesh Kumar K.V --- hw/9pfs/virtio-9p.c | 47 +++++++++++++++-------------------------------- 1 files changed, 15 insertions(+), 32 deletions(-) diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index 68b18d6..35de63a 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -2119,33 +2119,6 @@ out: v9fs_string_free(&fullname); } -static void v9fs_post_symlink(V9fsState *s, V9fsSymlinkState *vs, int err) -{ - if (err == 0) { - stat_to_qid(&vs->stbuf, &vs->qid); - vs->offset += pdu_marshal(vs->pdu, vs->offset, "Q", &vs->qid); - err = vs->offset; - } else { - err = -errno; - } - complete_pdu(s, vs->pdu, err); - v9fs_string_free(&vs->name); - v9fs_string_free(&vs->symname); - v9fs_string_free(&vs->fullname); - qemu_free(vs); -} - -static void v9fs_symlink_post_do_symlink(V9fsState *s, V9fsSymlinkState *vs, - int err) -{ - if (err) { - goto out; - } - err = v9fs_do_lstat(s, &vs->fullname, &vs->stbuf); -out: - v9fs_post_symlink(s, vs, err); -} - static void v9fs_symlink(void *opaque) { V9fsPDU *pdu = opaque; @@ -2171,16 +2144,26 @@ static void v9fs_symlink(void *opaque) } v9fs_string_sprintf(&vs->fullname, "%s/%s", vs->dfidp->path.data, - vs->name.data); + vs->name.data); err = v9fs_do_symlink(s, vs->dfidp, vs->symname.data, - vs->fullname.data, gid); - v9fs_symlink_post_do_symlink(s, vs, err); - return; - + vs->fullname.data, gid); + if (err < 0) { + err = -errno; + goto out; + } + err = v9fs_do_lstat(s, &vs->fullname, &vs->stbuf); + if (err == 0) { + stat_to_qid(&vs->stbuf, &vs->qid); + vs->offset += pdu_marshal(vs->pdu, vs->offset, "Q", &vs->qid); + err = vs->offset; + } else { + err = -errno; + } out: complete_pdu(s, vs->pdu, err); v9fs_string_free(&vs->name); v9fs_string_free(&vs->symname); + v9fs_string_free(&vs->fullname); qemu_free(vs); }