pkgsrc/sysutils/gpart/patches/patch-aa
2008-12-26 20:23:45 +00:00

39 lines
1 KiB
Text

$NetBSD: patch-aa,v 1.3 2008/12/26 20:23:45 hasso Exp $
--- src/disku.c.orig 2001-02-07 21:04:07 +0200
+++ src/disku.c 2008-12-25 21:25:33 +0200
@@ -26,12 +26,14 @@
#include <linux/hdreg.h>
#endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#include <errno.h>
#include <sys/disklabel.h>
#endif
-
+#ifdef __DragonFly__
+#include <sys/disklabel32.h>
+#endif
/*
* get disk geometry. The medium is opened for reading,
@@ -60,10 +62,16 @@ struct disk_geom *disk_geometry(disk_des
#endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
+#ifdef __DragonFly__
+ struct disklabel32 dl;
+ if (ioctl(d->d_fd,DIOCGDINFO32,&dl) == -1)
+ pr(FATAL,EM_IOCTLFAILED,"DIOCGDINFO32",strerror(errno));
+#else
struct disklabel dl;
if (ioctl(d->d_fd,DIOCGDINFO,&dl) == -1)
pr(FATAL,EM_IOCTLFAILED,"DIOCGDINFO",strerror(errno));
+#endif
g.d_c = dl.d_ncylinders;
g.d_h = dl.d_ntracks;
g.d_s = dl.d_nsectors;