$NetBSD: patch-ac,v 1.4 2014/12/10 12:54:22 makoto Exp $

DragonFly support
 
--- lib/blkid/getsize.c.orig	2014-08-03 05:26:22.000000000 +0900
+++ lib/blkid/getsize.c	2014-12-10 20:50:28.000000000 +0900
@@ -32,6 +32,9 @@
 #ifdef HAVE_SYS_DISKLABEL_H
 #include <sys/disklabel.h>
 #endif
+#ifdef __DragonFly__
+#include <sys/disklabel32.h>
+#endif
 #ifdef HAVE_SYS_DISK_H
 #include <sys/disk.h>
 #endif
@@ -130,8 +133,14 @@ blkid_loff_t blkid_get_dev_size(int fd)
 #ifdef HAVE_SYS_DISKLABEL_H
 	{
 		int part = -1;
+
+#ifdef __DragonFly__
+		struct disklabel32 lab;
+		struct partition32 *pp;
+#else
 		struct disklabel lab;
 		struct partition *pp;
+#endif
 		char ch;
 		struct stat st;
 
@@ -147,8 +156,11 @@ blkid_loff_t blkid_get_dev_size(int fd)
 		if (fstat(fd, &st) >= 0 &&
 		    (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)))
 			part = st.st_rdev & 7;
-
+#ifdef __DragonFly__
+		if (part >= 0 && (ioctl(fd, DIOCGDINFO32, (char *)&lab) >= 0)) {
+#else
 		if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) {
+#endif
 			pp = &lab.d_partitions[part];
 			if (pp->p_size)
 				return pp->p_size << 9;
