--- a/lib/blkid/getsize.c
+++ b/lib/blkid/getsize.c
@@ -29,6 +29,9 @@
 #include <fcntl.h>
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
+#ifdef __OpenBSD__
+#include <sys/dkio.h>
+#endif
 #endif
 #ifdef HAVE_LINUX_FD_H
 #include <linux/fd.h>
