From da49f5852481adb0b3fa0b5ccba93b266f271c35 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 8 Jul 2009 02:58:38 +0200 Subject: [PATCH] move libc related stuff out of platform.h Signed-off-by: Denys Vlasenko --- coreutils/stty.c | 4 --- include/platform.h | 44 ------------------------------ libbb/login.c | 3 +- miscutils/eject.c | 7 +++-- miscutils/hdparm.c | 3 +- util-linux/fdisk.c | 4 +++ util-linux/freeramdisk.c | 2 +- util-linux/mkfs_vfat.c | 9 ++++-- util-linux/mount.c | 31 +++++++++++++++++++-- util-linux/switch_root.c | 6 ++-- util-linux/umount.c | 31 ++++++++++++++++++++- util-linux/volume_id/get_devname.c | 7 +++-- 12 files changed, 84 insertions(+), 67 deletions(-) diff --git a/coreutils/stty.c b/coreutils/stty.c index 5506fdb66..e02fe7c72 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c @@ -68,10 +68,6 @@ # define CSWTCH _POSIX_VDISABLE #endif -#ifndef IUCLC -# define IUCLC 0 -#endif - /* SunOS 5.3 loses (^Z doesn't work) if 'swtch' is the same as 'susp'. So the default is to disable 'swtch.' */ #if defined(__sparc__) && defined(__svr4__) diff --git a/include/platform.h b/include/platform.h index 99e747f0d..7c88d1ba6 100644 --- a/include/platform.h +++ b/include/platform.h @@ -342,49 +342,5 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c) #endif -#if defined(__linux__) -# include -/* Make sure we have all the new mount flags we actually try to use. */ -# ifndef MS_BIND -# define MS_BIND (1 << 12) -# endif -# ifndef MS_MOVE -# define MS_MOVE (1 << 13) -# endif -# ifndef MS_RECURSIVE -# define MS_RECURSIVE (1 << 14) -# endif -# ifndef MS_SILENT -# define MS_SILENT (1 << 15) -# endif -/* The shared subtree stuff, which went in around 2.6.15. */ -# ifndef MS_UNBINDABLE -# define MS_UNBINDABLE (1 << 17) -# endif -# ifndef MS_PRIVATE -# define MS_PRIVATE (1 << 18) -# endif -# ifndef MS_SLAVE -# define MS_SLAVE (1 << 19) -# endif -# ifndef MS_SHARED -# define MS_SHARED (1 << 20) -# endif -# ifndef MS_RELATIME -# define MS_RELATIME (1 << 21) -# endif - -# if !defined(BLKSSZGET) -# define BLKSSZGET _IO(0x12, 104) -# endif -# if !defined(BLKGETSIZE64) -# define BLKGETSIZE64 _IOR(0x12,114,size_t) -# endif -#endif - -/* The field domainname of struct utsname is Linux specific. */ -#if !defined(__linux__) -# define HAVE_NO_UTSNAME_DOMAINNAME -#endif #endif diff --git a/libbb/login.c b/libbb/login.c index 98e641cce..ba9f4d2b5 100644 --- a/libbb/login.c +++ b/libbb/login.c @@ -62,7 +62,8 @@ void FAST_FUNC print_login_issue(const char *issue_file, const char *tty) case 'm': outbuf = uts.machine; break; -#ifndef HAVE_NO_UTSNAME_DOMAINNAME +/* The field domainname of struct utsname is Linux specific. */ +#if defined(__linux__) case 'D': case 'o': outbuf = uts.domainname; diff --git a/miscutils/eject.c b/miscutils/eject.c index 94a36c0da..75618bea6 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c @@ -13,7 +13,11 @@ * Most of the dirty work blatantly ripped off from cat.c =) */ +#include #include "libbb.h" +/* Must be after libbb.h: they need size_t */ +#include +#include /* various defines swiped from linux/cdrom.h */ #define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ @@ -27,9 +31,6 @@ /* Code taken from the original eject (http://eject.sourceforge.net/), * refactored it a bit for busybox (ne-bb@nicoerfurth.de) */ -#include -#include - static void eject_scsi(const char *dev) { static const char sg_commands[3][6] = { diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index e8a483830..362b212a3 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -11,8 +11,9 @@ * hdparm.c - Command line interface to get/set hard disk parameters * - by Mark Lord (C) 1994-2002 -- freely distributable */ -#include "libbb.h" #include +#include +#include "libbb.h" /* device types */ /* ------------ */ diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 514b5d79c..441640831 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -12,6 +12,10 @@ #define _LARGEFILE64_SOURCE #endif #include /* assert */ +#include +#if !defined(BLKSSZGET) +# define BLKSSZGET _IO(0x12, 104) +#endif #include "libbb.h" /* Looks like someone forgot to add this to config system */ diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index bde6afc0a..6b9d95e69 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c @@ -8,7 +8,7 @@ * * Licensed under GPLv2, see file LICENSE in this tarball for details. */ - +#include #include "libbb.h" /* From */ diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c index 8c6078d7b..8d12babdc 100644 --- a/util-linux/mkfs_vfat.c +++ b/util-linux/mkfs_vfat.c @@ -7,12 +7,15 @@ * * Licensed under GPLv2, see file LICENSE in this tarball for details. */ -#include "libbb.h" -#include "volume_id/volume_id_internal.h" - #include /* HDIO_GETGEO */ #include /* FDGETPRM */ +#include /* BLKSSZGET */ +#if !defined(BLKSSZGET) +# define BLKSSZGET _IO(0x12, 104) +#endif //#include +#include "libbb.h" +#include "volume_id/volume_id_internal.h" #define SECTOR_SIZE 512 diff --git a/util-linux/mount.c b/util-linux/mount.c index 72dabd840..56c32e126 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -8,7 +8,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ - // Design notes: There is no spec for mount. Remind me to write one. // // mount_main() calls singlemount() which calls mount_it_now(). @@ -17,9 +16,37 @@ // singlemount() can loop through /etc/filesystems for fstype detection. // mount_it_now() does the actual mount. // - #include #include +#include +#ifndef MS_BIND +# define MS_BIND (1 << 12) +#endif +#ifndef MS_MOVE +# define MS_MOVE (1 << 13) +#endif +#ifndef MS_RECURSIVE +# define MS_RECURSIVE (1 << 14) +#endif +#ifndef MS_SILENT +# define MS_SILENT (1 << 15) +#endif +/* The shared subtree stuff, which went in around 2.6.15. */ +#ifndef MS_UNBINDABLE +# define MS_UNBINDABLE (1 << 17) +#endif +#ifndef MS_PRIVATE +# define MS_PRIVATE (1 << 18) +#endif +#ifndef MS_SLAVE +# define MS_SLAVE (1 << 19) +#endif +#ifndef MS_SHARED +# define MS_SHARED (1 << 20) +#endif +#ifndef MS_RELATIME +# define MS_RELATIME (1 << 21) +#endif #include "libbb.h" #if ENABLE_FEATURE_MOUNT_LABEL diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index 0f00b605a..ff0551843 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c @@ -5,18 +5,16 @@ * * Licensed under GPL version 2, see file LICENSE in this tarball for details. */ -#include "libbb.h" #include - +#include +#include "libbb.h" // Make up for header deficiencies #ifndef RAMFS_MAGIC # define RAMFS_MAGIC ((unsigned)0x858458f6) #endif - #ifndef TMPFS_MAGIC # define TMPFS_MAGIC ((unsigned)0x01021994) #endif - #ifndef MS_MOVE # define MS_MOVE 8192 #endif diff --git a/util-linux/umount.c b/util-linux/umount.c index 5b22bfacc..a4b2bd087 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -7,8 +7,37 @@ * * Licensed under GPL version 2, see file LICENSE in this tarball for details. */ - #include +#include +/* Make sure we have all the new mount flags we actually try to use. */ +#ifndef MS_BIND +# define MS_BIND (1 << 12) +#endif +#ifndef MS_MOVE +# define MS_MOVE (1 << 13) +#endif +#ifndef MS_RECURSIVE +# define MS_RECURSIVE (1 << 14) +#endif +#ifndef MS_SILENT +# define MS_SILENT (1 << 15) +#endif +/* The shared subtree stuff, which went in around 2.6.15. */ +#ifndef MS_UNBINDABLE +# define MS_UNBINDABLE (1 << 17) +#endif +#ifndef MS_PRIVATE +# define MS_PRIVATE (1 << 18) +#endif +#ifndef MS_SLAVE +# define MS_SLAVE (1 << 19) +#endif +#ifndef MS_SHARED +# define MS_SHARED (1 << 20) +#endif +#ifndef MS_RELATIME +# define MS_RELATIME (1 << 21) +#endif #include "libbb.h" #if defined(__dietlibc__) diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c index a1786df1c..0686a0741 100644 --- a/util-linux/volume_id/get_devname.c +++ b/util-linux/volume_id/get_devname.c @@ -7,11 +7,12 @@ * * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ - +#include /* BLKGETSIZE64 */ +#if !defined(BLKGETSIZE64) +# define BLKGETSIZE64 _IOR(0x12,114,size_t) +#endif #include "volume_id_internal.h" -//#define BLKGETSIZE64 _IOR(0x12,114,size_t) - static struct uuidCache_s { struct uuidCache_s *next; // int major, minor; -- 2.25.1