public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
Cc: Ming Lei <ming.lei@redhat.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH blktests v3 1/2] src: add mini ublk source code
Date: Mon, 27 Feb 2023 05:41:30 +0000	[thread overview]
Message-ID: <20230227054130.eygpm5e22yejug6t@shindev> (raw)
In-Reply-To: <f20ad4c4-fc74-0bea-a07d-8f6c8a028754@linux.alibaba.com>

On Feb 27, 2023 / 10:57, Ziyang Zhang wrote:
> On 2023/2/24 19:41, Shinichiro Kawasaki wrote:
> > On Feb 24, 2023 / 16:28, Ming Lei wrote:
> >> On Fri, Feb 24, 2023 at 03:52:28PM +0800, Ziyang Zhang wrote:
> >>> On 2023/2/20 11:46, Ming Lei wrote:
> >>>
> >>> [...]
> >>>
> >>>>
> >>>> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> >>>> ---
> >>>>  src/.gitignore |    1 +
> >>>>  src/Makefile   |   18 +
> >>>>  src/miniublk.c | 1376 ++++++++++++++++++++++++++++++++++++++++++++++++
> >>>>  3 files changed, 1395 insertions(+)
> >>>>  create mode 100644 src/miniublk.c
> >>>>
> >>>> diff --git a/src/.gitignore b/src/.gitignore
> >>>> index 355bed3..df7aff5 100644
> >>>> --- a/src/.gitignore
> >>>> +++ b/src/.gitignore
> >>>> @@ -8,3 +8,4 @@
> >>>>  /sg/dxfer-from-dev
> >>>>  /sg/syzkaller1
> >>>>  /zbdioctl
> >>>> +/miniublk
> >>>> diff --git a/src/Makefile b/src/Makefile
> >>>> index 3b587f6..81c6541 100644
> >>>> --- a/src/Makefile
> >>>> +++ b/src/Makefile
> >>>> @@ -2,6 +2,10 @@ HAVE_C_HEADER = $(shell if echo "\#include <$(1)>" |		\
> >>>>  		$(CC) -E - > /dev/null 2>&1; then echo "$(2)";	\
> >>>>  		else echo "$(3)"; fi)
> >>>>  
> >>>> +HAVE_C_MACRO = $(shell if echo "#include <$(1)>" |	\
> >>> Hi Ming,
> >>>
> >>> It should be "\#include", not "#include". You miss a "\".
> >>
> >> "\#include" won't work for checking the macro of IORING_OP_URING_CMD.
> >>
> >> [root@ktest-36 linux]# echo "\#include <liburing.h>" | gcc -E -
> >> # 0 "<stdin>"
> >> # 0 "<built-in>"
> >> # 0 "<command-line>"
> >> # 1 "/usr/include/stdc-predef.h" 1 3 4
> >> # 0 "<command-line>" 2
> >> # 1 "<stdin>"
> >> \#include <liburing.h>
> > 
> > I also tried and observed the same symptom. HAVE_C_MACRO works well without the
> > backslash. Adding the backslash, it fails.
> > 
> > I think Ziyang made the comment because HAVE_C_HEADER has the backslash. (Thanks
> > for catching the difference between HAVA_C_HEADER and HAVE_C_MACRO.) I think
> > another fix is needed to remove that backslash from HAVE_C_HEADER.  I've create
> > a one liner fix patch quickly [1]. It looks ok for blktests CI. I will revisit
> > it after Ming's patches get settled.
> > 
> > [1] https://github.com/osandov/blktests/pull/112/commits/dd5852e69abc3247d7b0ec4faf916a395378362d
> > 
> 
> Hello,
> 
> Sorry, I am not familiar with shell script. But **without** the backslash,
> I get this error:
> 
> $ make
> make -C src all
> make[1]: Entering directory '/home/alinux/workspace/blktests/src'
> Makefile:5: *** unterminated call to function 'shell': missing ')'.  Stop.
> make[1]: Leaving directory '/home/alinux/workspace/blktests/src'
> make: *** [Makefile:5: all] Error 2

I see... I googled and learned that make version 4.3 introduced this '# inside
macro' handling difference [2]. I guess your make has version older than 4.3,
isn't it?

[2] https://lwn.net/Articles/810071/

Per the the LWN article [2], the fix should be as follows. It works as expected
on my system with make version 4.3. Could you try it on your system?

diff --git a/src/Makefile b/src/Makefile
index 81c6541..322eb1c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,8 +1,10 @@
-HAVE_C_HEADER = $(shell if echo "\#include <$(1)>" |		\
+H := \#
+
+HAVE_C_HEADER = $(shell if echo "$(H)include <$(1)>" |		\
 		$(CC) -E - > /dev/null 2>&1; then echo "$(2)";	\
 		else echo "$(3)"; fi)
 
-HAVE_C_MACRO = $(shell if echo "#include <$(1)>" |	\
+HAVE_C_MACRO = $(shell if echo -e "$(H)include <$(1)>" |	\
 		$(CC) -E - 2>&1 /dev/null | grep $(2) > /dev/null 2>&1; \
 		then echo 1;else echo 0; fi)
 


-- 
Shin'ichiro Kawasaki

  reply	other threads:[~2023-02-27  5:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20  3:46 [PATCH blktests v3 0/2] blktests: add mini ublk source and blktests/033 Ming Lei
2023-02-20  3:46 ` [PATCH blktests v3 1/2] src: add mini ublk source code Ming Lei
2023-02-21 19:58   ` Chaitanya Kulkarni
2023-02-24  8:40     ` Ming Lei
2023-02-24  8:45       ` Ming Lei
2023-02-24  7:52   ` Ziyang Zhang
2023-02-24  8:28     ` Ming Lei
2023-02-24 11:41       ` Shinichiro Kawasaki
2023-02-27  2:57         ` Ziyang Zhang
2023-02-27  5:41           ` Shinichiro Kawasaki [this message]
2023-02-27  6:10             ` Ziyang Zhang
2023-02-28  9:25               ` Shinichiro Kawasaki
2023-02-20  3:46 ` [PATCH blktests v3 2/2] block/033: add test to cover gendisk leak Ming Lei
2023-02-20 13:03 ` [PATCH blktests v3 0/2] blktests: add mini ublk source and blktests/033 Shinichiro Kawasaki

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=20230227054130.eygpm5e22yejug6t@shindev \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=ZiyangZhang@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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