$NetBSD: patch-af,v 1.6 2006/07/20 08:22:02 adam Exp $

--- ntfsprogs/ntfsclone.c.orig	2006-06-21 09:59:19.000000000 +0200
+++ ntfsprogs/ntfsclone.c
@@ -55,6 +55,19 @@
 #include <getopt.h>
 #endif
 
+#ifdef __NetBSD__
+#  include <sys/param.h>
+   /* NetBSD versions later than 2.99.9 have statvfs(2) instead of statfs(2) */
+#  if __NetBSD_Version__ >= 299000900
+#    include <sys/statvfs.h>
+#    define F_TYPE	f_fsid
+#  else
+#    define F_TYPE	f_type
+#  endif
+#else
+#  define F_TYPE	f_type
+#endif
+
 #include "debug.h"
 #include "types.h"
 #include "support.h"
@@ -110,7 +123,11 @@ struct {
 	int restore_image;
 	char *output;
 	char *volume;
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 299000900)
+	struct statvfs stfs;
+#else
 	struct statfs stfs;
+#endif
 } opt;
 
 struct bitmap {
@@ -561,7 +578,7 @@ static void copy_cluster(int rescue, u64
 	if (write_all(&fd_out, buff, csize) == -1) {
 		int err = errno;
 		perr_printf("Write failed");
-		if (err == EIO && opt.stfs.f_type == 0x517b)
+		if (err == EIO && opt.stfs.F_TYPE == 0x517b)
 			Printf("Apparently you tried to clone to a remote "
 			       "Windows computer but they don't\nhave "
 			       "efficient sparse file handling by default. "
@@ -1426,7 +1443,7 @@ static void set_filesize(s64 filesize)
 		Printf("WARNING: Couldn't get filesystem type: "
 		       "%s\n", strerror(errno));
 	else
-		fs_type = opt.stfs.f_type;
+		fs_type = opt.stfs.F_TYPE;
 
 	if (fs_type == 0x52654973)
 		Printf("WARNING: You're using ReiserFS, it has very poor "
