All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Branco <rbranco@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v5 1/2] memfd_create: move sys_memfd_create() to lapi/memfd.h
Date: Thu,  9 Apr 2026 17:19:22 +0200	[thread overview]
Message-ID: <20260409151926.239092-1-rbranco@suse.de> (raw)
In-Reply-To: <20260331220354.297027-1-rbranco@suse.de>

Add the static inline wrapper to include/lapi/memfd.h and include the
required headers so other tests can reuse it.

Also fix some minor issues detected by make check.

Signed-off-by: Ricardo Branco <rbranco@suse.de>
---
 include/lapi/memfd.h                                      | 8 ++++++++
 testcases/kernel/syscalls/memfd_create/memfd_create01.c   | 1 -
 .../kernel/syscalls/memfd_create/memfd_create_common.c    | 5 -----
 .../kernel/syscalls/memfd_create/memfd_create_common.h    | 4 +---
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/lapi/memfd.h b/include/lapi/memfd.h
index 57b6cd83d..46ccb0a3f 100644
--- a/include/lapi/memfd.h
+++ b/include/lapi/memfd.h
@@ -6,6 +6,9 @@
 #ifndef LAPI_MEMFD_H__
 #define LAPI_MEMFD_H__
 
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+
 /* flags for memfd_create(2) (unsigned int) */
 #ifndef MFD_CLOEXEC
 # define MFD_CLOEXEC             0x0001U
@@ -47,4 +50,9 @@
 #define MFD_HUGE_16GB (34 << 26)
 #endif
 
+static inline int sys_memfd_create(const char *name, unsigned int flags)
+{
+	return tst_syscall(__NR_memfd_create, name, flags);
+}
+
 #endif /* LAPI_MEMFD_H__ */
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create01.c b/testcases/kernel/syscalls/memfd_create/memfd_create01.c
index 73f6b01e8..28ad04a86 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create01.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create01.c
@@ -212,7 +212,6 @@ static void test_share_open(int fd)
 	SAFE_CLOSE(fd2);
 }
 
-
 static const struct tcase {
 	int flags;
 	void (*func)(int fd);
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create_common.c b/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
index a52b02a56..63e8daac5 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
@@ -24,11 +24,6 @@
 
 #include "memfd_create_common.h"
 
-int sys_memfd_create(const char *name, unsigned int flags)
-{
-	return tst_syscall(__NR_memfd_create, name, flags);
-}
-
 int check_fallocate(const char *filename, const int lineno, int fd,
 			int mode, off_t offset, off_t len)
 {
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create_common.h b/testcases/kernel/syscalls/memfd_create/memfd_create_common.h
index 60ad895fe..df809d6c7 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create_common.h
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create_common.h
@@ -50,7 +50,7 @@
 	check_munmap(__FILE__, __LINE__, (p), (length))
 
 #define CHECK_MFD_HAS_SEALS(fd, seals) \
-	check_mfd_has_seals(__FILE__, __LINE__, (fd), (seals));
+	check_mfd_has_seals(__FILE__, __LINE__, (fd), (seals))
 
 #define CHECK_MFD_ADD_SEALS(fd, seals) \
 	({int r = SAFE_FCNTL((fd), F_ADD_SEALS, (seals)); \
@@ -101,8 +101,6 @@ int mfd_flags_available(const char *filename, const int lineno,
 
 int get_mfd_all_available_flags(const char *filename, const int lineno);
 
-int sys_memfd_create(const char *name, unsigned int flags);
-
 int check_fallocate(const char *filename, const int lineno, int fd,
 			int mode, off_t offset, off_t len);
 int check_fallocate_fail(const char *filename, const int lineno, int fd,
-- 
2.53.0


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

  parent reply	other threads:[~2026-04-09 15:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 22:03 [LTP] [PATCH v3] userfaultfd: Add new test using UFFDIO_CONTINUE Ricardo Branco
2026-04-01 21:03 ` [LTP] [PATCH v4 1/2] memfd_create: move sys_memfd_create() to lapi/memfd.h Ricardo Branco
2026-04-01 21:03   ` [LTP] [PATCH v4 2/2] userfaultfd: Add new test using UFFDIO_CONTINUE Ricardo Branco
2026-04-09 14:15     ` Andrea Cervesato via ltp
2026-04-09 14:51       ` Andrea Cervesato via ltp
2026-04-09 15:19 ` Ricardo Branco [this message]
2026-04-09 15:19   ` [LTP] [PATCH v5 " Ricardo Branco
2026-04-11  9:47 ` [LTP] [PATCH v6 1/2] memfd_create: move sys_memfd_create() to lapi/memfd.h Ricardo Branco
2026-04-11  9:47   ` [LTP] [PATCH v6 2/2] userfaultfd: Add new test using UFFDIO_CONTINUE Ricardo Branco
2026-04-29 14:35     ` Andrea Cervesato via ltp
2026-04-29 14:37       ` Andrea Cervesato via ltp
2026-05-05 14:12     ` Cyril Hrubis
2026-05-05 14:28       ` Ricardo Branco
2026-05-05 14:50         ` Cyril Hrubis
2026-04-11 10:44   ` [LTP] memfd_create: move sys_memfd_create() to lapi/memfd.h acervesato
2026-05-05 12:24     ` Cyril Hrubis
2026-05-05 12:22   ` [LTP] [PATCH v6 1/2] " 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=20260409151926.239092-1-rbranco@suse.de \
    --to=rbranco@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.