aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2016-10-25 16:29:15 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2016-10-25 16:29:15 +0000
commit5d71efbecd873e18f487db1d88d9adb345963e95 (patch)
treeb32f69612ac558efcc3c24ec32ad92d82759f7f2 /usr.sbin/makefs
parent72b09927ed3ce7255a6a69c5cb15643cf24fb317 (diff)
downloadsrc-5d71efbecd873e18f487db1d88d9adb345963e95.tar.gz
src-5d71efbecd873e18f487db1d88d9adb345963e95.zip
Be more precise when including headers so that we're less likely to
depend on namespace pollution and as such become more portable. This means including headers like <sys/types.h> or <stdlib.h>, but also making sure we include system/host headers before local headers. While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR on Linux. With this, makefs is ready for compilation on macOS and Linux.
Notes
Notes: svn path=/head/; revision=307927
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r--usr.sbin/makefs/cd9660.c5
-rw-r--r--usr.sbin/makefs/cd9660/cd9660_archimedes.c2
-rw-r--r--usr.sbin/makefs/cd9660/iso9660_rrip.c12
-rw-r--r--usr.sbin/makefs/ffs/ffs_bswap.c9
-rw-r--r--usr.sbin/makefs/ffs/ffs_subr.c1
-rw-r--r--usr.sbin/makefs/mtree.c5
-rw-r--r--usr.sbin/makefs/walk.c1
7 files changed, 24 insertions, 11 deletions
diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c
index 63d07736f425..0a1156de3627 100644
--- a/usr.sbin/makefs/cd9660.c
+++ b/usr.sbin/makefs/cd9660.c
@@ -98,10 +98,11 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <string.h>
-#include <ctype.h>
#include <sys/param.h>
#include <sys/queue.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
#include "makefs.h"
#include "cd9660.h"
diff --git a/usr.sbin/makefs/cd9660/cd9660_archimedes.c b/usr.sbin/makefs/cd9660/cd9660_archimedes.c
index d18a0f7b51c0..7a23e245ed8f 100644
--- a/usr.sbin/makefs/cd9660/cd9660_archimedes.c
+++ b/usr.sbin/makefs/cd9660/cd9660_archimedes.c
@@ -40,9 +40,11 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/types.h>
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "makefs.h"
diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.c b/usr.sbin/makefs/cd9660/iso9660_rrip.c
index 749747ba5bd1..1d7539997971 100644
--- a/usr.sbin/makefs/cd9660/iso9660_rrip.c
+++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c
@@ -35,14 +35,16 @@
* defined in iso9660_rrip.h
*/
-#include "makefs.h"
-#include "cd9660.h"
-#include "iso9660_rrip.h"
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/queue.h>
+#include <sys/types.h>
#include <stdio.h>
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+#include "makefs.h"
+#include "cd9660.h"
+#include "iso9660_rrip.h"
static void cd9660_rrip_initialize_inode(cd9660node *);
static int cd9660_susp_handle_continuation(cd9660node *);
diff --git a/usr.sbin/makefs/ffs/ffs_bswap.c b/usr.sbin/makefs/ffs/ffs_bswap.c
index d2a3781b3823..d2f9fb16e5ba 100644
--- a/usr.sbin/makefs/ffs/ffs_bswap.c
+++ b/usr.sbin/makefs/ffs/ffs_bswap.c
@@ -38,18 +38,19 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#endif
-#include <ufs/ufs/dinode.h>
-#include "ffs/ufs_bswap.h"
-#include <ufs/ffs/fs.h>
-
#if !defined(_KERNEL)
#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define panic(x) printf("%s\n", (x)), abort()
#endif
+#include <ufs/ufs/dinode.h>
+#include "ffs/ufs_bswap.h"
+#include <ufs/ffs/fs.h>
+
#define fs_old_postbloff fs_spare5[0]
#define fs_old_rotbloff fs_spare5[1]
#define fs_old_postbl_start fs_maxbsize
diff --git a/usr.sbin/makefs/ffs/ffs_subr.c b/usr.sbin/makefs/ffs/ffs_subr.c
index b55174db0ba3..ddf4d2efc245 100644
--- a/usr.sbin/makefs/ffs/ffs_subr.c
+++ b/usr.sbin/makefs/ffs/ffs_subr.c
@@ -35,6 +35,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/types.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
diff --git a/usr.sbin/makefs/mtree.c b/usr.sbin/makefs/mtree.c
index 532b9e41f7a8..e711933f2f89 100644
--- a/usr.sbin/makefs/mtree.c
+++ b/usr.sbin/makefs/mtree.c
@@ -44,10 +44,15 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#include <strings.h>
+#include <time.h>
#include <unistd.h>
#include "makefs.h"
+#ifndef ENOATTR
+#define ENOATTR ENOMSG
+#endif
+
#define IS_DOT(nm) ((nm)[0] == '.' && (nm)[1] == '\0')
#define IS_DOTDOT(nm) ((nm)[0] == '.' && (nm)[1] == '.' && (nm)[2] == '\0')
diff --git a/usr.sbin/makefs/walk.c b/usr.sbin/makefs/walk.c
index 711017044d45..2c15d6a4b6d1 100644
--- a/usr.sbin/makefs/walk.c
+++ b/usr.sbin/makefs/walk.c
@@ -40,6 +40,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/time.h>
#include <assert.h>
#include <errno.h>