ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Avinesh Kumar <akumar@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] mknod01: Rewrite the test using new LTP API
Date: Fri, 24 Feb 2023 16:03:34 +0100	[thread overview]
Message-ID: <Y/jRxug4oBqJeEmy@yuki> (raw)
In-Reply-To: <20230222034501.11800-1-akumar@suse.de>

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:

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)",


-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2023-02-24 15:02 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 [this message]
2023-02-28 15:30   ` Avinesh Kumar
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=Y/jRxug4oBqJeEmy@yuki \
    --to=chrubis@suse.cz \
    --cc=akumar@suse.de \
    --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).