strncpy(dp->devName, devname, strlen(devname) + 1);
dp->device = dev;
#endif
- dp->lock_fd = -1;
+ dp->lock_fd = INVALID_FD;
dp->flags = 0;
dp->f_files = 1; /* just a default value */
#if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
if (!dp)
return;
- if (dp->lock_fd == -1) {
+ if (dp->lock_fd == INVALID_FD) {
char path[64];
int rc;
(void)sprintf(path, "%s\\%s", VPartitionPath(dp), LOCKFILE);
dp->lock_fd =
- (int)CreateFile(path, GENERIC_WRITE,
+ (FD_t)CreateFile(path, GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL);
- assert(dp->lock_fd != (int)INVALID_HANDLE_VALUE);
+ assert(dp->lock_fd != INVALID_FD);
memset((char *)&lap, 0, sizeof(lap));
rc = LockFileEx((HANDLE) dp->lock_fd, LOCKFILE_EXCLUSIVE_LOCK, 0, 1,
UnlockFileEx((HANDLE) dp->lock_fd, 0, 1, 0, &lap);
CloseHandle((HANDLE) dp->lock_fd);
- dp->lock_fd = -1;
+ dp->lock_fd = INVALID_FD;
}
#else /* AFS_NT40_ENV */
char *devName; /* Device mounted on */
Device device; /* device number */
afs_int32 index; /* partition index (0<=x<=VOLMAXPARTS) */
- int lock_fd; /* File descriptor of this partition if locked; otherwise -1;
+ FD_t lock_fd; /* File descriptor of this partition if locked; otherwise -1;
* Not used by the file server */
afs_int64 free; /* Total number of blocks (1K) presumed
* available on this partition (accounting
void
ObtainSalvageLock(void)
{
- int salvageLock;
+ FD_t salvageLock;
#ifdef AFS_NT40_ENV
salvageLock =
- (int)CreateFile(AFSDIR_SERVER_SLVGLOCK_FILEPATH, 0, 0, NULL,
+ (FD_t)CreateFile(AFSDIR_SERVER_SLVGLOCK_FILEPATH, 0, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- if (salvageLock == (int)INVALID_HANDLE_VALUE) {
+ if (salvageLock == INVALID_FD) {
fprintf(stderr,
"salvager: There appears to be another salvager running! Aborted.\n");
Exit(1);
* modified to actually do that so that the NT crt can be used there.
*/
inodeFd =
- _open_osfhandle((long)nt_open(inodeListPath, O_RDWR, 0), O_RDWR);
+ _open_osfhandle((intptr_t)nt_open(inodeListPath, O_RDWR, 0), O_RDWR);
nt_unlink(inodeListPath); /* NT's crt unlink won't if file is open. */
#else
inodeFd = afs_open(inodeListPath, O_RDONLY);