1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2025-07-25 21:12:47 +02:00
seaweedfs/weed/storage/backend/volume_create.go
Chris Lu 6c9156b25f switch to logrus
losing filename and line number. Critical for debugging.
2020-11-16 22:26:58 -08:00

20 lines
463 B
Go

// +build !linux,!windows
package backend
import (
"os"
"github.com/chrislusf/seaweedfs/weed/util/log"
)
func CreateVolumeFile(fileName string, preallocate int64, memoryMapSizeMB uint32) (BackendStorageFile, error) {
file, e := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
if e != nil {
return nil, e
}
if preallocate > 0 {
log.Debugf("Preallocated disk space for %s is not supported", fileName)
}
return NewDiskFile(file), nil
}