From: "Andreas K. Huettel" <dilfridge@gentoo.org>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"WANG Xuerui" <xen0n@gentoo.org>,
"Song Gao" <gaosong@loongson.cn>,
"Xiaojuan Yang" <yangxiaojuan@loongson.cn>,
"WANG Xuerui" <xen0n@gentoo.org>
Subject: Re: [PATCH RESEND] linux-user: Fix struct statfs ABI on loongarch64
Date: Fri, 07 Oct 2022 23:15:33 +0200 [thread overview]
Message-ID: <4766451.GXAFRqVoOG@pinacolada> (raw)
In-Reply-To: <20221006100710.427252-1-xen0n@gentoo.org>
[-- Attachment #1: Type: text/plain, Size: 1967 bytes --]
Am Donnerstag, 6. Oktober 2022, 12:07:10 CEST schrieb WANG Xuerui:
> Previously the 32-bit version was incorrectly chosen, leading to funny
> but incorrect output from e.g. df(1). Simply select the version
> corresponding to the 64-bit asm-generic definition.
>
> For reference, this program should produce the same output no matter
> natively compiled or not, for loongarch64 or not:
>
> ```c
> #include <stdio.h>
> #include <sys/statfs.h>
>
> int main(int argc, const char *argv[])
> {
> struct statfs b;
> if (statfs(argv[0], &b))
> return 1;
>
> printf("f_type = 0x%lx\n", b.f_type);
> printf("f_bsize = %ld\n", b.f_bsize);
> printf("f_blocks = %ld\n", b.f_blocks);
> printf("f_bfree = %ld\n", b.f_bfree);
> printf("f_bavail = %ld\n", b.f_bavail);
>
> return 0;
> }
>
> // Example output on my amd64 box, with the test binary residing on a
> // btrfs partition.
>
> // Native and emulated output after the fix:
> //
> // f_type = 0x9123683e
> // f_bsize = 4096
> // f_blocks = 268435456
> // f_bfree = 168406890
> // f_bavail = 168355058
>
> // Output before the fix, note the messed layout:
> //
> // f_type = 0x10009123683e
> // f_bsize = 723302085239504896
> // f_blocks = 168355058
> // f_bfree = 2250817541779750912
> // f_bavail = 1099229433104
> ```
>
> Fixes: 1f63019632 ("linux-user: Add LoongArch syscall support")
> Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
> Cc: Song Gao <gaosong@loongson.cn>
> Cc: Xiaojuan Yang <yangxiaojuan@loongson.cn>
> Cc: Andreas K. Hüttel <dilfridge@gentoo.org>
> ---
>
> Resend with amended commit message to 100% clarify the example output
> are generated on my box and will differ for everyone else. Sorry for
> the noise.
>
Definitely fixes df.
Tested-by: Andreas K. Huettel <dilfridge@gentoo.org>
--
Andreas K. Hüttel
dilfridge@gentoo.org
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
prev parent reply other threads:[~2022-10-07 21:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 10:07 [PATCH RESEND] linux-user: Fix struct statfs ABI on loongarch64 WANG Xuerui
2022-10-06 11:11 ` Philippe Mathieu-Daudé via
2022-10-10 9:10 ` gaosong
2022-10-07 21:15 ` Andreas K. Huettel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4766451.GXAFRqVoOG@pinacolada \
--to=dilfridge@gentoo.org \
--cc=f4bug@amsat.org \
--cc=gaosong@loongson.cn \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=xen0n@gentoo.org \
--cc=yangxiaojuan@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).