* [LTP] [PATCH] syscalls/mount03: Add statfs f_flags member check
@ 2022-10-18 11:10 Yang Xu
2022-10-21 22:13 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Yang Xu @ 2022-10-18 11:10 UTC (permalink / raw)
To: ltp
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
testcases/kernel/syscalls/mount/mount03.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/mount/mount03.c b/testcases/kernel/syscalls/mount/mount03.c
index 7a6914fb1..e1dd8d170 100644
--- a/testcases/kernel/syscalls/mount/mount03.c
+++ b/testcases/kernel/syscalls/mount/mount03.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/vfs.h>
#include <pwd.h>
#include "tst_test.h"
#include "lapi/mount.h"
@@ -144,10 +145,10 @@ static void cleanup(void)
SAFE_UMOUNT(MNTPOINT);
}
-
static void run(unsigned int n)
{
struct tcase *tc = &tcases[n];
+ struct statfs stfs;
tst_res(TINFO, "Testing flag %s", tc->desc);
@@ -159,6 +160,11 @@ static void run(unsigned int n)
if (tc->test)
tc->test();
+ SAFE_STATFS(MNTPOINT, &stfs);
+ if (stfs.f_flags & (n == 3 ? MS_REMOUNT : tc->flag))
+ tst_res(TPASS, "statfs() gets the correct mount flag");
+ else
+ tst_res(TFAIL, "statfs() gets the incorrect mount flag");
cleanup();
}
--
2.27.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] syscalls/mount03: Add statfs f_flags member check
2022-10-18 11:10 [LTP] [PATCH] syscalls/mount03: Add statfs f_flags member check Yang Xu
@ 2022-10-21 22:13 ` Petr Vorel
2022-10-24 1:20 ` xuyang2018.jy
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2022-10-21 22:13 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Hi Xu,
Reviewed-by: Petr Vorel <pvorel@suse.cz>
> static void run(unsigned int n)
> {
> struct tcase *tc = &tcases[n];
> + struct statfs stfs;
> tst_res(TINFO, "Testing flag %s", tc->desc);
> @@ -159,6 +160,11 @@ static void run(unsigned int n)
> if (tc->test)
> tc->test();
> + SAFE_STATFS(MNTPOINT, &stfs);
> + if (stfs.f_flags & (n == 3 ? MS_REMOUNT : tc->flag))
Wouldn't it be better to add another struct member for this check?
See patch below.
Kind regards,
Petr
> + tst_res(TPASS, "statfs() gets the correct mount flag");
> + else
> + tst_res(TFAIL, "statfs() gets the incorrect mount flag");
> cleanup();
> }
diff --git testcases/kernel/syscalls/mount/mount03.c testcases/kernel/syscalls/mount/mount03.c
index 297f89838..c4d3c110a 100644
--- testcases/kernel/syscalls/mount/mount03.c
+++ testcases/kernel/syscalls/mount/mount03.c
@@ -114,16 +114,18 @@ static void test_noatime(void)
TST_EXP_EQ_LI(st.st_atime, atime);
}
-#define FLAG_DESC(x) .flag = x, .desc = #x
+#define FLAG_DESC(x) .flag = x, .flag2 = x, .desc = #x
+#define FLAG_DESC2(x) .flag2 = x, .desc = #x
static struct tcase {
unsigned int flag;
+ unsigned int flag2;
char *desc;
void (*test)(void);
} tcases[] = {
{FLAG_DESC(MS_RDONLY), test_rdonly},
{FLAG_DESC(MS_NODEV), test_nodev},
{FLAG_DESC(MS_NOEXEC), test_noexec},
- {MS_RDONLY, "MS_REMOUNT", test_remount},
+ {MS_RDONLY, FLAG_DESC2(MS_REMOUNT), test_remount},
{FLAG_DESC(MS_NOSUID), test_nosuid},
{FLAG_DESC(MS_NOATIME), test_noatime},
};
@@ -161,7 +163,7 @@ static void run(unsigned int n)
tc->test();
SAFE_STATFS(MNTPOINT, &stfs);
- if (stfs.f_flags & (n == 3 ? MS_REMOUNT : tc->flag))
+ if (stfs.f_flags & tc->flag2)
tst_res(TPASS, "statfs() gets the correct mount flag");
else
tst_res(TFAIL, "statfs() gets the incorrect mount flag");
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] syscalls/mount03: Add statfs f_flags member check
2022-10-21 22:13 ` Petr Vorel
@ 2022-10-24 1:20 ` xuyang2018.jy
2022-10-24 14:49 ` Richard Palethorpe
0 siblings, 1 reply; 5+ messages in thread
From: xuyang2018.jy @ 2022-10-24 1:20 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp@lists.linux.it
Hi Petr
> Hi Xu,
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
>> static void run(unsigned int n)
>> {
>> struct tcase *tc = &tcases[n];
>> + struct statfs stfs;
>
>> tst_res(TINFO, "Testing flag %s", tc->desc);
>
>> @@ -159,6 +160,11 @@ static void run(unsigned int n)
>> if (tc->test)
>> tc->test();
>
>> + SAFE_STATFS(MNTPOINT, &stfs);
>> + if (stfs.f_flags & (n == 3 ? MS_REMOUNT : tc->flag))
> Wouldn't it be better to add another struct member for this check?
Of course, it seems better.
Best Regards
Yang Xu
> See patch below.
>
> Kind regards,
> Petr
>
>> + tst_res(TPASS, "statfs() gets the correct mount flag");
>> + else
>> + tst_res(TFAIL, "statfs() gets the incorrect mount flag");
>> cleanup();
>> }
>
> diff --git testcases/kernel/syscalls/mount/mount03.c testcases/kernel/syscalls/mount/mount03.c
> index 297f89838..c4d3c110a 100644
> --- testcases/kernel/syscalls/mount/mount03.c
> +++ testcases/kernel/syscalls/mount/mount03.c
> @@ -114,16 +114,18 @@ static void test_noatime(void)
> TST_EXP_EQ_LI(st.st_atime, atime);
> }
>
> -#define FLAG_DESC(x) .flag = x, .desc = #x
> +#define FLAG_DESC(x) .flag = x, .flag2 = x, .desc = #x
> +#define FLAG_DESC2(x) .flag2 = x, .desc = #x
> static struct tcase {
> unsigned int flag;
> + unsigned int flag2;
> char *desc;
> void (*test)(void);
> } tcases[] = {
> {FLAG_DESC(MS_RDONLY), test_rdonly},
> {FLAG_DESC(MS_NODEV), test_nodev},
> {FLAG_DESC(MS_NOEXEC), test_noexec},
> - {MS_RDONLY, "MS_REMOUNT", test_remount},
> + {MS_RDONLY, FLAG_DESC2(MS_REMOUNT), test_remount},
> {FLAG_DESC(MS_NOSUID), test_nosuid},
> {FLAG_DESC(MS_NOATIME), test_noatime},
> };
> @@ -161,7 +163,7 @@ static void run(unsigned int n)
> tc->test();
>
> SAFE_STATFS(MNTPOINT, &stfs);
> - if (stfs.f_flags & (n == 3 ? MS_REMOUNT : tc->flag))
> + if (stfs.f_flags & tc->flag2)
> tst_res(TPASS, "statfs() gets the correct mount flag");
> else
> tst_res(TFAIL, "statfs() gets the incorrect mount flag");
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] syscalls/mount03: Add statfs f_flags member check
2022-10-24 1:20 ` xuyang2018.jy
@ 2022-10-24 14:49 ` Richard Palethorpe
2022-10-25 2:13 ` xuyang2018.jy
0 siblings, 1 reply; 5+ messages in thread
From: Richard Palethorpe @ 2022-10-24 14:49 UTC (permalink / raw)
To: xuyang2018.jy@fujitsu.com; +Cc: ltp
Hello,
"xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com> writes:
> Hi Petr
>
>> Hi Xu,
>>
>> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>>
>>> static void run(unsigned int n)
>>> {
>>> struct tcase *tc = &tcases[n];
>>> + struct statfs stfs;
>>
>>> tst_res(TINFO, "Testing flag %s", tc->desc);
>>
>>> @@ -159,6 +160,11 @@ static void run(unsigned int n)
>>> if (tc->test)
>>> tc->test();
>>
>>> + SAFE_STATFS(MNTPOINT, &stfs);
>>> + if (stfs.f_flags & (n == 3 ? MS_REMOUNT : tc->flag))
>> Wouldn't it be better to add another struct member for this check?
>
> Of course, it seems better.
>
> Best Regards
> Yang Xu
OK... Petr are you going to merge this with your changes?
Acked-by: Richard Palethorpe <rpalethorpe@suse.com>
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] syscalls/mount03: Add statfs f_flags member check
2022-10-24 14:49 ` Richard Palethorpe
@ 2022-10-25 2:13 ` xuyang2018.jy
0 siblings, 0 replies; 5+ messages in thread
From: xuyang2018.jy @ 2022-10-25 2:13 UTC (permalink / raw)
To: rpalethorpe@suse.de; +Cc: ltp@lists.linux.it
Hi Richard, Petr
> Hello,
>
> "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com> writes:
>
>> Hi Petr
>>
>>> Hi Xu,
>>>
>>> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>>>
>>>> static void run(unsigned int n)
>>>> {
>>>> struct tcase *tc = &tcases[n];
>>>> + struct statfs stfs;
>>>
>>>> tst_res(TINFO, "Testing flag %s", tc->desc);
>>>
>>>> @@ -159,6 +160,11 @@ static void run(unsigned int n)
>>>> if (tc->test)
>>>> tc->test();
>>>
>>>> + SAFE_STATFS(MNTPOINT, &stfs);
>>>> + if (stfs.f_flags & (n == 3 ? MS_REMOUNT : tc->flag))
>>> Wouldn't it be better to add another struct member for this check?
>>
>> Of course, it seems better.
>>
>> Best Regards
>> Yang Xu
>
> OK... Petr are you going to merge this with your changes?
Thanks for your review, I merged this patch with petr's changes.
Best Regards
Yang Xu
>
> Acked-by: Richard Palethorpe <rpalethorpe@suse.com>
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-25 2:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-18 11:10 [LTP] [PATCH] syscalls/mount03: Add statfs f_flags member check Yang Xu
2022-10-21 22:13 ` Petr Vorel
2022-10-24 1:20 ` xuyang2018.jy
2022-10-24 14:49 ` Richard Palethorpe
2022-10-25 2:13 ` xuyang2018.jy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox