Re: [Gptfdisk-general] compiling on openbsd
Brought to you by:
srs5694
From: Joel R. <joe...@gm...> - 2015-10-21 13:11:21
|
Well, actually, I have it compiling cleanly and appearing to function. Need to think about what kinds of tests I can run. Using make -f Makefile.freebsd brings /usr/local/include in so that uuid/uuid.h is found (and gets around the kludge, etc.). Here's the real diff: ----------------------- diff --git a/diskio-unix.cc b/diskio-unix.cc index af71cdb..83b60f9 100644 --- a/diskio-unix.cc +++ b/diskio-unix.cc @@ -248,6 +248,13 @@ int DiskIO::DiskSync(void) { << "You should reboot or remove the drive.\n"; platformFound++; #endif +#if defined (__OpenBSD__) // Shamelessly parroting the FreeBSD code. + sleep(2); + i = fsync(fd); // Is this how to force a flush on a disk device? + cout << "Warning: The kernel may continue to use old or deleted partitions.\n" + << "You should reboot or remove the drive.\n"; + platformFound++; +#endif #ifdef __linux__ sleep(1); // Theoretically unnecessary, but ioctl() fails sometimes if omitted.... fsync(fd); diff --git a/diskio.h b/diskio.h index 631a43a..c198f29 100644 --- a/diskio.h +++ b/diskio.h @@ -29,7 +29,7 @@ #include <sys/dkio.h> #endif -#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) +#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__OpenBSD__) || defined (__APPLE__) #define fstat64 fstat #define stat64 stat #endif diff --git a/guid.cc b/guid.cc index 1e73ab7..0fd8bfe 100644 --- a/guid.cc +++ b/guid.cc @@ -147,6 +147,8 @@ void GUIDData::Randomize(void) { ReverseBytes(&uuidData[4], 2); ReverseBytes(&uuidData[6], 2); uuidGenerated = 1; +#else +# warning "not compiling in the uuid_generate()" #endif #if defined (_RPC_H) || defined (__RPC_H__) UUID MsUuid; diff --git a/support.h b/support.h index b888d92..dd3ea03 100644 --- a/support.h +++ b/support.h @@ -10,7 +10,7 @@ #define GPTFDISK_VERSION "1.0.1" -#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) +#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || (__OpenBSD__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 #include <sys/disk.h> #define lseek64 lseek ~ ~ ----------------------- Whaddaya think? -- Joel Rees |