Mon Jun 17 06:09:06 2013 UTC ()
Use DIOCGINFO and/or DIOCGWEDGEINFO if DIOCGPART isn't defined. Fixes
build on netbsd-6 and up. Caution: while it builds, I haven't actually
tested it.


(dholland)
diff -r1.6 -r1.7 pkgsrc/sysutils/wipe/distinfo
diff -r1.2 -r1.3 pkgsrc/sysutils/wipe/patches/patch-ah

cvs diff -r1.6 -r1.7 pkgsrc/sysutils/wipe/distinfo (expand / switch to unified diff)

--- pkgsrc/sysutils/wipe/distinfo 2013/06/17 05:37:22 1.6
+++ pkgsrc/sysutils/wipe/distinfo 2013/06/17 06:09:06 1.7
@@ -1,13 +1,13 @@ @@ -1,13 +1,13 @@
1$NetBSD: distinfo,v 1.6 2013/06/17 05:37:22 dholland Exp $ 1$NetBSD: distinfo,v 1.7 2013/06/17 06:09:06 dholland Exp $
2 2
3SHA1 (wipe-2.2.0.tar.bz2) = 4dd18f260ecd91b726336b2788fa33db04d6691a 3SHA1 (wipe-2.2.0.tar.bz2) = 4dd18f260ecd91b726336b2788fa33db04d6691a
4RMD160 (wipe-2.2.0.tar.bz2) = 5d1861bd893e01e94205a7ac2efadb1c756da700 4RMD160 (wipe-2.2.0.tar.bz2) = 5d1861bd893e01e94205a7ac2efadb1c756da700
5Size (wipe-2.2.0.tar.bz2) = 70134 bytes 5Size (wipe-2.2.0.tar.bz2) = 70134 bytes
6SHA1 (patch-aa) = 4d84f400528b88f376a374f159b72da4237f3b33 6SHA1 (patch-aa) = 4d84f400528b88f376a374f159b72da4237f3b33
7SHA1 (patch-ab) = 3116ad02dd0a3514afec440e46ab679395e4bbaa 7SHA1 (patch-ab) = 3116ad02dd0a3514afec440e46ab679395e4bbaa
8SHA1 (patch-ac) = df59d51a7ee781fd439db1bf2284fb34e26fb8fb 8SHA1 (patch-ac) = df59d51a7ee781fd439db1bf2284fb34e26fb8fb
9SHA1 (patch-ad) = 6288118d9b4a70844bbc94a8e9dc4748fc9459f8 9SHA1 (patch-ad) = 6288118d9b4a70844bbc94a8e9dc4748fc9459f8
10SHA1 (patch-ae) = e1145c395a9b0999d7fbf8a4cb79f1dc89aa29e1 10SHA1 (patch-ae) = e1145c395a9b0999d7fbf8a4cb79f1dc89aa29e1
11SHA1 (patch-af) = 23102dea6f821791d5b3bd2bb509c38ab6bf2a16 11SHA1 (patch-af) = 23102dea6f821791d5b3bd2bb509c38ab6bf2a16
12SHA1 (patch-ag) = fd61d6b065eb22cabb697f2df073a3b9efde26a9 12SHA1 (patch-ag) = fd61d6b065eb22cabb697f2df073a3b9efde26a9
13SHA1 (patch-ah) = 4b50f2fb8fa9b3c091ad4d1e0c8d954d3931d2b9 13SHA1 (patch-ah) = 362b9f59453baa4d8632d895a2f3a530ba9ca652

cvs diff -r1.2 -r1.3 pkgsrc/sysutils/wipe/patches/patch-ah (expand / switch to unified diff)

--- pkgsrc/sysutils/wipe/patches/patch-ah 2013/06/17 05:37:22 1.2
+++ pkgsrc/sysutils/wipe/patches/patch-ah 2013/06/17 06:09:06 1.3
@@ -1,55 +1,117 @@ @@ -1,55 +1,117 @@
1$NetBSD: patch-ah,v 1.2 2013/06/17 05:37:22 dholland Exp $ 1$NetBSD: patch-ah,v 1.3 2013/06/17 06:09:06 dholland Exp $
2 2
3- DragonFly BSD's partinfo is not the standard BSD partinfo. 
4- Don't declare own errno. 3- Don't declare own errno.
 4- DragonFly BSD's partinfo is not the standard BSD partinfo.
 5- NetBSD no longer supports the partinfo ioctl. Use the
 6 available alternatives, which is kind of messy.
5 7
6--- blkdev.c.orig 2003-08-03 23:07:29.000000000 +0000 8--- blkdev.c.orig 2003-08-03 23:07:29.000000000 +0000
7+++ blkdev.c 9+++ blkdev.c
8@@ -44,10 +44,15 @@ 10@@ -44,10 +44,20 @@
9 # endif 11 # endif
10 #endif 12 #endif
11  13
12-#ifdef HAVE_SYS_DISKLABEL_H 14+#if defined(__DragonFly__)
13+#ifdef __DragonFly__ 
14+# include <sys/diskslice.h> 15+# include <sys/diskslice.h>
15+# define BSD_BLKDEV 16+# define BSD_BLKDEV
 17+#elif defined(__NetBSD__)
 18+# include <sys/disklabel.h>
 19+# include <sys/disk.h>
 20+# include <sys/param.h> /* for DEV_BSIZE, XXX */
 21+# define BSD_BLKDEV
