diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-10-16 23:10:08 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-10-16 23:10:08 +0000 |
commit | f9bedd322c6f1050a9743d98c747d65f953207b7 (patch) | |
tree | 87887c140fc491b21eb17d27f4653f7d948e49e1 | |
parent | ac19a2d757e850964718a5b3b6fe9032feb20f4d (diff) |
Undefine fstat() so that we get the Win32 POSIX version, instead of our
emulated version.
Small code cleanup. (refs #3)
-rw-r--r-- | lib/raidfile/RaidFileRead.cpp | 3 | ||||
-rw-r--r-- | lib/raidfile/RaidFileWrite.cpp | 24 |
2 files changed, 16 insertions, 11 deletions
diff --git a/lib/raidfile/RaidFileRead.cpp b/lib/raidfile/RaidFileRead.cpp index ad040c22..363c638b 100644 --- a/lib/raidfile/RaidFileRead.cpp +++ b/lib/raidfile/RaidFileRead.cpp @@ -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 diff --git a/lib/raidfile/RaidFileWrite.cpp b/lib/raidfile/RaidFileWrite.cpp index 2de9dde5..66ab81c8 100644 --- a/lib/raidfile/RaidFileWrite.cpp +++ b/lib/raidfile/RaidFileWrite.cpp @@ -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 @@ void RaidFileWrite::TransformToRaidStorage() #ifdef WIN32 // Must delete before renaming - if (::unlink(stripe1Filename.c_str()) != 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); + #define CHECK_UNLINK(file) \ + { \ + if (::unlink(file) != 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 |