-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfio_impl.go
60 lines (45 loc) · 1.02 KB
/
fio_impl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package fio
import (
"io/fs"
"os"
"syscall"
"time"
"github.com/setlog/fio/fsi"
)
var fsApi fsi.FileSystem = &fileSystemImpl{}
type fileSystemImpl struct{}
func (fs *fileSystemImpl) OpenFile(name string, flag int, perm os.FileMode) (fsi.File, error) {
return os.OpenFile(name, flag, perm)
}
func (fs *fileSystemImpl) FcntlFlock(fd uintptr, cmd int, lk *syscall.Flock_t) error {
return syscall.FcntlFlock(fd, cmd, lk)
}
func (fs *fileSystemImpl) Remove(name string) error {
return os.Remove(name)
}
func (fs *fileSystemImpl) Stat(name string) (os.FileInfo, error) {
return os.Stat(name)
}
type fileInfoImpl struct {
name string
size int64
mode fs.FileMode
}
func (fi *fileInfoImpl) Name() string {
return fi.name
}
func (fi *fileInfoImpl) Size() int64 {
return fi.size
}
func (fi *fileInfoImpl) Mode() fs.FileMode {
return fi.mode
}
func (fi *fileInfoImpl) ModTime() time.Time {
return time.Now()
}
func (fi *fileInfoImpl) IsDir() bool {
return false
}
func (fi *fileInfoImpl) Sys() interface{} {
return nil
}