ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Avinesh Kumar <akumar@suse.de>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] mknod01: Rewrite the test using new LTP API
Date: Tue, 28 Feb 2023 21:00:59 +0530	[thread overview]
Message-ID: <3121397.4e4APuK8be@localhost> (raw)
In-Reply-To: <Y/jRxug4oBqJeEmy@yuki>

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





-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2023-02-28 15:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22  3:45 [LTP] [PATCH] mknod01: Rewrite the test using new LTP API Avinesh Kumar
2023-02-24 15:03 ` Cyril Hrubis
2023-02-28 15:30   ` Avinesh Kumar [this message]
2023-03-01 15:43     ` Cyril Hrubis
2023-02-28 15:42   ` [LTP] [PATCH v2 1/1] " Avinesh Kumar
2023-03-01  1:50     ` Li Wang
2023-03-02 20:04     ` Cyril Hrubis

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=3121397.4e4APuK8be@localhost \
    --to=akumar@suse.de \
    --cc=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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).