From ea9160e0fcaf463a2339b47ad2cd00c56e806352 Mon Sep 17 00:00:00 2001 From: Yang Xu Date: Tue, 25 Apr 2023 16:21:30 +0800 Subject: [PATCH] src: Don't include and together Newer glibc such as glibc 2.36 also defines 'struct mount_attr' in addition to . Usually we should use glibc header instead of kernel header. But now mount.h is a special case because both new glibc header and kernel header all define "struct mount_attr'. They also define MS* macro. Since we have some syscall wrapper in vfs/missing.h, we can use directly instead of for detached_mounts_propagation.c. For utils.c, it doesn't use the macro or function in , so remove it directly. In fact, newer glibc(2.37-1)[1] has sloved conflict problem between and . In the future(maybe ten years), we can remove this kernel header and use glibc header. [1]https://sourceware.org/git/?p=glibc.git;a=commit;h=774058d72942249f71d74e7f2b639f77184160a6 Acked-by: Christian Brauner Signed-off-by: Yang Xu Reviewed-by: Zorro Lang Tested-by: Ziyang Zhang Signed-off-by: Zorro Lang --- src/detached_mounts_propagation.c | 5 ++--- src/vfs/utils.c | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/detached_mounts_propagation.c b/src/detached_mounts_propagation.c index 17db2c02..dd11f7be 100644 --- a/src/detached_mounts_propagation.c +++ b/src/detached_mounts_propagation.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -127,7 +126,7 @@ int main(int argc, char *argv[]) if (ret < 0) exit_log("%m - Failed to create new mount namespace"); - ret = mount(NULL, base_dir, NULL, MS_REC | MS_SHARED, NULL); + ret = sys_mount(NULL, base_dir, NULL, MS_REC | MS_SHARED, NULL); if (ret < 0) exit_log("%m - Failed to make base_dir shared mountpoint"); @@ -174,7 +173,7 @@ int main(int argc, char *argv[]) } close(fd_tree); - ret = umount2(target, MNT_DETACH); + ret = sys_umount2(target, MNT_DETACH); if (ret < 0) { fprintf(stderr, "%m - Failed to unmount %s", target); exit_code = EXIT_FAILURE; diff --git a/src/vfs/utils.c b/src/vfs/utils.c index 9e67ac37..0ab5de15 100644 --- a/src/vfs/utils.c +++ b/src/vfs/utils.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include -- 2.39.5