linux-user: Fix target_statfs[64] on 64-bit hosts
PATCH 1/1 linux-user: Fix target_statfs[64] on 64-bit hosts
Testing qemu-x86_64, I happen to run df and came across these mistakes in the target_statfs/target_statfs64 structure definitions (reference:linux/include/asm-x86/statfs.h).
Signed-off-by Jan Kiszka <[email protected]>
--- linux-user/syscall_defs.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
linux-user/syscall_defs.h +15 -15
@@ -1600,31 +1600,31 @@ struct target_statfs64 { };#else struct target_statfs { -uint32_t f_type; -uint32_t f_bsize; -uint32_t f_blocks; -uint32_t f_bfree; -uint32_t f_bavail; -uint32_t f_files; -uint32_t f_ffree; +abi_long f_type; +abi_long f_bsize; +abi_long f_blocks; +abi_long f_bfree; +abi_long f_bavail; +abi_long f_files; +abi_long f_ffree;target_fsid_t f_fsid; -uint32_t f_namelen; -uint32_t f_frsize; -uint32_t f_spare[5 ]; +abi_long f_namelen; +abi_long f_frsize; +abi_long f_spare[5 ]; };struct target_statfs64 { -uint32_t f_type; -uint32_t f_bsize; +uint64_t f_type; +uint64_t f_bsize;uint64_t f_blocks;uint64_t f_bfree;uint64_t f_bavail;uint64_t f_files;uint64_t f_ffree;target_fsid_t f_fsid; -uint32_t f_namelen; -uint32_t f_frsize; -uint32_t f_spare[5 ]; +uint64_t f_namelen; +uint64_t f_frsize; +uint64_t f_spare[5 ]; };#endif
Quoted 3 lines · Jan Kiszka
Testing qemu-x86_64, I happen to run df and came across these mistakes in the target_statfs/target_statfs64 structure definitions (reference:
linux/include/asm-x86/statfs.h).
Forget this, broke 32-bit guest. The trick is to enable the last but one #if block also for x86_64 on x86_64. I've nothing to test here, but my strong feeling is that SPARC64 needs an according fix as well.
--------
Use correct target_statfs[_64] definitions for x86/sparc64 on 64-bit.
Signed-off-by Jan Kiszka <[email protected]>
--- linux-user/syscall_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/syscall_defs.h +1 -1
@@ -1570,7 +1570,7 @@ struct target_statfs64 {uint32_t f_namelen;uint32_t f_spare[6 ]; }; -#elif defined(TARGET_PPC64 ) && !defined(TARGET_ABI32 ) +#elif (defined(TARGET_PPC64 ) || defined(TARGET_X86_64 ) || defined(TARGET_SPARC64 )) && !defined(TARGET_ABI32 ) struct target_statfs { abi_long f_type; abi_long f_bsize;