[git commit future] umount: make umount2 depend on UCLIBC_LINUX_SPECIFIC

Peter S. Mazinger ps.m at gmx.net
Wed Apr 20 10:50:38 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=85a8d7a6f833b615b7979ca3e1aeb56ca71bfc43
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

Add hidden umount2 to be used in umount eventually.
Rework umount to either use directly umount2 syscall or function.

docs say, that mount and umount are also Linux specific

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 include/sys/mount.h                   |    3 +++
 libc/sysdeps/linux/common/Makefile.in |    5 +++--
 libc/sysdeps/linux/common/umount.c    |   17 ++++-------------
 libc/sysdeps/linux/common/umount2.c   |    7 +++----
 4 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/include/sys/mount.h b/include/sys/mount.h
index 57d440f..f3198e6 100644
--- a/include/sys/mount.h
+++ b/include/sys/mount.h
@@ -115,8 +115,11 @@ extern int mount (__const char *__special_file, __const char *__dir,
 /* Unmount a filesystem.  */
 extern int umount (__const char *__special_file) __THROW;
 
+#ifdef __UCLIBC_LINUX_SPECIFIC__
 /* Unmount a filesystem.  Force unmounting if FLAGS is set to MNT_FORCE.  */
 extern int umount2 (__const char *__special_file, int __flags) __THROW;
+libc_hidden_proto(umount2)
+#endif
 
 __END_DECLS
 
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index c8fbeb5..da2bad1 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -25,8 +25,9 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \
 	modify_ldt.c personality.c ppoll.c prctl.c readahead.c reboot.c \
 	remap_file_pages.c sched_getaffinity.c sched_setaffinity.c \
 	sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \
-	splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \
-	sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c
+	splice.c signalfd.c swapoff.c swapon.c sync_file_range.c \
+	sysctl.c sysinfo.c tee.c timerfd.c uselib.c umount2.c \
+	vhangup.c vmsplice.c
 ifeq ($(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE),yy)
 CSRC-y += madvise.c
 endif
diff --git a/libc/sysdeps/linux/common/umount.c b/libc/sysdeps/linux/common/umount.c
index a084d29..916c6c8 100644
--- a/libc/sysdeps/linux/common/umount.c
+++ b/libc/sysdeps/linux/common/umount.c
@@ -9,24 +9,15 @@
 
 #include <sys/syscall.h>
 
-#if defined __USE_GNU
 #include <sys/mount.h>
-
-/* arch provides umount() syscall */
 #ifdef __NR_umount
-
 _syscall1(int, umount, const char *, specialfile)
-
-/* arch provides umount2() syscall */
 #elif defined __NR_umount2
-
-# define __NR___syscall_umount2 __NR_umount2
-static __inline__ _syscall2(int, __syscall_umount2, const char *, special_file, int, flags)
-
+# ifndef  __UCLIBC_LINUX_SPECIFIC__
+static __always_inline _syscall2(int, umount2, const char *, special_file, int, flags)
+# endif
 int umount(const char *special_file)
 {
-	return (__syscall_umount2(special_file, 0));
+	return umount2(special_file, 0);
 }
-
-#endif
 #endif
diff --git a/libc/sysdeps/linux/common/umount2.c b/libc/sysdeps/linux/common/umount2.c
index 2cc4a23..08e0f33 100644
--- a/libc/sysdeps/linux/common/umount2.c
+++ b/libc/sysdeps/linux/common/umount2.c
@@ -9,9 +9,8 @@
 
 #include <sys/syscall.h>
 
-#if defined __USE_GNU
-#include <sys/mount.h>
-#ifdef __NR_umount2	/* Old kernels don't have umount2 */
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __NR_umount2
+# include <sys/mount.h>
 _syscall2(int, umount2, const char *, special_file, int, flags)
-#endif
+libc_hidden_def(umount2)
 #endif
-- 
1.7.3.4



More information about the uClibc-cvs mailing list