You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
860 B

  1. // +build windows
  2. package storage
  3. import (
  4. "os"
  5. "github.com/joeslay/seaweedfs/weed/storage/memory_map"
  6. "golang.org/x/sys/windows"
  7. "github.com/joeslay/seaweedfs/weed/glog"
  8. "github.com/joeslay/seaweedfs/weed/os_overloads"
  9. )
  10. func createVolumeFile(fileName string, preallocate int64, useMemoryMap uint32) (*os.File, error) {
  11. mMap, exists := memory_map.FileMemoryMap[fileName]
  12. if !exists {
  13. file, e := os_overloads.OpenFile(fileName, windows.O_RDWR|windows.O_CREAT, 0644, useMemoryMap > 0)
  14. if useMemoryMap > 0 {
  15. memory_map.FileMemoryMap[fileName] = new(memory_map.MemoryMap)
  16. new_mMap := memory_map.FileMemoryMap[fileName]
  17. new_mMap.CreateMemoryMap(file, 1024*1024*1024*2)
  18. }
  19. if preallocate > 0 {
  20. glog.V(0).Infof("Preallocated disk space for %s is not supported", fileName)
  21. }
  22. return file, e
  23. } else {
  24. return mMap.File, nil
  25. }
  26. }