vol: fix OS_LOCKFILE/OS_UNLOCKFILE for Windows

On UNIX the OS_LOCKFILE and OS_UNLOCKFILE macros return zero
on success.  Since Windows LockFile() and UnlockFile() return
non-zero (TRUE) on success, negate the return value as part
of the macro definition.

Change-Id: Icb4c8555de9a16fdfddcaeb9ede28bbd401e76b7
Reviewed-on: http://gerrit.openafs.org/3664
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Jeffrey Altman 2011-01-15 11:01:55 -05:00 committed by Jeffrey Altman
parent ac79869f62
commit e8e69d5b2c

View File

@ -378,8 +378,8 @@ extern ssize_t ih_pwrite(int fd, const void * buf, size_t count, afs_foff_t offs
#define OS_PWRITE(FD, B, S, O) ih_pwrite(FD, B, S, O) #define OS_PWRITE(FD, B, S, O) ih_pwrite(FD, B, S, O)
#endif /* !HAVE_PIO */ #endif /* !HAVE_PIO */
#ifdef AFS_NT40_ENV #ifdef AFS_NT40_ENV
#define OS_LOCKFILE(FD, O) LockFile(FD, (O & 0xFFFFFFFF), (O >> 32), 2, 0) #define OS_LOCKFILE(FD, O) (!LockFile(FD, (O & 0xFFFFFFFF), (O >> 32), 2, 0))
#define OS_UNLOCKFILE(FD, O) UnlockFile(FD, (O & 0xFFFFFFFF), (O >> 32), 2, 0) #define OS_UNLOCKFILE(FD, O) (!UnlockFile(FD, (O & 0xFFFFFFFF), (O >> 32), 2, 0))
#define OS_ERROR(X) nterr_nt2unix(GetLastError(), X) #define OS_ERROR(X) nterr_nt2unix(GetLastError(), X)
#define OS_UNLINK(X) nt_unlink(X) #define OS_UNLINK(X) nt_unlink(X)
#define OS_DIRSEP "\\" #define OS_DIRSEP "\\"