forked from diskfs/go-diskfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
finalizefileinfo.go
79 lines (74 loc) · 1.92 KB
/
finalizefileinfo.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package squashfs
import (
"os"
"time"
)
// finalizeFileInfo is a file info useful for finalization
// fulfills os.FileInfo
// Name() string // base name of the file
// Size() int64 // length in bytes for regular files; system-dependent for others
// Mode() FileMode // file mode bits
// ModTime() time.Time // modification time
// IsDir() bool // abbreviation for Mode().IsDir()
// Sys() interface{} // underlying data source (can return nil)
type finalizeFileInfo struct {
path string
target string
location uint32
recordSize uint8
depth int
name string
size int64
mode os.FileMode
modTime time.Time
isDir bool
isRoot bool
bytes [][]byte
parent *finalizeFileInfo
children []*finalizeFileInfo
content []byte
dataLocation int64
fileType fileType
inode inode
inodeLocation blockPosition
xattrs map[string]string
xAttrIndex uint32
links uint32
blocks []*blockData
startBlock uint64
fragment *fragmentRef
uid uint32
gid uint32
directory *directory
directoryLocation blockPosition
}
func (fi *finalizeFileInfo) Name() string {
return fi.name
}
func (fi *finalizeFileInfo) Size() int64 {
return fi.size
}
func (fi *finalizeFileInfo) Mode() os.FileMode {
return fi.mode
}
func (fi *finalizeFileInfo) ModTime() time.Time {
return fi.modTime
}
func (fi *finalizeFileInfo) IsDir() bool {
return fi.isDir
}
func (fi *finalizeFileInfo) Sys() interface{} {
return nil
}
// add depth to all children
func (fi *finalizeFileInfo) addProperties(depth int) {
fi.depth = depth
for _, e := range fi.children {
e.parent = fi
e.addProperties(depth + 1)
}
}
type fragmentRef struct {
block uint32
offset uint32
}