$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;