Skip to contentSkip to conversation

linux-user/hexagon: Use generic target_stat64 structure

PATCH Applied Philippe Mathieu-Daudé 4 participants 8 messages Nov 16, 2021 – Dec 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user/hexagon: Use generic target_stat64 structure

Linux Hexagon port doesn't define a specific 'struct stat' but uses the generic one (see Linux commit 6103ec56c65c [*] "asm-generic: add generic ABI headers" which predates the introduction of the Hexagon port).

Remove the target specific target_stat (which in fact is the target_stat64 structure but uses incorrect target_long and ABI unsafe long long types) and use the generic target_stat64 instead.

[*] https://github.com/torvalds/linux/commit/6103ec56c65c3#diff-5f59b07b38273b7d6a74193bc81a8cd18928c688276eae20cb10c569de3253ee

---
 linux-user/syscall_defs.h | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)
linux-user/syscall_defs.h +2 -26
index a5ce487dcc3..7ab612d163b 100644
@@ -2129,7 +2129,8 @@ struct target_stat64  {
     abi_ulong __unused5;
 };
 
-#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) || defined(TARGET_RISCV)
+#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \
+        || defined(TARGET_RISCV) || defined(TARGET_HEXAGON)
 
 /* These are the asm-generic versions of the stat and stat64 structures */
 
@@ -2240,31 +2241,6 @@ struct target_stat64 {
     uint64_t   st_ino;
 };
 
-#elif defined(TARGET_HEXAGON)
-
-struct target_stat {
-    unsigned long long st_dev;
-    unsigned long long st_ino;
-    unsigned int st_mode;
-    unsigned int st_nlink;
-    unsigned int st_uid;
-    unsigned int st_gid;
-    unsigned long long st_rdev;
-    target_ulong __pad1;
-    long long st_size;
-    target_long st_blksize;
-    int __pad2;
-    long long st_blocks;
-
-    target_long target_st_atime;
-    target_long target_st_atime_nsec;
-    target_long target_st_mtime;
-    target_long target_st_mtime_nsec;
-    target_long target_st_ctime;
-    target_long target_st_ctime_nsec;
-    int __unused[2];
-};
-
 #else
 #error unsupported CPU
 #endif
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé

Linux Hexagon port doesn't define a specific 'struct stat' but uses the generic one (see Linux commit 6103ec56c65c [*] "asm-generic: add generic ABI headers" which predates the introduction of the Hexagon port).

Remove the target specific target_stat (which in fact is the target_stat64 structure but uses incorrect target_long and ABI unsafe long long types) and use the generic target_stat64 instead.

Quoted 6 lines

[*]https://github.com/torvalds/linux/commit/6103ec56c65c3#diff-5f59b07b38273b7d6a74193bc81a8cd18928c688276eae20cb10c569de3253ee

---
  linux-user/syscall_defs.h | 28 ++--------------------------
  1 file changed, 2 insertions(+), 26 deletions(-)

r~

Reviewed-by Tested-by
#2 lore raw
Quoted 24 lines

-----Original Message-----
From: Richard Henderson <[email protected]>
Sent: Wednesday, November 17, 2021 1:18 AM
To: Philippe Mathieu-Daudé <[email protected]>; [email protected]
Cc: Laurent Vivier <[email protected]>; Taylor Simpson <[email protected]>
Subject: Re: [PATCH] linux-user/hexagon: Use generic target_stat64 structure

Quoted 12 lines · Philippe Mathieu-Daudé

Linux Hexagon port doesn't define a specific 'struct stat' but uses the generic one (see Linux commit 6103ec56c65c [*] "asm-generic: add generic ABI headers" which predates the introduction of the Hexagon port).

Remove the target specific target_stat (which in fact is the target_stat64 structure but uses incorrect target_long and ABI unsafe long long types) and use the generic target_stat64 instead.

[*]https://github.com/torvalds/linux/commit/6103ec56c65c3#diff-5f59b07 b38273b7d6a74193bc81a8cd18928c688276eae20cb10c569de3253ee

Quoted 6 lines
Quoted 4 lines
---
  linux-user/syscall_defs.h | 28 ++--------------------------
  1 file changed, 2 insertions(+), 26 deletions(-)
#3 lore raw
In reply to Philippe Mathieu-Daudé

Hi Laurent,

What is your plan for this patch? Technically this is a bugfix.

Quoted 64 lines · Philippe Mathieu-Daudé

Linux Hexagon port doesn't define a specific 'struct stat' but uses the generic one (see Linux commit 6103ec56c65c [*] "asm-generic: add generic ABI headers" which predates the introduction of the Hexagon port).

