diff mbox series

[1/4] 9pfs: V9fsQID: set type of version and path to unsigned

Message ID 20180208180019.13683-2-antonios.motakis@huawei.com
State New
Headers show
Series QID path collision fix | expand

Commit Message

Antonios Motakis Feb. 8, 2018, 6 p.m. UTC
From: Antonios Motakis <antonios.motakis@huawei.com>

There is no need for signedness on these QID fields for 9p.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
---
 fsdev/9p-marshal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Greg Kurz Feb. 9, 2018, 12:37 p.m. UTC | #1
On Thu, 8 Feb 2018 19:00:16 +0100
<antonios.motakis@huawei.com> wrote:

> From: Antonios Motakis <antonios.motakis@huawei.com>
> 
> There is no need for signedness on these QID fields for 9p.
> 
> Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
> ---

I agree these should be unsigned, but you have some more places to adapt
to this change. At least these:
- related traces in hw/9pfs/trace-events should then expect unsigned values
- donttouch_stat() in hw/9pfs/9p.c should stop comparing them to -1

>  fsdev/9p-marshal.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fsdev/9p-marshal.h b/fsdev/9p-marshal.h
> index c8823d8..d1ad364 100644
> --- a/fsdev/9p-marshal.h
> +++ b/fsdev/9p-marshal.h
> @@ -10,8 +10,8 @@ typedef struct V9fsString
>  typedef struct V9fsQID
>  {
>      int8_t type;

Even if your series doesn't use it, while here, let's drop the sign from
@type as well.

> -    int32_t version;
> -    int64_t path;
> +    uint32_t version;
> +    uint64_t path;
>  } V9fsQID;
>  
>  typedef struct V9fsStat
Antonios Motakis Feb. 16, 2018, 10:19 a.m. UTC | #2
On 02/09/2018 01:37 PM, Greg Kurz wrote:
> On Thu, 8 Feb 2018 19:00:16 +0100
> <antonios.motakis@huawei.com> wrote:
>
>> From: Antonios Motakis <antonios.motakis@huawei.com>
>>
>> There is no need for signedness on these QID fields for 9p.
>>
>> Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
>> ---
> I agree these should be unsigned, but you have some more places to adapt
> to this change. At least these:
> - related traces in hw/9pfs/trace-events should then expect unsigned values
> - donttouch_stat() in hw/9pfs/9p.c should stop comparing them to -1

Noted!

>
>>   fsdev/9p-marshal.h | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fsdev/9p-marshal.h b/fsdev/9p-marshal.h
>> index c8823d8..d1ad364 100644
>> --- a/fsdev/9p-marshal.h
>> +++ b/fsdev/9p-marshal.h
>> @@ -10,8 +10,8 @@ typedef struct V9fsString
>>   typedef struct V9fsQID
>>   {
>>       int8_t type;
> Even if your series doesn't use it, while here, let's drop the sign from
> @type as well.
Agreed

>
>> -    int32_t version;
>> -    int64_t path;
>> +    uint32_t version;
>> +    uint64_t path;
>>   } V9fsQID;
>>   
>>   typedef struct V9fsStat
diff mbox series

Patch

diff --git a/fsdev/9p-marshal.h b/fsdev/9p-marshal.h
index c8823d8..d1ad364 100644
--- a/fsdev/9p-marshal.h
+++ b/fsdev/9p-marshal.h
@@ -10,8 +10,8 @@  typedef struct V9fsString
 typedef struct V9fsQID
 {
     int8_t type;
-    int32_t version;
-    int64_t path;
+    uint32_t version;
+    uint64_t path;
 } V9fsQID;
 
 typedef struct V9fsStat