[Box Backup-commit] COMMIT r1079 - box/chris/merge/lib/raidfile
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Tue, 17 Oct 2006 00:10:08 +0100
Author: chris
Date: 2006-10-17 00:10:08 +0100 (Tue, 17 Oct 2006)
New Revision: 1079
Modified:
box/chris/merge/lib/raidfile/RaidFileRead.cpp
box/chris/merge/lib/raidfile/RaidFileWrite.cpp
Log:
Undefine fstat() so that we get the Win32 POSIX version, instead of our
emulated version.
Small code cleanup. (refs #3)
Modified: box/chris/merge/lib/raidfile/RaidFileRead.cpp
===================================================================
--- box/chris/merge/lib/raidfile/RaidFileRead.cpp 2006-10-16 23:08:13 UTC (rev 1078)
+++ box/chris/merge/lib/raidfile/RaidFileRead.cpp 2006-10-16 23:10:08 UTC (rev 1079)
@@ -43,6 +43,9 @@
#define READ_NUMBER_DISCS_REQUIRED 3
#define READV_MAX_BLOCKS 64
+// We want to use POSIX fstat() for now, not the emulated one
+#undef fstat
+
// --------------------------------------------------------------------------
//
// Class
Modified: box/chris/merge/lib/raidfile/RaidFileWrite.cpp
===================================================================
--- box/chris/merge/lib/raidfile/RaidFileWrite.cpp 2006-10-16 23:08:13 UTC (rev 1078)
+++ box/chris/merge/lib/raidfile/RaidFileWrite.cpp 2006-10-16 23:10:08 UTC (rev 1079)
@@ -35,6 +35,9 @@
// Must have this number of discs in the set
#define TRANSFORM_NUMBER_DISCS_REQUIRED 3
+// we want to use POSIX fstat() for now, not the emulated one
+#undef fstat
+
// --------------------------------------------------------------------------
//
// Function
@@ -567,18 +570,17 @@
#ifdef WIN32
// Must delete before renaming
- if (::unlink(stripe1Filename.c_str()) != 0 && errno != ENOENT)
- {
- THROW_EXCEPTION(RaidFileException, OSError);
+ #define CHECK_UNLINK(file) \
+ { \
+ if (::unlink(file) != 0 && errno != ENOENT) \
+ { \
+ THROW_EXCEPTION(RaidFileException, OSError); \
+ } \
}
- if (::unlink(stripe2Filename.c_str()) != 0 && errno != ENOENT)
- {
- THROW_EXCEPTION(RaidFileException, OSError);
- }
- if (::unlink(parityFilename.c_str()) != 0 && errno != ENOENT)
- {
- THROW_EXCEPTION(RaidFileException, OSError);
- }
+ CHECK_UNLINK(stripe1Filename.c_str());
+ CHECK_UNLINK(stripe2Filename.c_str());
+ CHECK_UNLINK(parityFilename.c_str());
+ #undef CHECK_UNLINK
#endif
// Rename them into place