1
0
Fork 0
forked from External/grumble

Major gofix run.

This commit is contained in:
Mikkel Krautz 2011-11-08 15:05:13 +01:00
parent 92e6ac5276
commit 71b8314c2e
28 changed files with 522 additions and 559 deletions

View file

@ -1,29 +1,26 @@
// Copyright (c) 2011 The Grumble Authors
// The use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE-file.
package blobstore
import (
"os"
"syscall"
)
const (
FILE_FLAG_DELETE_ON_CLOSE = 0x04000000
)
package blobstore
import "syscall"
const (
FILE_FLAG_DELETE_ON_CLOSE = 0x04000000
)
// Acquire a lockfile at path.
func AcquireLockFile(path string) os.Error {
handle, _ := syscall.CreateFile(syscall.StringToUTF16Ptr(path), syscall.GENERIC_WRITE, 0, nil, syscall.CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0)
if handle < 0 {
return ErrLocked
}
return nil
}
func AcquireLockFile(path string) error {
handle, _ := syscall.CreateFile(syscall.StringToUTF16Ptr(path), syscall.GENERIC_WRITE, 0, nil, syscall.CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0)
if handle < 0 {
return ErrLocked
}
return nil
}
// Release the lockfile at path.
func ReleaseLockFile(path string) os.Error {
func ReleaseLockFile(path string) error {
// No-op because we use FLAG_DELETE_ON_CLOSE.
return nil
}
return nil
}