From patchwork Mon Mar 26 20:49:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 26485 Received: (qmail 125805 invoked by alias); 26 Mar 2018 20:49:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 125448 invoked by uid 89); 26 Mar 2018 20:49:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=arrangements X-HELO: relay1.mentorg.com Date: Mon, 26 Mar 2018 20:49:26 +0000 From: Joseph Myers To: Subject: Unify umount function implementations (bug 16552) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) Linux kernel architectures have various arrangements for umount syscalls. There is a syscall that takes flags, and an older one that does not. Newer architectures have only the one taking flags, under the name umount2 (or under the name umount, in the ia64 case). Older architectures may have both, under the names umount2 and umount (or under the names umount and oldumount, in the alpha case). glibc then has several similar implementations of the umount function (no flags) in terms of either the __umount2 function, or the corresponding syscall, or in terms of the old syscall under either of its names. This patch simplifies the implementations in glibc by always using the __umount2 function to implement the umount function on all systems using the Linux kernel. The linux/generic implementation is moved to sysdeps/unix/sysv/linux (without any changes to code or comments) and all the other variants are removed. (This will have the effect of causing the new syscall to be used in some cases that previously used the old one, but as discussed for previous changes, such a change to the underlying syscalls used is OK.) There remain two variants of how the __umount2 function is implemented, either in umount2.S, or, for ia64, in syscalls.list. Tested with build-many-glibcs.py. 2018-03-26 Joseph Myers [BZ #16552] * sysdeps/unix/sysv/linux/generic/umount.c: Move to .... * sysdeps/unix/sysv/linux/umount.c: ... here. * sysdeps/unix/sysv/linux/arm/umount.c: Remove file. * sysdeps/unix/sysv/linux/hppa/umount.c: Likewise. * sysdeps/unix/sysv/linux/ia64/umount.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/umount.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c: Likewise. * sysdeps/unix/sysv/linux/umount.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/umount.c: Likewise. diff --git a/sysdeps/unix/sysv/linux/arm/umount.c b/sysdeps/unix/sysv/linux/arm/umount.c deleted file mode 100644 index 87997e0..0000000 --- a/sysdeps/unix/sysv/linux/arm/umount.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2000-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David Huggins-Daines , 2000. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* Since we don't have an oldumount system call, do what the kernel - does down here. */ - -extern long int __umount2 (const char *name, int flags); - -long int -__umount (const char *name) -{ - return __umount2 (name, 0); -} - -weak_alias (__umount, umount); diff --git a/sysdeps/unix/sysv/linux/generic/umount.c b/sysdeps/unix/sysv/linux/generic/umount.c deleted file mode 100644 index 1c8bea5..0000000 --- a/sysdeps/unix/sysv/linux/generic/umount.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2011-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* Since the generic Linux syscall ABI doesn't have an oldumount system call, - do what the kernel does down here. */ - -extern long int __umount2 (const char *name, int flags); - -long int -__umount (const char *name) -{ - return __umount2 (name, 0); -} - -weak_alias (__umount, umount); diff --git a/sysdeps/unix/sysv/linux/hppa/umount.c b/sysdeps/unix/sysv/linux/hppa/umount.c deleted file mode 100644 index 208fbec..0000000 --- a/sysdeps/unix/sysv/linux/hppa/umount.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/ia64/umount.c b/sysdeps/unix/sysv/linux/ia64/umount.c deleted file mode 100644 index 8cf5a75..0000000 --- a/sysdeps/unix/sysv/linux/ia64/umount.c +++ /dev/null @@ -1,29 +0,0 @@ -/* umount system call for Linux/ia64. - Copyright (C) 2003-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include - -#include - -/* Unmount a filesystem. */ -int -umount (const char *special_file) -{ - return INLINE_SYSCALL (umount, 2, special_file, 0); -} diff --git a/sysdeps/unix/sysv/linux/mips/mips64/umount.c b/sysdeps/unix/sysv/linux/mips/mips64/umount.c deleted file mode 100644 index 87997e0..0000000 --- a/sysdeps/unix/sysv/linux/mips/mips64/umount.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2000-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David Huggins-Daines , 2000. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* Since we don't have an oldumount system call, do what the kernel - does down here. */ - -extern long int __umount2 (const char *name, int flags); - -long int -__umount (const char *name) -{ - return __umount2 (name, 0); -} - -weak_alias (__umount, umount); diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c deleted file mode 100644 index e10b40f..0000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/umount.S b/sysdeps/unix/sysv/linux/umount.S deleted file mode 100644 index e18463e..0000000 --- a/sysdeps/unix/sysv/linux/umount.S +++ /dev/null @@ -1,12 +0,0 @@ -/* This hack is necessary since the kernel people are making "strange" - changes. They simply rename old system calls. */ - -#include -#ifdef __NR_oldumount -PSEUDO (__umount, oldumount, 1) -#else -PSEUDO (__umount, umount, 1) -#endif - ret -PSEUDO_END(__umount) -weak_alias (__umount, umount) diff --git a/sysdeps/unix/sysv/linux/umount.c b/sysdeps/unix/sysv/linux/umount.c new file mode 100644 index 0000000..1c8bea5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/umount.c @@ -0,0 +1,30 @@ +/* Copyright (C) 2011-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +/* Since the generic Linux syscall ABI doesn't have an oldumount system call, + do what the kernel does down here. */ + +extern long int __umount2 (const char *name, int flags); + +long int +__umount (const char *name) +{ + return __umount2 (name, 0); +} + +weak_alias (__umount, umount); diff --git a/sysdeps/unix/sysv/linux/x86_64/umount.c b/sysdeps/unix/sysv/linux/x86_64/umount.c deleted file mode 100644 index 9030774..0000000 --- a/sysdeps/unix/sysv/linux/x86_64/umount.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2000-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David Huggins-Daines , 2000. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Since we don't have an oldumount system call, do what the kernel - does down here. */ - -extern long int __umount2 (const char *name, int flags); - -long int -__umount (const char *name) -{ - return __umount2 (name, 0); -} - -weak_alias (__umount, umount);