summaryrefslogtreecommitdiff
path: root/sysutils/open-vm-tools/patches/patch-bm
blob: a494420c2bfb02d2e7b4cf8ed849a75e5e4e254a (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
$NetBSD: patch-bm,v 1.3 2018/01/01 06:56:01 ryoon Exp $

--- lib/wiper/wiperPosix.c.orig	2017-12-15 19:09:51.000000000 +0000
+++ lib/wiper/wiperPosix.c
@@ -23,7 +23,7 @@
  *
  */
 
-#if !defined(__linux__) && !defined(sun) && !defined(__FreeBSD__) && !defined(__APPLE__)
+#if !defined(__linux__) && !defined(sun) && !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__NetBSD__)
 #error This file should not be compiled on this platform.
 #endif
 
@@ -72,7 +72,7 @@
 /* Number of device numbers to store for device-mapper */
 #define WIPER_MAX_DM_NUMBERS 8
 
-#if defined(sun) || defined(__linux__)
+#if defined(sun) || defined(__linux__) || defined(__NetBSD__)
 # define PROCFS "proc"
 #elif defined(__FreeBSD__) || defined(__APPLE__)
 # define PROCFS "procfs"
@@ -159,6 +159,16 @@ static unsigned char *WiperGetSpace(Wipe
 static void WiperClean(WiperState *state);
 
 
+#if defined(__NetBSD__)
+#define MAX_DISK_MAJORS       256   /* should be enough for now */
+#define NUM_PRESEEDED_MAJORS  10    /* must match the below */
+static unsigned int knownDiskMajor[MAX_DISK_MAJORS] = {
+16, 20, 18, 14, 4,
+0, 2, 19, 142, 168
+};
+static int numDiskMajors = NUM_PRESEEDED_MAJORS;
+#endif
+
 #if defined(__linux__)
 
 #define MAX_DISK_MAJORS       256   /* should be enough for now */
@@ -311,7 +321,7 @@ WiperIsDiskDevice(MNTINFO *mnt,         
    return FALSE;
 }
 
-#elif defined(__linux__) /* } linux { */
+#elif defined(__linux__) || defined(__NetBSD__) /* } linux { */
 
 static Bool
 WiperIsDiskDevice(MNTINFO *mnt,         // IN: file system being considered
@@ -573,7 +583,7 @@ WiperSinglePartition_GetSpace(const Wipe
                               uint64 *free,            // OUT/OPT
                               uint64 *total)           // OUT
 {
-#ifdef sun
+#if defined(sun) || defined(__NetBSD__)
    struct statvfs statfsbuf;
 #else
    struct statfs statfsbuf;
@@ -582,7 +592,7 @@ WiperSinglePartition_GetSpace(const Wipe
 
    ASSERT(p);
 
-#ifdef sun
+#if defined(sun) || defined(__NetBSD__)
    if (statvfs(p->mountPoint, &statfsbuf) < 0) {
 #else
    if (Posix_Statfs(p->mountPoint, &statfsbuf) < 0) {
@@ -590,7 +600,7 @@ WiperSinglePartition_GetSpace(const Wipe
       return "Unable to statfs() the mount point";
    }
 
-#ifdef sun
+#if defined(sun) || defined(__NetBSD__)
    blockSize = statfsbuf.f_frsize;
 #else
    blockSize = statfsbuf.f_bsize;