diff mbox

[v3,2/3] 9pfs: convert 'len/copied_len' field in V9fsXattr to the type of uint64_t

Message ID 57ff5d81.4a3c9d0a.90936.609e@mx.google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Li Qiang Oct. 13, 2016, 10:09 a.m. UTC
From: Li Qiang <liqiang6-s@360.cn>

The 'len' in V9fsXattr comes from the 'size' argument in setxattr()
function in guest. The setxattr() function's declaration is this:

int setxattr(const char *path, const char *name,
             const void *value, size_t size, int flags);

and 'size' is treated as u64 in linux kernel client code:

int p9_client_xattrcreate(struct p9_fid *fid, const char *name,
                          u64 attr_size, int flags)

So the 'len' should have an type of 'uint64_t'.
The 'copied_len' in V9fsXattr is used to account for copied bytes, it
should also have an type of 'uint64_t'.

Suggested-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
---
 hw/9pfs/9p.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Greg Kurz Oct. 13, 2016, 1:17 p.m. UTC | #1
On Thu, 13 Oct 2016 03:09:42 -0700
Li Qiang <liq3ea@gmail.com> wrote:

> From: Li Qiang <liqiang6-s@360.cn>
> 
> The 'len' in V9fsXattr comes from the 'size' argument in setxattr()
> function in guest. The setxattr() function's declaration is this:
> 
> int setxattr(const char *path, const char *name,
>              const void *value, size_t size, int flags);
> 
> and 'size' is treated as u64 in linux kernel client code:
> 
> int p9_client_xattrcreate(struct p9_fid *fid, const char *name,
>                           u64 attr_size, int flags)
> 
> So the 'len' should have an type of 'uint64_t'.
> The 'copied_len' in V9fsXattr is used to account for copied bytes, it
> should also have an type of 'uint64_t'.
> 
> Suggested-by: Greg Kurz <groug@kaod.org>
> Signed-off-by: Li Qiang <liqiang6-s@360.cn>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/9pfs/9p.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
> index aa18da1..7fb075f 100644
> --- a/hw/9pfs/9p.h
> +++ b/hw/9pfs/9p.h
> @@ -159,8 +159,8 @@ typedef struct V9fsConf
>  
>  typedef struct V9fsXattr
>  {
> -    int64_t copied_len;
> -    int64_t len;
> +    uint64_t copied_len;
> +    uint64_t len;
>      void *value;
>      V9fsString name;
>      int flags;
diff mbox

Patch

diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
index aa18da1..7fb075f 100644
--- a/hw/9pfs/9p.h
+++ b/hw/9pfs/9p.h
@@ -159,8 +159,8 @@  typedef struct V9fsConf
 
 typedef struct V9fsXattr
 {
-    int64_t copied_len;
-    int64_t len;
+    uint64_t copied_len;
+    uint64_t len;
     void *value;
     V9fsString name;
     int flags;