* [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64
@ 2021-11-19 8:28 Yang Xu
2021-11-19 8:28 ` [LTP] [PATCH 2/2] syscalls/stat*: Add nlink member check Yang Xu
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Yang Xu @ 2021-11-19 8:28 UTC (permalink / raw)
To: ltp
warning: format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 5 has type ‘__u64’ {aka ‘long long unsigned int’}
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
testcases/kernel/syscalls/statx/statx01.c | 8 ++++----
testcases/kernel/syscalls/statx/statx02.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index 2358dd7bc..1289366b9 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -79,11 +79,11 @@ static void test_normal_file(void)
if (buff.stx_size == SIZE)
tst_res(TPASS,
- "stx_size(%"PRIu64") is correct", buff.stx_size);
+ "stx_size(%"PRIu64") is correct", (uint64_t)buff.stx_size);
else
tst_res(TFAIL,
"stx_size(%"PRIu64") is different from expected(%u)",
- buff.stx_size, SIZE);
+ (uint64_t)buff.stx_size, SIZE);
if ((buff.stx_mode & ~(S_IFMT)) == MODE)
tst_res(TPASS, "stx_mode(%u) is correct", buff.stx_mode);
@@ -94,10 +94,10 @@ static void test_normal_file(void)
if (buff.stx_blocks <= buff.stx_blksize/512 * 2)
tst_res(TPASS, "stx_blocks(%"PRIu64") is valid",
- buff.stx_blocks);
+ (uint64_t)buff.stx_blocks);
else
tst_res(TFAIL, "stx_blocks(%"PRIu64") is invalid",
- buff.stx_blocks);
+ (uint64_t)buff.stx_blocks);
}
diff --git a/testcases/kernel/syscalls/statx/statx02.c b/testcases/kernel/syscalls/statx/statx02.c
index 08ea940cb..63133a3b7 100644
--- a/testcases/kernel/syscalls/statx/statx02.c
+++ b/testcases/kernel/syscalls/statx/statx02.c
@@ -50,11 +50,11 @@ static void test_empty_path(void)
if (buf.stx_size == SIZE)
tst_res(TPASS,
- "stx_size(%"PRIu64") is correct", buf.stx_size);
+ "stx_size(%"PRIu64") is correct", (uint64_t)buf.stx_size);
else
tst_res(TFAIL,
"stx_size(%"PRIu64") is not same as expected(%u)",
- buf.stx_size, SIZE);
+ (uint64_t)buf.stx_size, SIZE);
}
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread* [LTP] [PATCH 2/2] syscalls/stat*: Add nlink member check
2021-11-19 8:28 [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64 Yang Xu
@ 2021-11-19 8:28 ` Yang Xu
2021-11-19 13:07 ` Cyril Hrubis
2021-11-19 10:52 ` [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64 Cyril Hrubis
2021-11-29 12:26 ` Cyril Hrubis
2 siblings, 1 reply; 7+ messages in thread
From: Yang Xu @ 2021-11-19 8:28 UTC (permalink / raw)
To: ltp
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
mount_id member check will add in the next week.
[1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa2fcf4
[2]https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=728009a47497b6
testcases/kernel/syscalls/stat/stat01.c | 8 +++++++-
testcases/kernel/syscalls/statx/statx01.c | 6 ++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/stat/stat01.c b/testcases/kernel/syscalls/stat/stat01.c
index 14f1036d5..0f5c1dcc2 100644
--- a/testcases/kernel/syscalls/stat/stat01.c
+++ b/testcases/kernel/syscalls/stat/stat01.c
@@ -71,11 +71,17 @@ static void verify_stat(unsigned int n)
fail++;
}
+ if (stat_buf.st_nlink != 1) {
+ tst_res(TFAIL, "stat_buf.st_nlink = %lu expected 1",
+ stat_buf.st_nlink);
+ fail++;
+ }
+
if (!fail)
tst_res(TPASS, "stat(%s)", tc->pathname);
}
-void setup(void)
+static void setup(void)
{
unsigned int i;
diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index 1289366b9..63d97b8c7 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -16,6 +16,7 @@
* 3) mode
* 4) blocks
* 5) size
+ * 6) nlink
*
* A file is created and metadata values are set with
* predefined values.
@@ -99,6 +100,11 @@ static void test_normal_file(void)
tst_res(TFAIL, "stx_blocks(%"PRIu64") is invalid",
(uint64_t)buff.stx_blocks);
+ if (buff.stx_nlink == 1)
+ tst_res(TPASS, "stx_nlink(1) is correct");
+ else
+ tst_res(TFAIL, "stx_nlink(%u) is different from expected(1)",
+ buff.stx_nlink);
}
static void test_device_file(void)
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64
2021-11-19 8:28 [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64 Yang Xu
2021-11-19 8:28 ` [LTP] [PATCH 2/2] syscalls/stat*: Add nlink member check Yang Xu
@ 2021-11-19 10:52 ` Cyril Hrubis
2021-11-29 12:26 ` Cyril Hrubis
2 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2021-11-19 10:52 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Hi!
> warning: format ???%lu??? expects argument of type ???long unsigned int???,
> but argument 5 has type ???__u64??? {aka ???long long unsigned int???}
This is strange, the stx_size is either defined as uint64_t in our
fallback code or as __u64 in the system headers. It should really match
the PRIu64.
I see the warnings on my system as well, it looks like
/usr/include/asm-generic/int-ll64.h is used even on 64bit system e.g.
x86_64 that does not make any sense.
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
> testcases/kernel/syscalls/statx/statx01.c | 8 ++++----
> testcases/kernel/syscalls/statx/statx02.c | 4 ++--
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
> index 2358dd7bc..1289366b9 100644
> --- a/testcases/kernel/syscalls/statx/statx01.c
> +++ b/testcases/kernel/syscalls/statx/statx01.c
> @@ -79,11 +79,11 @@ static void test_normal_file(void)
>
> if (buff.stx_size == SIZE)
> tst_res(TPASS,
> - "stx_size(%"PRIu64") is correct", buff.stx_size);
> + "stx_size(%"PRIu64") is correct", (uint64_t)buff.stx_size);
> else
> tst_res(TFAIL,
> "stx_size(%"PRIu64") is different from expected(%u)",
> - buff.stx_size, SIZE);
> + (uint64_t)buff.stx_size, SIZE);
>
> if ((buff.stx_mode & ~(S_IFMT)) == MODE)
> tst_res(TPASS, "stx_mode(%u) is correct", buff.stx_mode);
> @@ -94,10 +94,10 @@ static void test_normal_file(void)
>
> if (buff.stx_blocks <= buff.stx_blksize/512 * 2)
> tst_res(TPASS, "stx_blocks(%"PRIu64") is valid",
> - buff.stx_blocks);
> + (uint64_t)buff.stx_blocks);
> else
> tst_res(TFAIL, "stx_blocks(%"PRIu64") is invalid",
> - buff.stx_blocks);
> + (uint64_t)buff.stx_blocks);
>
> }
>
> diff --git a/testcases/kernel/syscalls/statx/statx02.c b/testcases/kernel/syscalls/statx/statx02.c
> index 08ea940cb..63133a3b7 100644
> --- a/testcases/kernel/syscalls/statx/statx02.c
> +++ b/testcases/kernel/syscalls/statx/statx02.c
> @@ -50,11 +50,11 @@ static void test_empty_path(void)
>
> if (buf.stx_size == SIZE)
> tst_res(TPASS,
> - "stx_size(%"PRIu64") is correct", buf.stx_size);
> + "stx_size(%"PRIu64") is correct", (uint64_t)buf.stx_size);
> else
> tst_res(TFAIL,
> "stx_size(%"PRIu64") is not same as expected(%u)",
> - buf.stx_size, SIZE);
> + (uint64_t)buf.stx_size, SIZE);
>
> }
>
> --
> 2.23.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64
2021-11-19 8:28 [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64 Yang Xu
2021-11-19 8:28 ` [LTP] [PATCH 2/2] syscalls/stat*: Add nlink member check Yang Xu
2021-11-19 10:52 ` [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64 Cyril Hrubis
@ 2021-11-29 12:26 ` Cyril Hrubis
2021-11-30 3:06 ` xuyang2018.jy
2 siblings, 1 reply; 7+ messages in thread
From: Cyril Hrubis @ 2021-11-29 12:26 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Hi!
Looks like the __u64 is not going to be compatible in userspace and we
cannot do better than explicit casts anytime soon.
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-11-30 3:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-19 8:28 [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64 Yang Xu
2021-11-19 8:28 ` [LTP] [PATCH 2/2] syscalls/stat*: Add nlink member check Yang Xu
2021-11-19 13:07 ` Cyril Hrubis
2021-11-24 2:37 ` xuyang2018.jy
2021-11-19 10:52 ` [LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64 Cyril Hrubis
2021-11-29 12:26 ` Cyril Hrubis
2021-11-30 3:06 ` xuyang2018.jy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox