File: instance_file_info.go

package info (click to toggle)
incus 6.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,392 kB
  • sloc: sh: 16,313; ansic: 3,121; python: 457; makefile: 337; ruby: 51; sql: 50; lisp: 6
file content (52 lines) | stat: -rw-r--r-- 878 bytes parent folder | download | duplicates (8)
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
package instancewriter

import (
	"archive/tar"
	"os"
	"time"
)

// FileInfo static file implementation of os.FileInfo.
type FileInfo struct {
	FileName    string
	FileSize    int64
	FileMode    os.FileMode
	FileModTime time.Time
}

// Name of file.
func (f *FileInfo) Name() string {
	return f.FileName
}

// Size of file.
func (f *FileInfo) Size() int64 {
	return f.FileSize
}

// Mode of file.
func (f *FileInfo) Mode() os.FileMode {
	return f.FileMode
}

// ModTime of file.
func (f *FileInfo) ModTime() time.Time {
	return f.FileModTime
}

// IsDir is file a directory.
func (f *FileInfo) IsDir() bool {
	return false
}

// Sys returns further unix attributes for a file owned by root.
func (f *FileInfo) Sys() any {
	return &tar.Header{
		Uid:        0,
		Gid:        0,
		Uname:      "root",
		Gname:      "root",
		AccessTime: time.Now(),
		ChangeTime: time.Now(),
	}
}