Remove the target specific target_stat (which in fact is the target_stat64 structure but uses incorrect target_long and ABI unsafe long long types) and use the generic target_stat64 instead.

[*] https://github.com/torvalds/linux/commit/6103ec56c65c3#diff-5f59b07b38273b7d6a74193bc81a8cd18928c688276eae20cb10c569de3253ee

---
 linux-user/syscall_defs.h | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)
linux-user/syscall_defs.h +2 -26
index a5ce487dcc3..7ab612d163b 100644
@@ -2129,7 +2129,8 @@ struct target_stat64  {
     abi_ulong __unused5;
 };
 
-#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) || defined(TARGET_RISCV)
+#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \
+        || defined(TARGET_RISCV) || defined(TARGET_HEXAGON)
 
 /* These are the asm-generic versions of the stat and stat64 structures */
 
@@ -2240,31 +2241,6 @@ struct target_stat64 {
     uint64_t   st_ino;
 };
 
-#elif defined(TARGET_HEXAGON)
-
-struct target_stat {
-    unsigned long long st_dev;
-    unsigned long long st_ino;
-    unsigned int st_mode;
-    unsigned int st_nlink;
-    unsigned int st_uid;
-    unsigned int st_gid;
-    unsigned long long st_rdev;
-    target_ulong __pad1;
-    long long st_size;
-    target_long st_blksize;
-    int __pad2;
-    long long st_blocks;
-
-    target_long target_st_atime;
-    target_long target_st_atime_nsec;
-    target_long target_st_mtime;
-    target_long target_st_mtime_nsec;
-    target_long target_st_ctime;
-    target_long target_st_ctime_nsec;
-    int __unused[2];
-};
-
 #else
 #error unsupported CPU
 #endif
#4 lore raw
Quoted 4 lines · Philippe Mathieu-Daudé

Hi Laurent,

What is your plan for this patch? Technically this is a bugfix.

I see the code was released for 6.0, so not a regression. Probably 7.0 material now.

Quoted 65 lines · Philippe Mathieu-Daudé
Quoted 64 lines

Linux Hexagon port doesn't define a specific 'struct stat' but uses the generic one (see Linux commit 6103ec56c65c [*] "asm-generic: add generic ABI headers" which predates the introduction of the Hexagon port).

Remove the target specific target_stat (which in fact is the target_stat64 structure but uses incorrect target_long and ABI unsafe long long types) and use the generic target_stat64 instead.

[*] https://github.com/torvalds/linux/commit/6103ec56c65c3#diff-5f59b07b38273b7d6a74193bc81a8cd18928c688276eae20cb10c569de3253ee

---
 linux-user/syscall_defs.h | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)
linux-user/syscall_defs.h +2 -26
index a5ce487dcc3..7ab612d163b 100644
@@ -2129,7 +2129,8 @@ struct target_stat64  {
     abi_ulong __unused5;
 };
 
-#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) || defined(TARGET_RISCV)
+#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \
+        || defined(TARGET_RISCV) || defined(TARGET_HEXAGON)
 
 /* These are the asm-generic versions of the stat and stat64 structures */
 
@@ -2240,31 +2241,6 @@ struct target_stat64 {
     uint64_t   st_ino;
 };
 
-#elif defined(TARGET_HEXAGON)
-
-struct target_stat {
-    unsigned long long st_dev;
-    unsigned long long st_ino;
-    unsigned int st_mode;
-    unsigned int st_nlink;
-    unsigned int st_uid;
-    unsigned int st_gid;
-    unsigned long long st_rdev;
-    target_ulong __pad1;
-    long long st_size;
-    target_long st_blksize;
-    int __pad2;
-    long long st_blocks;
-
-    target_long target_st_atime;
-    target_long target_st_atime_nsec;
-    target_long target_st_mtime;
-    target_long target_st_mtime_nsec;
-    target_long target_st_ctime;
-    target_long target_st_ctime_nsec;
-    int __unused[2];
-};
-
 #else
 #error unsupported CPU
 #endif
#5 lore raw
In reply to Philippe Mathieu-Daudé

ping.

Quoted 64 lines · Philippe Mathieu-Daudé

Linux Hexagon port doesn't define a specific 'struct stat' but uses the generic one (see Linux commit 6103ec56c65c [*] "asm-generic: add generic ABI headers" which predates the introduction of the Hexagon port).

Remove the target specific target_stat (which in fact is the target_stat64 structure but uses incorrect target_long and ABI unsafe long long types) and use the generic target_stat64 instead.

