diff options
Diffstat (limited to 'src/Platform')
-rw-r--r-- | src/Platform/Unix/File.cpp | 15 | ||||
-rw-r--r-- | src/Platform/Unix/FilesystemPath.cpp | 2 | ||||
-rw-r--r-- | src/Platform/Unix/SystemInfo.cpp | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/Platform/Unix/File.cpp b/src/Platform/Unix/File.cpp index cfb17e13..457a627d 100644 --- a/src/Platform/Unix/File.cpp +++ b/src/Platform/Unix/File.cpp @@ -22,8 +22,14 @@ #ifdef TC_BSD #include <sys/disk.h> #endif +#ifdef TC_OPENBSD +#include <sys/ioctl.h> +#include <sys/dkio.h> +#include <sys/disklabel.h> +#endif + #ifdef TC_SOLARIS #include <stropts.h> #include <sys/dkio.h> #endif @@ -112,8 +118,13 @@ namespace VeraCrypt u_int sectorSize; throw_sys_sub_if (ioctl (FileHandle, DIOCGSECTORSIZE, §orSize) == -1, wstring (Path)); return (uint32) sectorSize; +#elif defined (TC_OPENBSD) + struct disklabel dl; + throw_sys_sub_if (ioctl (FileHandle, DIOCGPDINFO, &dl) == -1, wstring (Path)); + return (uint32) dl.d_secsize; + #elif defined (TC_SOLARIS) struct dk_minfo mediaInfo; throw_sys_sub_if (ioctl (FileHandle, DKIOCGMEDIAINFO, &mediaInfo) == -1, wstring (Path)); return mediaInfo.dki_lbsize; @@ -170,8 +181,12 @@ namespace VeraCrypt uint64 blockCount; throw_sys_sub_if (ioctl (FileHandle, DKIOCGETBLOCKSIZE, &blockSize) == -1, wstring (Path)); throw_sys_sub_if (ioctl (FileHandle, DKIOCGETBLOCKCOUNT, &blockCount) == -1, wstring (Path)); return blockCount * blockSize; +# elif TC_OPENBSD + struct disklabel dl; + throw_sys_sub_if (ioctl (FileHandle, DIOCGPDINFO, &dl) == -1, wstring (Path)); + return DL_GETDSIZE(&dl); # else uint64 mediaSize; throw_sys_sub_if (ioctl (FileHandle, DIOCGMEDIASIZE, &mediaSize) == -1, wstring (Path)); return mediaSize; diff --git a/src/Platform/Unix/FilesystemPath.cpp b/src/Platform/Unix/FilesystemPath.cpp index 674b395b..e6841d0f 100644 --- a/src/Platform/Unix/FilesystemPath.cpp +++ b/src/Platform/Unix/FilesystemPath.cpp @@ -14,9 +14,9 @@ #include "Platform/SystemException.h" #include "Platform/StringConverter.h" #include <stdio.h> #include <sys/stat.h> -#if !defined(__FreeBSD__) && !defined(__APPLE__) +#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__OpenBSD__) #include <sys/sysmacros.h> #endif namespace VeraCrypt diff --git a/src/Platform/Unix/SystemInfo.cpp b/src/Platform/Unix/SystemInfo.cpp index d4f648bb..f09674aa 100644 --- a/src/Platform/Unix/SystemInfo.cpp +++ b/src/Platform/Unix/SystemInfo.cpp @@ -23,8 +23,10 @@ namespace VeraCrypt #elif defined (TC_MACOSX) return L"Mac OS X"; #elif defined (TC_FREEBSD) return L"FreeBSD"; +#elif defined (TC_OPENBSD) + return L"OpenBSD"; #elif defined (TC_SOLARIS) return L"Solaris"; #else # error GetPlatformName() undefined |