$NetBSD$

--- jffs2dump.c.orig	2006-10-07 17:33:37.000000000 +0200
+++ jffs2dump.c	2007-09-01 10:48:23.000000000 +0200
@@ -27,11 +27,20 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
+#if __NetBSD__
+#include <sys/types.h>
+#else
 #include <asm/types.h>
+#endif
 #include <dirent.h>
 #include <mtd/jffs2-user.h>
+#if __NetBSD__
+#include <sys/endian.h>
+#include <machine/bswap.h>
+#else
 #include <endian.h>
 #include <byteswap.h>
+#endif
 #include <getopt.h>
 #include "crc32.h"
 #include "summary.h"
@@ -42,10 +51,10 @@
 #define PAD(x) (((x)+3)&~3)
 
 /* For outputting a byte-swapped version of the input image. */
-#define cnv_e32(x) ((jint32_t){bswap_32(x.v32)})
-#define cnv_e16(x) ((jint16_t){bswap_16(x.v16)})
+#define cnv_e32(x) ((jint32_t){bswap32(x.v32)})
+#define cnv_e16(x) ((jint16_t){bswap16(x.v16)})
 
-#define t32_backwards(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?bswap_32(__b):__b; })
+#define t32_backwards(x) ({ uint32_t __b = (x); (target_endian==_BYTE_ORDER)?bswap32(__b):__b; })
 #define cpu_to_e32(x) ((jint32_t){t32_backwards(x)})
 
 // Global variables
@@ -90,7 +99,7 @@
 int 	verbose;		// verbose output
 char 	*img;			// filename of image
 int	dumpcontent;		// dump image content
-int	target_endian = __BYTE_ORDER;	// image endianess
+int	target_endian = _BYTE_ORDER;	// image endianess
 int	convertendian;		// convert endianness
 int	recalccrc;		// recalc name and data crc's on endian conversion
 char	cnvfile[256];		// filename for conversion output
@@ -139,10 +148,10 @@
 			verbose = 1;
 			break;
 		case 'b':
-			target_endian = __BIG_ENDIAN;
+			target_endian = _BIG_ENDIAN;
 			break;
 		case 'l':
-			target_endian = __LITTLE_ENDIAN;
+			target_endian = _LITTLE_ENDIAN;
 			break;
 		case 'c':
 			dumpcontent = 1;