16+#else 22+#else
17+#ifdef HAVE_SYS_DISKLABEL_H) 23 #ifdef HAVE_SYS_DISKLABEL_H
18 # include <sys/disklabel.h> 24 # include <sys/disklabel.h>
19 # define BSD_BLKDEV 25 # define BSD_BLKDEV
20 #endif 26 #endif
21+#endif 27+#endif
22  28
23 #ifndef LINUX_BLKDEV 29 #ifndef LINUX_BLKDEV
24 # ifndef BSD_BLKDEV 30 # ifndef BSD_BLKDEV
25@@ -63,7 +68,6 @@ 31@@ -63,7 +73,6 @@
26 #include "wipe.h" 32 #include "wipe.h"
27 #include "blkdev.h" 33 #include "blkdev.h"
28  34
29-extern int errno; 35-extern int errno;
30 extern int exit_code; 36 extern int exit_code;
31 extern char *argvzero; 37 extern char *argvzero;
32 extern struct opt_s options; 38 extern struct opt_s options;
33@@ -182,14 +186,20 @@ public int destroy_blkdev(struct file_s  39@@ -128,7 +137,13 @@ public int destroy_blkdev(struct file_s
 40 int code;
 41
 42 #ifdef BSD_BLKDEV
 43+#ifdef DIOCGPART
 44 struct partinfo pinfo;
 45+#else
 46+ struct disklabel lab;
 47+ struct dkwedge_info dkw;
 48+ int use_dkw;
 49+#endif
 50 #endif
 51
 52 #ifdef NO_BLKDEV
 53@@ -160,12 +175,26 @@ public int destroy_blkdev(struct file_s
 54 }
 55
 56 #ifdef BSD_BLKDEV
 57+# ifdef DIOCGPART
 58 if (ioctl(f->fd, DIOCGPART, &pinfo))
 59 {
 60 fprintf(stderr, "\r%s: ioctl failed, can't get disklabel for `%s': %s\n",
 61 argvzero, f->name, strerror(errno));
 62 exit_code = errno; return FAILED;
 63 }
 64+# else
 65+ if (ioctl(f->fd, DIOCGDINFO, &lab) == 0) {
 66+ use_dkw = 0;
 67+ }
 68+ else if (ioctl(f->fd, DIOCGWEDGEINFO, &dkw) == 0) {
 69+ use_dkw = 1;
 70+ }
 71+ else {
 72+ fprintf(stderr, "\r%s: ioctl failed, can't get disklabel for `%s': %s\n",
 73+ argvzero, f->name, strerror(errno));
 74+ exit_code = errno; return FAILED;
 75+ }
 76+# endif
 77 #endif
 78
 79 if (options.sectors == 0)
 80@@ -182,15 +211,35 @@ public int destroy_blkdev(struct file_s
34 options.sectors = tmp; 81 options.sectors = tmp;
35 #endif 82 #endif
36  83
37-#ifdef BSD_BLKDEV 84-#ifdef BSD_BLKDEV
38+#if defined(BSD_BLKDEV) 85+#if defined(BSD_BLKDEV)
39+# if defined(__DragonFly__) 86+# if defined(__DragonFly__)
40+ options.sectors = pinfo.media_blocks; 87+ options.sectors = pinfo.media_blocks;
41+# else 88+# else
 89+# if defined(DIOCGPART)
42 options.sectors = pinfo.part->p_size; 90 options.sectors = pinfo.part->p_size;
 91+# else
 92+ options.sectors = use_dkw ?
 93+ dkw.dkw_size : lab.d_partitions[DISKPART(f->st.st_rdev)].p_size;
 94+# endif
43+# endif 95+# endif
44 #endif 96 #endif
45 } 97 }
46  98
47 if (options.sector_size == 0) 99 if (options.sector_size == 0)
48 { 100 {
49-#ifdef BSD_BLKDEV 101-#ifdef BSD_BLKDEV
50+#if defined(__DragonFly__) 102+#if defined(__DragonFly__)
51+ options.sector_size = pinfo.media_blocks; 103+ options.sector_size = pinfo.media_blocks;
52+#elif defined(BSD_BLKDEV) 104+#elif defined(BSD_BLKDEV)
 105+# if defined(DIOCGPART)
53 options.sector_size = pinfo.disklab->d_secsize; 106 options.sector_size = pinfo.disklab->d_secsize;
 107+# else
 108+ /*
 109+ * XXX: we ought to use DIOCGDISKINFO to get the sector size,
 110+ * but that requires proplib and probably 500+ lines of code.
 111+ * So punt and use DEV_BSIZE...
 112+ */
 113+ options.sector_size = use_dkw ? DEV_BSIZE : lab.d_secsize;
 114+# endif
54 #else 115 #else
55 options.sector_size = SECTOR_SIZE; 116 options.sector_size = SECTOR_SIZE;
 117 #endif