[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250515-nolibc-sys-v1-2-74f82eea3b59@weissschuh.net>
Date: Thu, 15 May 2025 21:57:48 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Willy Tarreau <w@....eu>, Shuah Khan <shuah@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 2/9] tools/nolibc: move mount() to sys/mount.h
This is the location regular userspace expects this definition.
Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
tools/include/nolibc/Makefile | 1 +
tools/include/nolibc/nolibc.h | 1 +
tools/include/nolibc/sys.h | 20 --------------------
tools/include/nolibc/sys/mount.h | 37 +++++++++++++++++++++++++++++++++++++
4 files changed, 39 insertions(+), 20 deletions(-)
diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index 7d66847df91a94ca784c04ced278eb6d7099bab4..aa14dfddd77deb5442a6be65dee5684b6d218da7 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -51,6 +51,7 @@ all_files := \
sys/auxv.h \
sys/ioctl.h \
sys/mman.h \
+ sys/mount.h \
sys/random.h \
sys/stat.h \
sys/syscall.h \
diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index d6048d1e9ea5d4b5d504e156aafc5651dcd6b8c1..690368f8e46c33df37c824429cf89dd0e95bb806 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -99,6 +99,7 @@
#include "sys/auxv.h"
#include "sys/ioctl.h"
#include "sys/mman.h"
+#include "sys/mount.h"
#include "sys/random.h"
#include "sys/stat.h"
#include "sys/syscall.h"
diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
index 313c210173c804f728b0be4ab8e67542bb3a7219..e66dd6e760557333353d98da2627b038dffe7f93 100644
--- a/tools/include/nolibc/sys.h
+++ b/tools/include/nolibc/sys.h
@@ -672,26 +672,6 @@ int mknod(const char *path, mode_t mode, dev_t dev)
return __sysret(sys_mknod(path, mode, dev));
}
-/*
- * int mount(const char *source, const char *target,
- * const char *fstype, unsigned long flags,
- * const void *data);
- */
-static __attribute__((unused))
-int sys_mount(const char *src, const char *tgt, const char *fst,
- unsigned long flags, const void *data)
-{
- return my_syscall5(__NR_mount, src, tgt, fst, flags, data);
-}
-
-static __attribute__((unused))
-int mount(const char *src, const char *tgt,
- const char *fst, unsigned long flags,
- const void *data)
-{
- return __sysret(sys_mount(src, tgt, fst, flags, data));
-}
-
/*
* int pipe2(int pipefd[2], int flags);
diff --git a/tools/include/nolibc/sys/mount.h b/tools/include/nolibc/sys/mount.h
new file mode 100644
index 0000000000000000000000000000000000000000..5129420e716d0a7e75c32a5bbc8f4e9f0e21b03b
--- /dev/null
+++ b/tools/include/nolibc/sys/mount.h
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
+/*
+ * Mount definitions for NOLIBC
+ * Copyright (C) 2017-2021 Willy Tarreau <w@....eu>
+ */
+
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
+#ifndef _NOLIBC_SYS_MOUNT_H
+#define _NOLIBC_SYS_MOUNT_H
+
+#include "../sys.h"
+
+#include <linux/mount.h>
+
+/*
+ * int mount(const char *source, const char *target,
+ * const char *fstype, unsigned long flags,
+ * const void *data);
+ */
+static __attribute__((unused))
+int sys_mount(const char *src, const char *tgt, const char *fst,
+ unsigned long flags, const void *data)
+{
+ return my_syscall5(__NR_mount, src, tgt, fst, flags, data);
+}
+
+static __attribute__((unused))
+int mount(const char *src, const char *tgt,
+ const char *fst, unsigned long flags,
+ const void *data)
+{
+ return __sysret(sys_mount(src, tgt, fst, flags, data));
+}
+
+#endif /* _NOLIBC_SYS_MOUNT_H */
--
2.49.0
Powered by blists - more mailing lists