Author: marcel
Date: Tue Oct 25 16:29:15 2016
New Revision: 307927
URL: https://svnweb.freebsd.org/changeset/base/307927

Log:
  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.

Modified:
  head/usr.sbin/makefs/cd9660.c
  head/usr.sbin/makefs/cd9660/cd9660_archimedes.c
  head/usr.sbin/makefs/cd9660/iso9660_rrip.c
  head/usr.sbin/makefs/ffs/ffs_bswap.c
  head/usr.sbin/makefs/ffs/ffs_subr.c
  head/usr.sbin/makefs/mtree.c
  head/usr.sbin/makefs/walk.c

Modified: head/usr.sbin/makefs/cd9660.c
==============================================================================
--- head/usr.sbin/makefs/cd9660.c       Tue Oct 25 16:28:30 2016        
(r307926)
+++ head/usr.sbin/makefs/cd9660.c       Tue Oct 25 16:29:15 2016        
(r307927)
@@ -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"

Modified: head/usr.sbin/makefs/cd9660/cd9660_archimedes.c
==============================================================================
--- head/usr.sbin/makefs/cd9660/cd9660_archimedes.c     Tue Oct 25 16:28:30 
2016        (r307926)
+++ head/usr.sbin/makefs/cd9660/cd9660_archimedes.c     Tue Oct 25 16:29:15 
2016        (r307927)
@@ -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"

Modified: head/usr.sbin/makefs/cd9660/iso9660_rrip.c
==============================================================================
--- head/usr.sbin/makefs/cd9660/iso9660_rrip.c  Tue Oct 25 16:28:30 2016        
(r307926)
+++ head/usr.sbin/makefs/cd9660/iso9660_rrip.c  Tue Oct 25 16:29:15 2016        
(r307927)
@@ -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 *);

Modified: head/usr.sbin/makefs/ffs/ffs_bswap.c
==============================================================================
--- head/usr.sbin/makefs/ffs/ffs_bswap.c        Tue Oct 25 16:28:30 2016        
(r307926)
+++ head/usr.sbin/makefs/ffs/ffs_bswap.c        Tue Oct 25 16:29:15 2016        
(r307927)
@@ -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

Modified: head/usr.sbin/makefs/ffs/ffs_subr.c
==============================================================================
--- head/usr.sbin/makefs/ffs/ffs_subr.c Tue Oct 25 16:28:30 2016        
(r307926)
+++ head/usr.sbin/makefs/ffs/ffs_subr.c Tue Oct 25 16:29:15 2016        
(r307927)
@@ -35,6 +35,7 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
+#include <sys/types.h>
 
 #include <ufs/ufs/dinode.h>
 #include <ufs/ffs/fs.h>

Modified: head/usr.sbin/makefs/mtree.c
==============================================================================
--- head/usr.sbin/makefs/mtree.c        Tue Oct 25 16:28:30 2016        
(r307926)
+++ head/usr.sbin/makefs/mtree.c        Tue Oct 25 16:29:15 2016        
(r307927)
@@ -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')
 

Modified: head/usr.sbin/makefs/walk.c
==============================================================================
--- head/usr.sbin/makefs/walk.c Tue Oct 25 16:28:30 2016        (r307926)
+++ head/usr.sbin/makefs/walk.c Tue Oct 25 16:29:15 2016        (r307927)
@@ -40,6 +40,7 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
+#include <sys/time.h>
 
 #include <assert.h>
 #include <errno.h>
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to