Hi,

Since this problem makes fdisk on GNU/kFreeBSD nearly unusable,
and the proposed change is very unintrusive, I went ahead and
uploaded an NMU to DELAYED/3.

Tuco: thanks for the patch;  I made a simpler version with __FreeBSD_kernel__
so that configure doesn't need to be regenerated.  Would you please
send your version of the patch to the upstream authors?

Lamont: My version of the patch is attached.  Note that it has no effect on
GNU/Linux.  Please let me know of any concerns/whatever or if my upload
needs to be cancelled.

Thanks

-- 
Robert Millan
diff -ur util-linux-2.17.2/lib/blkdev.c util-linux-2.17.2.fix/lib/blkdev.c
--- util-linux-2.17.2/lib/blkdev.c	2010-03-22 04:05:42.000000000 -0400
+++ util-linux-2.17.2.fix/lib/blkdev.c	2010-08-07 08:09:42.223428053 -0400
@@ -3,6 +3,10 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
+#ifdef __FreeBSD_kernel__
+#include <sys/disk.h>
+#endif
+
 #include "blkdev.h"
 #include "linux_version.h"
 
@@ -67,6 +71,17 @@
 	return -1;
 #endif /* BLKGETSIZE */
 
+#ifdef __FreeBSD_kernel__
+	{
+		off_t size;
+
+		if (ioctl(fd, DIOCGMEDIASIZE, &size) >= 0) {
+			*bytes = size;
+			return 0;
+		}
+	}
+#endif
+
 	*bytes = blkdev_find_size(fd);
 	return 0;
 }

Reply via email to