pkgsrc/sysutils/e2fsprogs/patches/patch-ac
2008-09-21 16:16:06 +00:00

40 lines
1.1 KiB
Text

$NetBSD: patch-ac,v 1.3 2008/09/21 16:16:06 joerg Exp $
--- lib/blkid/getsize.c.orig 2008-06-30 00:05:45 +0300
+++ lib/blkid/getsize.c
@@ -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
#ifdef HAVE_SYS_QUEUE_H
#include <sys/queue.h> /* for LIST_HEAD */
@@ -86,8 +89,13 @@ blkid_loff_t blkid_get_dev_size(int fd)
#endif
#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;
#endif /* HAVE_SYS_DISKLABEL_H */
@@ -144,7 +152,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;