From patchwork Mon Aug 8 17:03:55 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: 108996 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 6CB2BB6F72 for ; Tue, 9 Aug 2011 03:05:06 +1000 (EST) Received: from localhost ([::1]:35456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTG5-0006bM-3T for incoming@patchwork.ozlabs.org; Mon, 08 Aug 2011 13:04:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]:43368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTFv-0006ay-NT for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:04:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqTFt-0001dQ-8Z for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:04:47 -0400 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:36587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTFs-0001cm-JW for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:04:45 -0400 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp07.au.ibm.com (8.14.4/8.13.1) with ESMTP id p78H4g7K024511 for ; Tue, 9 Aug 2011 03:04:42 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p78H4fo41347730 for ; Tue, 9 Aug 2011 03:04:41 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p78H4fYf029552 for ; Tue, 9 Aug 2011 03:04:41 +1000 Received: from skywalker.ibm.com ([9.80.65.225]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p78H4Pc5029309; Tue, 9 Aug 2011 03:04:39 +1000 From: "Aneesh Kumar K.V" To: qemu-devel@nongnu.org Date: Mon, 8 Aug 2011 22:33:55 +0530 Message-Id: <1312823054-28331-8-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1312823054-28331-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1312823054-28331-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.140 Cc: aliguori@us.ibm.com, "Venkateswararao Jujjuri \(JV\)" , "Aneesh Kumar K.V" Subject: [Qemu-devel] [PATCH -V4 07/26] [virtio-9p] Remove post functions for v9fs_mkdir. 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 | 52 ++++++++++++-------------------------------------- 1 files changed, 13 insertions(+), 39 deletions(-) diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index a68ac3f..bb0fb54 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -3307,40 +3307,6 @@ out: qemu_free(vs); } -static void v9fs_mkdir_post_lstat(V9fsState *s, V9fsMkState *vs, int err) -{ - if (err == -1) { - err = -errno; - goto out; - } - - stat_to_qid(&vs->stbuf, &vs->qid); - vs->offset += pdu_marshal(vs->pdu, vs->offset, "Q", &vs->qid); - err = vs->offset; -out: - complete_pdu(s, vs->pdu, err); - v9fs_string_free(&vs->fullname); - v9fs_string_free(&vs->name); - qemu_free(vs); -} - -static void v9fs_mkdir_post_mkdir(V9fsState *s, V9fsMkState *vs, int err) -{ - if (err == -1) { - err = -errno; - goto out; - } - - err = v9fs_do_lstat(s, &vs->fullname, &vs->stbuf); - v9fs_mkdir_post_lstat(s, vs, err); - return; -out: - complete_pdu(s, vs->pdu, err); - v9fs_string_free(&vs->fullname); - v9fs_string_free(&vs->name); - qemu_free(vs); -} - static void v9fs_mkdir(void *opaque) { V9fsPDU *pdu = opaque; @@ -3358,19 +3324,27 @@ static void v9fs_mkdir(void *opaque) v9fs_string_init(&vs->fullname); pdu_unmarshal(vs->pdu, vs->offset, "dsdd", &fid, &vs->name, &mode, - &gid); + &gid); fidp = lookup_fid(s, fid); if (fidp == NULL) { err = -ENOENT; goto out; } - v9fs_string_sprintf(&vs->fullname, "%s/%s", fidp->path.data, vs->name.data); err = v9fs_do_mkdir(s, vs->fullname.data, mode, fidp->uid, gid); - v9fs_mkdir_post_mkdir(s, vs, err); - return; - + if (err == -1) { + err = -errno; + goto out; + } + err = v9fs_do_lstat(s, &vs->fullname, &vs->stbuf); + if (err == -1) { + err = -errno; + goto out; + } + stat_to_qid(&vs->stbuf, &vs->qid); + vs->offset += pdu_marshal(vs->pdu, vs->offset, "Q", &vs->qid); + err = vs->offset; out: complete_pdu(s, vs->pdu, err); v9fs_string_free(&vs->fullname);