[*] https://github.com/torvalds/linux/commit/6103ec56c65c3#diff-5f59b07b38273b7d6a74193bc81a8cd18928c688276eae20cb10c569de3253ee

---
 linux-user/syscall_defs.h | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)
linux-user/syscall_defs.h +2 -26
index a5ce487dcc3..7ab612d163b 100644
@@ -2129,7 +2129,8 @@ struct target_stat64  {
     abi_ulong __unused5;
 };
 
-#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) || defined(TARGET_RISCV)
+#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \
+        || defined(TARGET_RISCV) || defined(TARGET_HEXAGON)
 
 /* These are the asm-generic versions of the stat and stat64 structures */
 
@@ -2240,31 +2241,6 @@ struct target_stat64 {
     uint64_t   st_ino;
 };
 
-#elif defined(TARGET_HEXAGON)
-
-struct target_stat {
-    unsigned long long st_dev;
-    unsigned long long st_ino;
-    unsigned int st_mode;
-    unsigned int st_nlink;
-    unsigned int st_uid;
-    unsigned int st_gid;
-    unsigned long long st_rdev;
-    target_ulong __pad1;
-    long long st_size;
-    target_long st_blksize;
-    int __pad2;
-    long long st_blocks;
-
-    target_long target_st_atime;
-    target_long target_st_atime_nsec;
-    target_long target_st_mtime;
-    target_long target_st_mtime_nsec;
-    target_long target_st_ctime;
-    target_long target_st_ctime_nsec;
-    int __unused[2];
-};
-
 #else
 #error unsupported CPU
 #endif
Reviewed-by Tested-by
#6 lore raw
Quoted 12 lines

-----Original Message-----
From: Philippe Mathieu-Daudé <[email protected]> On Behalf Of Philippe Mathieu-Daudé
Sent: Wednesday, December 15, 2021 4:36 AM
To: [email protected]
Cc: Taylor Simpson <[email protected]>; Richard Henderson <[email protected]>; Laurent Vivier <[email protected]>
Subject: Re: [PATCH] linux-user/hexagon: Use generic target_stat64 structure

Quoted 2 lines

ping.

Sorry if my previous email didn't get through, but ...

#7 lore raw
In reply to Philippe Mathieu-Daudé

Le 16/11/2021 à 22:09, Philippe Mathieu-Daudé a écrit :

Quoted 54 lines

Linux Hexagon port doesn't define a specific 'struct stat' but uses the generic one (see Linux commit 6103ec56c65c [*] "asm-generic: add generic ABI headers" which predates the introduction of the Hexagon port).

Remove the target specific target_stat (which in fact is the target_stat64 structure but uses incorrect target_long and ABI unsafe long long types) and use the generic target_stat64 instead.

[*] https://github.com/torvalds/linux/commit/6103ec56c65c3#diff-5f59b07b38273b7d6a74193bc81a8cd18928c688276eae20cb10c569de3253ee

---
  linux-user/syscall_defs.h | 28 ++--------------------------
  1 file changed, 2 insertions(+), 26 deletions(-)
linux-user/syscall_defs.h +2 -19
index a5ce487dcc3..7ab612d163b 100644
@@ -2129,7 +2129,8 @@ struct target_stat64  {
      abi_ulong __unused5;
  };
 
-#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) || defined(TARGET_RISCV)
+#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \
+        || defined(TARGET_RISCV) || defined(TARGET_HEXAGON)
 
  /* These are the asm-generic versions of the stat and stat64 structures */
 
@@ -2240,31 +2241,6 @@ struct target_stat64 {
      uint64_t   st_ino;
  };
 
-#elif defined(TARGET_HEXAGON)
-
-struct target_stat {
-    unsigned long long st_dev;
-    unsigned long long st_ino;
-    unsigned int st_mode;
-    unsigned int st_nlink;
-    unsigned int st_uid;
-    unsigned int st_gid;
-    unsigned long long st_rdev;
-    target_ulong __pad1;
-    long long st_size;
-    target_long st_blksize;
-    int __pad2;
-    long long st_blocks;
-
-    target_long target_st_atime;
-    target_long target_st_atime_nsec;

linux-user/syscall_defs.h struct target_stat64 { · line 2246

Quoted 10 lines
linux-user/syscall_defs.h +0 -7
-    target_long target_st_mtime;
-    target_long target_st_mtime_nsec;
-    target_long target_st_ctime;
-    target_long target_st_ctime_nsec;
-    int __unused[2];
-};
-
  #else
  #error unsupported CPU
  #endif

Applied to my linux-user-for-7.0 branch.

Thanks,
Laurent