From patchwork Mon Aug 8 17:06:34 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: 109006 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 6BAC4B6F6F for ; Tue, 9 Aug 2011 03:09:00 +1000 (EST) Received: from localhost ([::1]:59796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTJx-0006tF-Oy for incoming@patchwork.ozlabs.org; Mon, 08 Aug 2011 13:08:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]:59685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTJ7-0005uN-Bg for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:08:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqTJ5-0002Dk-Nt for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:08:05 -0400 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:55389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTJ5-00023H-2l for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:08:03 -0400 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp01.au.ibm.com (8.14.4/8.13.1) with ESMTP id p78H2di5027571 for ; Tue, 9 Aug 2011 03:02:39 +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 p78H6IrO1552486 for ; Tue, 9 Aug 2011 03:06:18 +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 p78H7D2d026403 for ; Tue, 9 Aug 2011 03:07:13 +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 p78H6wjp025812; Tue, 9 Aug 2011 03:07:11 +1000 From: "Aneesh Kumar K.V" To: qemu-devel@nongnu.org Date: Mon, 8 Aug 2011 22:36:34 +0530 Message-Id: <1312823215-28675-8-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.143 Cc: aliguori@us.ibm.com, "Venkateswararao Jujjuri \(JV\)" , "Aneesh Kumar K.V" Subject: [Qemu-devel] [PATCH -V4 07/28] [virtio-9p] Remove post functions for v9fs_lcreate 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 | 79 +++++++++++++++----------------------------------- 1 files changed, 24 insertions(+), 55 deletions(-) diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index c10ee0a..90636c3 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -1607,57 +1607,6 @@ out: complete_pdu(s, pdu, err); } -static void v9fs_post_lcreate(V9fsState *s, V9fsLcreateState *vs, int err) -{ - if (err == 0) { - v9fs_string_copy(&vs->fidp->path, &vs->fullname); - stat_to_qid(&vs->stbuf, &vs->qid); - vs->offset += pdu_marshal(vs->pdu, vs->offset, "Qd", &vs->qid, - vs->iounit); - err = vs->offset; - } else { - vs->fidp->fid_type = P9_FID_NONE; - err = -errno; - if (vs->fidp->fs.fd > 0) { - close(vs->fidp->fs.fd); - } - } - - complete_pdu(s, vs->pdu, err); - v9fs_string_free(&vs->name); - v9fs_string_free(&vs->fullname); - qemu_free(vs); -} - -static void v9fs_lcreate_post_get_iounit(V9fsState *s, V9fsLcreateState *vs, - int err) -{ - if (err) { - err = -errno; - goto out; - } - err = v9fs_do_lstat(s, &vs->fullname, &vs->stbuf); - -out: - v9fs_post_lcreate(s, vs, err); -} - -static void v9fs_lcreate_post_do_open2(V9fsState *s, V9fsLcreateState *vs, - int err) -{ - if (vs->fidp->fs.fd == -1) { - err = -errno; - goto out; - } - vs->fidp->fid_type = P9_FID_FILE; - vs->iounit = get_iounit(s, &vs->fullname); - v9fs_lcreate_post_get_iounit(s, vs, err); - return; - -out: - v9fs_post_lcreate(s, vs, err); -} - static void v9fs_lcreate(void *opaque) { V9fsPDU *pdu = opaque; @@ -1683,19 +1632,39 @@ static void v9fs_lcreate(void *opaque) } v9fs_string_sprintf(&vs->fullname, "%s/%s", vs->fidp->path.data, - vs->name.data); + vs->name.data); /* Ignore direct disk access hint until the server supports it. */ flags &= ~O_DIRECT; vs->fidp->fs.fd = v9fs_do_open2(s, vs->fullname.data, vs->fidp->uid, - gid, flags, mode); - v9fs_lcreate_post_do_open2(s, vs, err); - return; + gid, flags, mode); + if (vs->fidp->fs.fd == -1) { + err = -errno; + goto out; + } + vs->fidp->fid_type = P9_FID_FILE; + vs->iounit = get_iounit(s, &vs->fullname); + + err = v9fs_do_lstat(s, &vs->fullname, &vs->stbuf); + if (err == 0) { + v9fs_string_copy(&vs->fidp->path, &vs->fullname); + stat_to_qid(&vs->stbuf, &vs->qid); + vs->offset += pdu_marshal(vs->pdu, vs->offset, "Qd", &vs->qid, + vs->iounit); + err = vs->offset; + } else { + vs->fidp->fid_type = P9_FID_NONE; /*TODO:Why are we keeping this fid?*/ + err = -errno; + if (vs->fidp->fs.fd > 0) { + close(vs->fidp->fs.fd); + } + } out: complete_pdu(s, vs->pdu, err); v9fs_string_free(&vs->name); + v9fs_string_free(&vs->fullname); qemu_free(vs); }