[LTP] [PATCH] mknod01: Rewrite the test using new LTP API
Avinesh Kumar
akumar@suse.de
Tue Feb 28 16:30:59 CET 2023
Hi Cyril,
On Friday, February 24, 2023 8:33:34 PM IST Cyril Hrubis wrote:
> Hi!
> > + if (S_ISCHR(tcases[i]))
> > + dev = makedev(1, 3);
> > + else
> > + dev = 0;
>
> Reading 'man 2 mknod' I suppose that we should pass non-zero dev for
> block devices as well. Hoever the test seems to work fine with zero dev
> for both cases.
>
> Btw makedev(1, 3) seems to be the /dev/null char device and it should
> work for block devices since block makedev(1, 3) would be /dev/ram3, so
> what about:
Thank you for the review and yes I overlooked block devices scenario, your suggested
patch looks good, should I send this as v2 or will you merge with these changes?
>
> diff --git a/testcases/kernel/syscalls/mknod/mknod01.c b/testcases/kernel/syscalls/mknod/mknod01.c
> index d4b8c7bf8..7a4d5b43f 100644
> --- a/testcases/kernel/syscalls/mknod/mknod01.c
> +++ b/testcases/kernel/syscalls/mknod/mknod01.c
> @@ -31,12 +31,10 @@ static int tcases[] = {
>
> static void run(unsigned int i)
> {
> - dev_t dev;
> + dev_t dev = 0;
>
> - if (S_ISCHR(tcases[i]))
> + if (S_ISCHR(tcases[i]) || S_ISBLK(tcases[i]))
> dev = makedev(1, 3);
> - else
> - dev = 0;
>
> TST_EXP_PASS(mknod(PATH, tcases[i], dev),
> "mknod(PATH, %o, %ld)",
>
>
>
Regards,
Avinesh
More information about the ltp
mailing list