public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>, ltp@lists.linux.it
Cc: Martin Doucha <martin.doucha@suse.com>
Subject: Re: [LTP] [PATCH v3 1/4] lib: Add tst_fd iterator
Date: Tue, 16 Jan 2024 01:32:19 +0100	[thread overview]
Message-ID: <20240116003219.GD2535088@pevik> (raw)
In-Reply-To: <20240115230952.GA2535088@pevik>

Hi all,

[ removed kernel folks to not bother them with our old distros ]

> Obviously ready to merge, thanks!

I'm sorry, there are still 2 build failures [1] even with my attempt to fix it [2]:

Both Leap 42.2 and Ubuntu Bionic fail to build on:

In file included from ../include/lapi/io_uring.h:17:0,
                 from tst_fd.c:21:
/usr/include/sys/mount.h:35:3: error: expected identifier before numeric constant
   MS_RDONLY = 1,  /* Mount read-only.  */
   ^

I found quite useful to have new LTP for these old distros, but if it's too much
pain I'm ok to drop them. I'm not even sure if it's possible to fix it.
The only way to do that would be for these old distros (which cannot combine
these two headers) to also avoid BPF and io_uring. Code below compiles [3], but
I don't think myself it's a good solution even if we polish the check (transform
into m4 macro).

OTOH fsopen haven't been defined in <sys/mount.h> yet in libc (checked: glibc,
musl, uclibc-ng, bionic), thus the effect would be that we'd just use
<linux/mount.h> instead of <sys/mount.h> in lib/*.c. And mount() related tests
which test <sys/mount.h> (or use lapi/mount.h) could not include <linux/mount.h>
nor <linux/io_uring.h> nor <lapi/bpf.h>. Of course, we can't keep these two old
distros too long.

Kind regards,
Petr

[1] https://github.com/pevik/ltp/actions/runs/7534892435
[2] https://lore.kernel.org/ltp/20240105002914.1463989-1-pvorel@suse.cz/
[3] https://github.com/pevik/ltp/actions/runs/7535285434

> Kind regards,
> Petr

diff --git include/lapi/fsmount.h include/lapi/fsmount.h
index 07eb42ffa..a9491a16d 100644
--- include/lapi/fsmount.h
+++ include/lapi/fsmount.h
@@ -11,12 +11,11 @@
 #include "config.h"
 #include <sys/syscall.h>
 #include <sys/types.h>
-#include <sys/mount.h>
 
-#ifndef HAVE_FSOPEN
-# ifdef HAVE_LINUX_MOUNT_H
+#if !defined(HAVE_FSOPEN) && defined(HAVE_LINUX_MOUNT_H)
 # include <linux/mount.h>
-# endif
+#else
+# include <sys/mount.h>
 #endif
 
 #include "lapi/fcntl.h"
diff --git include/tst_fd.h include/tst_fd.h
index 2183ea068..cdf9867e6 100644
--- include/tst_fd.h
+++ include/tst_fd.h
@@ -26,8 +26,10 @@ enum tst_fd_type {
 	TST_FD_INOTIFY,
 	TST_FD_USERFAULTFD,
 	TST_FD_PERF_EVENT,
+#if defined(HAVE_FSOPEN) || !defined(HAVE_LINUX_MOUNT_H)
 	TST_FD_IO_URING,
 	TST_FD_BPF_MAP,
+#endif
 	TST_FD_FSOPEN,
 	TST_FD_FSPICK,
 	TST_FD_OPEN_TREE,
diff --git lib/tst_fd.c lib/tst_fd.c
index b0d6fb1d6..0766328a9 100644
--- lib/tst_fd.c
+++ lib/tst_fd.c
@@ -18,9 +18,12 @@
 #include "tst_safe_macros.h"
 
 #include "lapi/pidfd.h"
+#include "lapi/fsmount.h"
+
+#if defined(HAVE_FSOPEN) || !defined(HAVE_LINUX_MOUNT_H)
 #include "lapi/io_uring.h"
 #include "lapi/bpf.h"
-#include "lapi/fsmount.h"
+#endif
 
 #include "tst_fd.h"
 
@@ -190,6 +193,7 @@ static void open_perf_event(struct tst_fd *fd)
 	}
 }
 
+#if defined(HAVE_FSOPEN) || !defined(HAVE_LINUX_MOUNT_H)
 static void open_io_uring(struct tst_fd *fd)
 {
 	struct io_uring_params uring_params = {};
@@ -216,6 +220,7 @@ static void open_bpf_map(struct tst_fd *fd)
 			"Skipping %s", tst_fd_desc(fd));
 	}
 }
+#endif
 
 static void open_fsopen(struct tst_fd *fd)
 {
@@ -281,8 +286,10 @@ static struct tst_fd_desc fd_desc[] = {
 	[TST_FD_INOTIFY] = {.open_fd = open_inotify, .desc = "inotify"},
 	[TST_FD_USERFAULTFD] = {.open_fd = open_userfaultfd, .desc = "userfaultfd"},
 	[TST_FD_PERF_EVENT] = {.open_fd = open_perf_event, .desc = "perf event"},
+#if defined(HAVE_FSOPEN) || !defined(HAVE_LINUX_MOUNT_H)
 	[TST_FD_IO_URING] = {.open_fd = open_io_uring, .desc = "io uring"},
 	[TST_FD_BPF_MAP] = {.open_fd = open_bpf_map, .desc = "bpf map"},
+#endif
 	[TST_FD_FSOPEN] = {.open_fd = open_fsopen, .desc = "fsopen"},
 	[TST_FD_FSPICK] = {.open_fd = open_fspick, .desc = "fspick"},
 	[TST_FD_OPEN_TREE] = {.open_fd = open_open_tree, .desc = "open_tree"},

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

  reply	other threads:[~2024-01-16  0:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 12:53 [LTP] [PATCH v3 0/4] Add tst_fd iterator API Cyril Hrubis
2024-01-15 12:53 ` [LTP] [PATCH v3 1/4] lib: Add tst_fd iterator Cyril Hrubis
2024-01-15 23:09   ` Petr Vorel
2024-01-16  0:32     ` Petr Vorel [this message]
2024-01-16 15:19       ` Cyril Hrubis
2024-01-16 15:31         ` Petr Vorel
2024-01-17 15:38           ` Cyril Hrubis
2024-01-15 12:53 ` [LTP] [PATCH v3 2/4] syscalls: readahead01: Make use of tst_fd Cyril Hrubis
2024-01-15 23:16   ` Petr Vorel
2024-01-17 14:49   ` Jan Kara
2024-01-15 12:53 ` [LTP] [PATCH v3 3/4] syscalls: accept: Add tst_fd test Cyril Hrubis
2024-01-15 23:22   ` Petr Vorel
2024-01-17 14:49   ` Jan Kara
2024-01-15 12:53 ` [LTP] [PATCH v3 4/4] syscalls: splice07: New splice tst_fd iterator test Cyril Hrubis
2024-01-17 14:50   ` Jan Kara

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=20240116003219.GD2535088@pevik \
    --to=pvorel@suse.cz \
    --cc=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=martin.doucha@suse.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