From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0pK5-0003Y9-SU for qemu-devel@nongnu.org; Sun, 30 Oct 2016 08:34:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0pK2-0001pC-Nu for qemu-devel@nongnu.org; Sun, 30 Oct 2016 08:34:49 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35112 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c0pK2-0001p2-IQ for qemu-devel@nongnu.org; Sun, 30 Oct 2016 08:34:46 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9UCXO3v069464 for ; Sun, 30 Oct 2016 08:34:45 -0400 Received: from e06smtp06.uk.ibm.com (e06smtp06.uk.ibm.com [195.75.94.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 26cndg8stc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 30 Oct 2016 08:34:45 -0400 Received: from localhost by e06smtp06.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 30 Oct 2016 12:34:44 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id EC52317D8056 for ; Sun, 30 Oct 2016 12:36:57 +0000 (GMT) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9UCYfr114221808 for ; Sun, 30 Oct 2016 12:34:41 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9UCYeH3016997 for ; Sun, 30 Oct 2016 06:34:41 -0600 From: Greg Kurz Date: Sun, 30 Oct 2016 13:34:22 +0100 In-Reply-To: <1477830868-12274-1-git-send-email-groug@kaod.org> References: <1477830868-12274-1-git-send-email-groug@kaod.org> Message-Id: <1477830868-12274-2-git-send-email-groug@kaod.org> Subject: [Qemu-devel] [PULL 1/7] 9pfs: add xattrwalk_fid field in V9fsXattr struct List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , "Aneesh Kumar K.V" , Greg Kurz , Li Qiang From: Li Qiang Currently, 9pfs sets the 'copied_len' field in V9fsXattr to -1 to tag xattr walk fid. As the 'copied_len' is also used to account for copied bytes, this may make confusion. This patch add a bool 'xattrwalk_fid' to tag the xattr walk fid. Suggested-by: Greg Kurz Signed-off-by: Li Qiang Reviewed-by: Greg Kurz --- hw/9pfs/9p.c | 7 ++++--- hw/9pfs/9p.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index e88cf257a2b9..ab18ef2adf32 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -325,7 +325,7 @@ static int coroutine_fn v9fs_xattr_fid_clunk(V9fsPDU *pdu, V9fsFidState *fidp) { int retval = 0; - if (fidp->fs.xattr.copied_len == -1) { + if (fidp->fs.xattr.xattrwalk_fid) { /* getxattr/listxattr fid */ goto free_value; } @@ -3190,7 +3190,7 @@ static void coroutine_fn v9fs_xattrwalk(void *opaque) */ xattr_fidp->fs.xattr.len = size; xattr_fidp->fid_type = P9_FID_XATTR; - xattr_fidp->fs.xattr.copied_len = -1; + xattr_fidp->fs.xattr.xattrwalk_fid = true; if (size) { xattr_fidp->fs.xattr.value = g_malloc(size); err = v9fs_co_llistxattr(pdu, &xattr_fidp->path, @@ -3223,7 +3223,7 @@ static void coroutine_fn v9fs_xattrwalk(void *opaque) */ xattr_fidp->fs.xattr.len = size; xattr_fidp->fid_type = P9_FID_XATTR; - xattr_fidp->fs.xattr.copied_len = -1; + xattr_fidp->fs.xattr.xattrwalk_fid = true; if (size) { xattr_fidp->fs.xattr.value = g_malloc(size); err = v9fs_co_lgetxattr(pdu, &xattr_fidp->path, @@ -3279,6 +3279,7 @@ static void coroutine_fn v9fs_xattrcreate(void *opaque) xattr_fidp = file_fidp; xattr_fidp->fid_type = P9_FID_XATTR; xattr_fidp->fs.xattr.copied_len = 0; + xattr_fidp->fs.xattr.xattrwalk_fid = false; xattr_fidp->fs.xattr.len = size; xattr_fidp->fs.xattr.flags = flags; v9fs_string_init(&xattr_fidp->fs.xattr.name); diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 2523a445f81f..48065cc22169 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -164,6 +164,7 @@ typedef struct V9fsXattr void *value; V9fsString name; int flags; + bool xattrwalk_fid; } V9fsXattr; typedef struct V9fsDir { -- 2.5.5