@@ -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;
}
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> --- hw/9pfs/virtio-9p-synth.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)