From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1ywU-0005FY-Fw for qemu-devel@nongnu.org; Fri, 09 Sep 2011 07:08:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1ywT-0002ip-Ma for qemu-devel@nongnu.org; Fri, 09 Sep 2011 07:08:18 -0400 Received: from e28smtp07.in.ibm.com ([122.248.162.7]:35225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1ywS-0002fb-0k for qemu-devel@nongnu.org; Fri, 09 Sep 2011 07:08:17 -0400 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by e28smtp07.in.ibm.com (8.14.4/8.13.1) with ESMTP id p89B8BcG016587 for ; Fri, 9 Sep 2011 16:38:11 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p89B8APV2695334 for ; Fri, 9 Sep 2011 16:38:10 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p89B8AOb005082 for ; Fri, 9 Sep 2011 21:08:10 +1000 From: "Aneesh Kumar K.V" Date: Fri, 9 Sep 2011 16:37:13 +0530 Message-Id: <1315566433-16202-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com> In-Reply-To: <1315566433-16202-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1315566433-16202-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH 3/3] hw/9pfs: Add synth fs test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, "Aneesh Kumar K.V" Signed-off-by: Aneesh Kumar K.V --- hw/9pfs/virtio-9p-synth.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/hw/9pfs/virtio-9p-synth.c b/hw/9pfs/virtio-9p-synth.c index 72a916c..cbf74e4 100644 --- a/hw/9pfs/virtio-9p-synth.c +++ b/hw/9pfs/virtio-9p-synth.c @@ -517,8 +517,21 @@ static int v9fs_synth_unlinkat(FsContext *ctx, V9fsPath *dir, return -1; } +static ssize_t my_test_read(void *in_buf, int len, off_t offset, void *arg) +{ + int copy_len; + char buff[] = "Hello World\n"; + if (offset >= sizeof(buff)) { + return 0; + } + copy_len = MIN(len, sizeof(buff)); + memcpy(in_buf, buff + offset, copy_len); + return copy_len; +} + static int v9fs_synth_init(FsContext *ctx) { + V9fsSynthNode *node; pthread_rwlockattr_t rwlockattr; QLIST_INIT(&v9fs_synth_root.child); @@ -533,6 +546,12 @@ static int v9fs_synth_init(FsContext *ctx) /* Mark the subsystem is ready for use */ v9fs_synth_fs = 1; + + /** create some new files as test */ + qemu_v9fs_synth_mkdir(NULL, 0777, "test", &node); + qemu_v9fs_synth_mkdir(&v9fs_synth_root, 0777, "test2", &node); + qemu_v9fs_synth_add_file(node, 0777, "testfile", + my_test_read, NULL, NULL); return 0; } -- 1.7.4.1