From patchwork Tue May 17 19:43:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jvrao X-Patchwork-Id: 96032 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 14CB9B6EEC for ; Wed, 18 May 2011 05:53:33 +1000 (EST) Received: from localhost ([::1]:46952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMQKg-0000pF-G1 for incoming@patchwork.ozlabs.org; Tue, 17 May 2011 15:53:30 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMQCN-00033I-8F for qemu-devel@nongnu.org; Tue, 17 May 2011 15:44:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMQCM-0002AK-8J for qemu-devel@nongnu.org; Tue, 17 May 2011 15:44:55 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:52576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMQCM-0002AG-19 for qemu-devel@nongnu.org; Tue, 17 May 2011 15:44:54 -0400 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e31.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p4HJST2c003603 for ; Tue, 17 May 2011 13:28:29 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p4HJiTXt086000 for ; Tue, 17 May 2011 13:44:31 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p4HDi0xq018867 for ; Tue, 17 May 2011 07:44:00 -0600 Received: from oc6675851006.ibm.com (dyn9047029068.beaverton.ibm.com [9.47.29.68]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p4HDhZkZ016491; Tue, 17 May 2011 07:43:58 -0600 From: "Venkateswararao Jujjuri (JV)" To: qemu-devel@nongnu.org Date: Tue, 17 May 2011 12:43:46 -0700 Message-Id: <1305661431-21289-21-git-send-email-jvrao@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1305661431-21289-1-git-send-email-jvrao@linux.vnet.ibm.com> References: <1305661431-21289-1-git-send-email-jvrao@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 32.97.110.149 Cc: aliguori@us.ibm.com, "Venkateswararao Jujjuri \"" , stefanha@linux.vnet.ibm.com, "Aneesh Kumar K.V" Subject: [Qemu-devel] [V2 20/25] hw/9pfs: Add yield support to mknod coroutine 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: Aneesh Kumar K.V Signed-off-by: Aneesh Kumar K.V Signed-off-by: Venkateswararao Jujjuri " --- hw/9pfs/cofs.c | 21 +++++++++++++++++++++ hw/9pfs/virtio-9p-coth.h | 2 ++ 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c index 4297788..af7b78e 100644 --- a/hw/9pfs/cofs.c +++ b/hw/9pfs/cofs.c @@ -118,3 +118,24 @@ int v9fs_co_truncate(V9fsState *s, V9fsString *path, off_t size) }); return err; } + +int v9fs_co_mknod(V9fsState *s, V9fsString *path, uid_t uid, + gid_t gid, dev_t dev, mode_t mode) +{ + int err; + FsCred cred; + + cred_init(&cred); + cred.fc_uid = uid; + cred.fc_gid = gid; + cred.fc_mode = mode; + cred.fc_rdev = dev; + v9fs_co_run_in_worker( + { + err = s->ops->mknod(&s->ctx, path->data, &cred); + if (err < 0) { + err = -errno; + } + }); + return err; +} diff --git a/hw/9pfs/virtio-9p-coth.h b/hw/9pfs/virtio-9p-coth.h index eb0c99a..d023683 100644 --- a/hw/9pfs/virtio-9p-coth.h +++ b/hw/9pfs/virtio-9p-coth.h @@ -71,4 +71,6 @@ extern int v9fs_co_truncate(V9fsState *, V9fsString *, off_t); extern int v9fs_co_llistxattr(V9fsState *, V9fsString *, void *, size_t); extern int v9fs_co_lgetxattr(V9fsState *, V9fsString *, V9fsString *, void *, size_t); +extern int v9fs_co_mknod(V9fsState *, V9fsString *, uid_t, + gid_t, dev_t, mode_t); #endif