carlwgeorge / rpms / qemu

Forked from rpms/qemu a year ago
Clone
a0f6152
From: Li Qiang <liqiang6-s@360.cn>
a0f6152
Date: Tue, 1 Nov 2016 12:00:40 +0100
a0f6152
Subject: [PATCH] 9pfs: add xattrwalk_fid field in V9fsXattr struct
a0f6152
a0f6152
Currently, 9pfs sets the 'copied_len' field in V9fsXattr
a0f6152
to -1 to tag xattr walk fid. As the 'copied_len' is also
a0f6152
used to account for copied bytes, this may make confusion. This patch
a0f6152
add a bool 'xattrwalk_fid' to tag the xattr walk fid.
a0f6152
a0f6152
Suggested-by: Greg Kurz <groug@kaod.org>
a0f6152
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
a0f6152
Reviewed-by: Greg Kurz <groug@kaod.org>
a0f6152
Signed-off-by: Greg Kurz <groug@kaod.org>
a0f6152
(cherry picked from commit dd28fbbc2edc0822965d402d927ce646326d6954)
a0f6152
---
a0f6152
 hw/9pfs/9p.c | 7 ++++---
a0f6152
 hw/9pfs/9p.h | 1 +
a0f6152
 2 files changed, 5 insertions(+), 3 deletions(-)
a0f6152
a0f6152
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
3d039dc
index 54554bac51..ad57123aaf 100644
a0f6152
--- a/hw/9pfs/9p.c
a0f6152
+++ b/hw/9pfs/9p.c
a0f6152
@@ -310,7 +310,7 @@ static int v9fs_xattr_fid_clunk(V9fsPDU *pdu, V9fsFidState *fidp)
a0f6152
 {
a0f6152
     int retval = 0;
a0f6152
 
a0f6152
-    if (fidp->fs.xattr.copied_len == -1) {
a0f6152
+    if (fidp->fs.xattr.xattrwalk_fid) {
a0f6152
         /* getxattr/listxattr fid */
a0f6152
         goto free_value;
a0f6152
     }
a0f6152
@@ -3177,7 +3177,7 @@ static void v9fs_xattrwalk(void *opaque)
a0f6152
          */
a0f6152
         xattr_fidp->fs.xattr.len = size;
a0f6152
         xattr_fidp->fid_type = P9_FID_XATTR;
a0f6152
-        xattr_fidp->fs.xattr.copied_len = -1;
a0f6152
+        xattr_fidp->fs.xattr.xattrwalk_fid = true;
a0f6152
         if (size) {
a0f6152
             xattr_fidp->fs.xattr.value = g_malloc(size);
a0f6152
             err = v9fs_co_llistxattr(pdu, &xattr_fidp->path,
a0f6152
@@ -3210,7 +3210,7 @@ static void v9fs_xattrwalk(void *opaque)
a0f6152
          */
a0f6152
         xattr_fidp->fs.xattr.len = size;
a0f6152
         xattr_fidp->fid_type = P9_FID_XATTR;
a0f6152
-        xattr_fidp->fs.xattr.copied_len = -1;
a0f6152
+        xattr_fidp->fs.xattr.xattrwalk_fid = true;
a0f6152
         if (size) {
a0f6152
             xattr_fidp->fs.xattr.value = g_malloc(size);
a0f6152
             err = v9fs_co_lgetxattr(pdu, &xattr_fidp->path,
a0f6152
@@ -3266,6 +3266,7 @@ static void v9fs_xattrcreate(void *opaque)
a0f6152
     xattr_fidp = file_fidp;
a0f6152
     xattr_fidp->fid_type = P9_FID_XATTR;
a0f6152
     xattr_fidp->fs.xattr.copied_len = 0;
a0f6152
+    xattr_fidp->fs.xattr.xattrwalk_fid = false;
a0f6152
     xattr_fidp->fs.xattr.len = size;
a0f6152
     xattr_fidp->fs.xattr.flags = flags;
a0f6152
     v9fs_string_init(&xattr_fidp->fs.xattr.name);
a0f6152
diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
3d039dc
index a38603398e..699235d81c 100644
a0f6152
--- a/hw/9pfs/9p.h
a0f6152
+++ b/hw/9pfs/9p.h
a0f6152
@@ -164,6 +164,7 @@ typedef struct V9fsXattr
a0f6152
     void *value;
a0f6152
     V9fsString name;
a0f6152
     int flags;
a0f6152
+    bool xattrwalk_fid;
a0f6152
 } V9fsXattr;
a0f6152
 
a0f6152
 typedef struct V9fsDir {