--- utils.c.orig	2009-02-15 13:52:25.000000000 +0100
+++ utils.c	2009-02-15 13:53:35.000000000 +0100
@@ -18,6 +18,7 @@
 
 #define _XOPEN_SOURCE 600
 #define __USE_XOPEN2K
+#define _DARWIN_C_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #ifndef __CHECKER__
@@ -30,7 +31,13 @@
 #include <dirent.h>
 #include <fcntl.h>
 #include <unistd.h>
+#ifdef __APPLE__
+#include <sys/disk.h>
+#else
 #include <mntent.h>
+#endif
+
+
 #include "kerncompat.h"
 #include "radix-tree.h"
 #include "ctree.h"
@@ -393,7 +400,11 @@
 	if (!S_ISBLK(st->st_mode)) {
 		return 0;
 	}
+#ifdef __APPLE__
+	if (ioctl(fd, DKIOCGETBLOCKCOUNT, &size) >= 0) {
+#else
 	if (ioctl(fd, BLKGETSIZE64, &size) >= 0) {
+#endif
 		return size;
 	}
 	return 0;
@@ -594,6 +605,9 @@
  */
 int check_mounted(char *file)
 {
+#ifdef __APPLE__
+	return 0;
+#else
 	struct mntent *mnt;
 	struct stat st_buf;
 	dev_t file_dev = 0;
@@ -638,6 +652,7 @@
 
 	endmntent (f);
 	return ret;
+#endif
 }
 
 struct pending_dir {