[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH-V2 10/24] [virtio-9p] Implement TLINK for 9P2000.L
From: |
Venkateswararao Jujjuri (JV) |
Subject: |
[Qemu-devel] [PATCH-V2 10/24] [virtio-9p] Implement TLINK for 9P2000.L |
Date: |
Wed, 21 Jul 2010 09:04:45 -0700 |
Create a Hardlink.
SYNOPSIS
size[4] Tlink tag[2] dfid[4] oldfid[4] newpath[s]
size[4] Rlink tag[2]
DESCRIPTION
Create a link 'newpath' in directory pointed by dfid linking to oldfid path.
Signed-off-by: Venkateswararao Jujjuri <address@hidden>
---
hw/virtio-9p-debug.c | 9 +++++++++
hw/virtio-9p.c | 38 ++++++++++++++++++++++++++++++++++++++
hw/virtio-9p.h | 2 ++
3 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-9p-debug.c b/hw/virtio-9p-debug.c
index a880b13..2e61e9d 100644
--- a/hw/virtio-9p-debug.c
+++ b/hw/virtio-9p-debug.c
@@ -497,6 +497,15 @@ void pprint_pdu(V9fsPDU *pdu)
case P9_RCLUNK:
fprintf(llogfile, "RCLUNK: (");
break;
+ case P9_TLINK:
+ fprintf(llogfile, "TLINK: (");
+ pprint_int32(pdu, 0, &offset, "fid");
+ pprint_str(pdu, 0, &offset, ", oldpath");
+ pprint_str(pdu, 0, &offset, ", newpath");
+ break;
+ case P9_RLINK:
+ fprintf(llogfile, "RLINK: (");
+ break;
case P9_TREMOVE:
fprintf(llogfile, "TREMOVE: (");
pprint_int32(pdu, 0, &offset, "fid");
diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
index 76c875c..e2d841c 100644
--- a/hw/virtio-9p.c
+++ b/hw/virtio-9p.c
@@ -2307,6 +2307,43 @@ static void v9fs_flush(V9fsState *s, V9fsPDU *pdu)
complete_pdu(s, pdu, 7);
}
+static void v9fs_link(V9fsState *s, V9fsPDU *pdu)
+{
+ int32_t dfid, oldfid;
+ V9fsFidState *dfidp, *oldfidp;
+ V9fsString name, fullname;
+ size_t offset = 7;
+ int err = 0;
+
+ v9fs_string_init(&fullname);
+
+ pdu_unmarshal(pdu, offset, "dds", &dfid, &oldfid, &name);
+
+ dfidp = lookup_fid(s, dfid);
+ if (dfidp == NULL) {
+ err = -errno;
+ goto out;
+ }
+
+ oldfidp = lookup_fid(s, oldfid);
+ if (oldfidp == NULL) {
+ err = -errno;
+ goto out;
+ }
+
+ v9fs_string_sprintf(&fullname, "%s/%s", dfidp->path.data, name.data);
+ err = offset;
+ err = v9fs_do_link(s, &oldfidp->path, &fullname);
+ if (err) {
+ err = -errno;
+ }
+ v9fs_string_free(&fullname);
+
+out:
+ v9fs_string_free(&name);
+ complete_pdu(s, pdu, err);
+}
+
static void v9fs_remove_post_remove(V9fsState *s, V9fsRemoveState *vs,
int err)
{
@@ -2681,6 +2718,7 @@ static pdu_handler_t *pdu_handlers[] = {
[P9_TAUTH] = v9fs_auth,
#endif
[P9_TFLUSH] = v9fs_flush,
+ [P9_TLINK] = v9fs_link,
[P9_TCREATE] = v9fs_create,
[P9_TWRITE] = v9fs_write,
[P9_TWSTAT] = v9fs_wstat,
diff --git a/hw/virtio-9p.h b/hw/virtio-9p.h
index ebf44a7..d48776f 100644
--- a/hw/virtio-9p.h
+++ b/hw/virtio-9p.h
@@ -21,6 +21,8 @@ enum {
P9_RSETATTR,
P9_TREADDIR = 40,
P9_RREADDIR,
+ P9_TLINK = 70,
+ P9_RLINK,
P9_TVERSION = 100,
P9_RVERSION,
P9_TAUTH = 102,
--
1.6.5.2
- [Qemu-devel] [PATCH-V2 00/24] Consolidated VirtFS work, Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 02/24] qemu: virtio-9p: Implement statfs support in server, Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 01/24] qemu: virtio-9p: Recognize 9P2000.L protocol, Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 11/24] [virtio-9p] Define and implement TSYMLINK for 9P2000.L, Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 10/24] [virtio-9p] Implement TLINK for 9P2000.L,
Venkateswararao Jujjuri (JV) <=
- [Qemu-devel] [PATCH-V2 19/24] virtio-9p: Implement TXATTRCREATE, Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 18/24] virtio-9p: Implement TXATTRWALK, Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 03/24] virtio-9p: Return correct error from v9fs_remove, Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 06/24] virtio-9p: getattr server implementation for 9P2000.L protocol., Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 17/24] virtio-9p: Add fidtype so that we can do type specific operation, Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 08/24] [virtio-9p] Make v9fs_do_utimensat accept timespec structures instead of v9stat., Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 16/24] qemu: virtio-9p: Implement LOPEN, Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 09/24] virtio-9p: Implement server side of setattr for 9P2000.L protocol., Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 24/24] virtio-9p: Fix formatting issues in v9fs_wstat_post_chown(), Venkateswararao Jujjuri (JV), 2010/07/21
- [Qemu-devel] [PATCH-V2 23/24] virtio-9p: Fix the memset usage, Venkateswararao Jujjuri (JV), 2010/07/21