From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O2Ptb-0003Zk-FW for qemu-devel@nongnu.org; Thu, 15 Apr 2010 10:18:19 -0400 Received: from [140.186.70.92] (port=50469 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2PtR-0003Ny-S1 for qemu-devel@nongnu.org; Thu, 15 Apr 2010 10:18:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O2Pmx-0000Hn-2X for qemu-devel@nongnu.org; Thu, 15 Apr 2010 10:11:40 -0400 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:39529) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O2Pmw-0000Gv-6n for qemu-devel@nongnu.org; Thu, 15 Apr 2010 10:11:26 -0400 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by e28smtp08.in.ibm.com (8.14.3/8.13.1) with ESMTP id o3FDHR89011616 for ; Thu, 15 Apr 2010 18:47:27 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o3FEBOd52621564 for ; Thu, 15 Apr 2010 19:41:24 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o3FEBOva030670 for ; Thu, 15 Apr 2010 19:41:24 +0530 From: "Aneesh Kumar K.V" Date: Thu, 15 Apr 2010 19:41:00 +0530 Message-Id: <1271340671-19558-11-git-send-email-aneesh.kumar@linux.vnet.ibm.com> In-Reply-To: <1271340671-19558-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1271340671-19558-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH -V5 10/21] virtio-9p: Add P9_TATTACH support. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: ericvh@gmail.com, aliguori@us.ibm.com, aneesh.kumar@linux.vnet.ibm.com From: Anthony Liguori Implement P9_TATTACH support. Signed-off-by: Anthony Liguori Signed-off-by: Aneesh Kumar K.V --- hw/virtio-9p.c | 33 +++++++++++++++++++++++++++++++-- 1 files changed, 31 insertions(+), 2 deletions(-) diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index ccc45a3..4ab4f9a 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -863,9 +863,38 @@ static void v9fs_version(V9fsState *s, V9fsPDU *pdu) static void v9fs_attach(V9fsState *s, V9fsPDU *pdu) { - if (debug_9p_pdu) { - pprint_pdu(pdu); + int32_t fid, afid, n_uname; + V9fsString uname, aname; + V9fsFidState *fidp; + V9fsQID qid; + size_t offset = 7; + ssize_t err; + + pdu_unmarshal(pdu, offset, "ddssd", &fid, &afid, &uname, &aname, &n_uname); + + fidp = alloc_fid(s, fid); + if (fidp == NULL) { + err = -EINVAL; + goto out; } + + fidp->uid = n_uname; + + v9fs_string_sprintf(&fidp->path, "%s", "/"); + err = fid_to_qid(s, fidp, &qid); + if (err) { + err = -EINVAL; + free_fid(s, fid); + goto out; + } + + offset += pdu_marshal(pdu, offset, "Q", &qid); + + err = offset; +out: + complete_pdu(s, pdu, err); + v9fs_string_free(&uname); + v9fs_string_free(&aname); } static void v9fs_stat(V9fsState *s, V9fsPDU *pdu) -- 1.7.0.4.360.g11766c