summaryrefslogtreecommitdiff
path: root/sysutils/gpart/patches/patch-aa
blob: 1ac6c5f89e1b04eebb7516b16134c2cd0f79b5c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$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;