summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/fsutil
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fs/fsutil')
-rw-r--r--pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go276
-rw-r--r--pkg/sentry/fs/fsutil/fsutil_state_autogen.go304
-rw-r--r--pkg/sentry/fs/fsutil/inode_cached.go13
3 files changed, 293 insertions, 300 deletions
diff --git a/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go b/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go
index b3270d11d..4d90bd42f 100644
--- a/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go
+++ b/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go
@@ -6,35 +6,35 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
-func (x *DirtySet) StateTypeName() string {
+func (d *DirtySet) StateTypeName() string {
return "pkg/sentry/fs/fsutil.DirtySet"
}
-func (x *DirtySet) StateFields() []string {
+func (d *DirtySet) StateFields() []string {
return []string{
"root",
}
}
-func (x *DirtySet) beforeSave() {}
+func (d *DirtySet) beforeSave() {}
-func (x *DirtySet) StateSave(m state.Sink) {
- x.beforeSave()
- var root *DirtySegmentDataSlices = x.saveRoot()
- m.SaveValue(0, root)
+func (d *DirtySet) StateSave(stateSinkObject state.Sink) {
+ d.beforeSave()
+ var rootValue *DirtySegmentDataSlices = d.saveRoot()
+ stateSinkObject.SaveValue(0, rootValue)
}
-func (x *DirtySet) afterLoad() {}
+func (d *DirtySet) afterLoad() {}
-func (x *DirtySet) StateLoad(m state.Source) {
- m.LoadValue(0, new(*DirtySegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*DirtySegmentDataSlices)) })
+func (d *DirtySet) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.LoadValue(0, new(*DirtySegmentDataSlices), func(y interface{}) { d.loadRoot(y.(*DirtySegmentDataSlices)) })
}
-func (x *Dirtynode) StateTypeName() string {
+func (d *Dirtynode) StateTypeName() string {
return "pkg/sentry/fs/fsutil.Dirtynode"
}
-func (x *Dirtynode) StateFields() []string {
+func (d *Dirtynode) StateFields() []string {
return []string{
"nrSegments",
"parent",
@@ -47,38 +47,38 @@ func (x *Dirtynode) StateFields() []string {
}
}
-func (x *Dirtynode) beforeSave() {}
+func (d *Dirtynode) beforeSave() {}
-func (x *Dirtynode) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.nrSegments)
- m.Save(1, &x.parent)
- m.Save(2, &x.parentIndex)
- m.Save(3, &x.hasChildren)
- m.Save(4, &x.maxGap)
- m.Save(5, &x.keys)
- m.Save(6, &x.values)
- m.Save(7, &x.children)
+func (d *Dirtynode) StateSave(stateSinkObject state.Sink) {
+ d.beforeSave()
+ stateSinkObject.Save(0, &d.nrSegments)
+ stateSinkObject.Save(1, &d.parent)
+ stateSinkObject.Save(2, &d.parentIndex)
+ stateSinkObject.Save(3, &d.hasChildren)
+ stateSinkObject.Save(4, &d.maxGap)
+ stateSinkObject.Save(5, &d.keys)
+ stateSinkObject.Save(6, &d.values)
+ stateSinkObject.Save(7, &d.children)
}
-func (x *Dirtynode) afterLoad() {}
+func (d *Dirtynode) afterLoad() {}
-func (x *Dirtynode) StateLoad(m state.Source) {
- m.Load(0, &x.nrSegments)
- m.Load(1, &x.parent)
- m.Load(2, &x.parentIndex)
- m.Load(3, &x.hasChildren)
- m.Load(4, &x.maxGap)
- m.Load(5, &x.keys)
- m.Load(6, &x.values)
- m.Load(7, &x.children)
+func (d *Dirtynode) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &d.nrSegments)
+ stateSourceObject.Load(1, &d.parent)
+ stateSourceObject.Load(2, &d.parentIndex)
+ stateSourceObject.Load(3, &d.hasChildren)
+ stateSourceObject.Load(4, &d.maxGap)
+ stateSourceObject.Load(5, &d.keys)
+ stateSourceObject.Load(6, &d.values)
+ stateSourceObject.Load(7, &d.children)
}
-func (x *DirtySegmentDataSlices) StateTypeName() string {
+func (d *DirtySegmentDataSlices) StateTypeName() string {
return "pkg/sentry/fs/fsutil.DirtySegmentDataSlices"
}
-func (x *DirtySegmentDataSlices) StateFields() []string {
+func (d *DirtySegmentDataSlices) StateFields() []string {
return []string{
"Start",
"End",
@@ -86,52 +86,52 @@ func (x *DirtySegmentDataSlices) StateFields() []string {
}
}
-func (x *DirtySegmentDataSlices) beforeSave() {}
+func (d *DirtySegmentDataSlices) beforeSave() {}
-func (x *DirtySegmentDataSlices) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.Start)
- m.Save(1, &x.End)
- m.Save(2, &x.Values)
+func (d *DirtySegmentDataSlices) StateSave(stateSinkObject state.Sink) {
+ d.beforeSave()
+ stateSinkObject.Save(0, &d.Start)
+ stateSinkObject.Save(1, &d.End)
+ stateSinkObject.Save(2, &d.Values)
}
-func (x *DirtySegmentDataSlices) afterLoad() {}
+func (d *DirtySegmentDataSlices) afterLoad() {}
-func (x *DirtySegmentDataSlices) StateLoad(m state.Source) {
- m.Load(0, &x.Start)
- m.Load(1, &x.End)
- m.Load(2, &x.Values)
+func (d *DirtySegmentDataSlices) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &d.Start)
+ stateSourceObject.Load(1, &d.End)
+ stateSourceObject.Load(2, &d.Values)
}
-func (x *FileRangeSet) StateTypeName() string {
+func (f *FileRangeSet) StateTypeName() string {
return "pkg/sentry/fs/fsutil.FileRangeSet"
}
-func (x *FileRangeSet) StateFields() []string {
+func (f *FileRangeSet) StateFields() []string {
return []string{
"root",
}
}
-func (x *FileRangeSet) beforeSave() {}
+func (f *FileRangeSet) beforeSave() {}
-func (x *FileRangeSet) StateSave(m state.Sink) {
- x.beforeSave()
- var root *FileRangeSegmentDataSlices = x.saveRoot()
- m.SaveValue(0, root)
+func (f *FileRangeSet) StateSave(stateSinkObject state.Sink) {
+ f.beforeSave()
+ var rootValue *FileRangeSegmentDataSlices = f.saveRoot()
+ stateSinkObject.SaveValue(0, rootValue)
}
-func (x *FileRangeSet) afterLoad() {}
+func (f *FileRangeSet) afterLoad() {}
-func (x *FileRangeSet) StateLoad(m state.Source) {
- m.LoadValue(0, new(*FileRangeSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FileRangeSegmentDataSlices)) })
+func (f *FileRangeSet) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.LoadValue(0, new(*FileRangeSegmentDataSlices), func(y interface{}) { f.loadRoot(y.(*FileRangeSegmentDataSlices)) })
}
-func (x *FileRangenode) StateTypeName() string {
+func (f *FileRangenode) StateTypeName() string {
return "pkg/sentry/fs/fsutil.FileRangenode"
}
-func (x *FileRangenode) StateFields() []string {
+func (f *FileRangenode) StateFields() []string {
return []string{
"nrSegments",
"parent",
@@ -144,38 +144,38 @@ func (x *FileRangenode) StateFields() []string {
}
}
-func (x *FileRangenode) beforeSave() {}
+func (f *FileRangenode) beforeSave() {}
-func (x *FileRangenode) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.nrSegments)
- m.Save(1, &x.parent)
- m.Save(2, &x.parentIndex)
- m.Save(3, &x.hasChildren)
- m.Save(4, &x.maxGap)
- m.Save(5, &x.keys)
- m.Save(6, &x.values)
- m.Save(7, &x.children)
+func (f *FileRangenode) StateSave(stateSinkObject state.Sink) {
+ f.beforeSave()
+ stateSinkObject.Save(0, &f.nrSegments)
+ stateSinkObject.Save(1, &f.parent)
+ stateSinkObject.Save(2, &f.parentIndex)
+ stateSinkObject.Save(3, &f.hasChildren)
+ stateSinkObject.Save(4, &f.maxGap)
+ stateSinkObject.Save(5, &f.keys)
+ stateSinkObject.Save(6, &f.values)
+ stateSinkObject.Save(7, &f.children)
}
-func (x *FileRangenode) afterLoad() {}
+func (f *FileRangenode) afterLoad() {}
-func (x *FileRangenode) StateLoad(m state.Source) {
- m.Load(0, &x.nrSegments)
- m.Load(1, &x.parent)
- m.Load(2, &x.parentIndex)
- m.Load(3, &x.hasChildren)
- m.Load(4, &x.maxGap)
- m.Load(5, &x.keys)
- m.Load(6, &x.values)
- m.Load(7, &x.children)
+func (f *FileRangenode) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &f.nrSegments)
+ stateSourceObject.Load(1, &f.parent)
+ stateSourceObject.Load(2, &f.parentIndex)
+ stateSourceObject.Load(3, &f.hasChildren)
+ stateSourceObject.Load(4, &f.maxGap)
+ stateSourceObject.Load(5, &f.keys)
+ stateSourceObject.Load(6, &f.values)
+ stateSourceObject.Load(7, &f.children)
}
-func (x *FileRangeSegmentDataSlices) StateTypeName() string {
+func (f *FileRangeSegmentDataSlices) StateTypeName() string {
return "pkg/sentry/fs/fsutil.FileRangeSegmentDataSlices"
}
-func (x *FileRangeSegmentDataSlices) StateFields() []string {
+func (f *FileRangeSegmentDataSlices) StateFields() []string {
return []string{
"Start",
"End",
@@ -183,52 +183,52 @@ func (x *FileRangeSegmentDataSlices) StateFields() []string {
}
}
-func (x *FileRangeSegmentDataSlices) beforeSave() {}
+func (f *FileRangeSegmentDataSlices) beforeSave() {}
-func (x *FileRangeSegmentDataSlices) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.Start)
- m.Save(1, &x.End)
- m.Save(2, &x.Values)
+func (f *FileRangeSegmentDataSlices) StateSave(stateSinkObject state.Sink) {
+ f.beforeSave()
+ stateSinkObject.Save(0, &f.Start)
+ stateSinkObject.Save(1, &f.End)
+ stateSinkObject.Save(2, &f.Values)
}
-func (x *FileRangeSegmentDataSlices) afterLoad() {}
+func (f *FileRangeSegmentDataSlices) afterLoad() {}
-func (x *FileRangeSegmentDataSlices) StateLoad(m state.Source) {
- m.Load(0, &x.Start)
- m.Load(1, &x.End)
- m.Load(2, &x.Values)
+func (f *FileRangeSegmentDataSlices) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &f.Start)
+ stateSourceObject.Load(1, &f.End)
+ stateSourceObject.Load(2, &f.Values)
}
-func (x *FrameRefSet) StateTypeName() string {
+func (f *FrameRefSet) StateTypeName() string {
return "pkg/sentry/fs/fsutil.FrameRefSet"
}
-func (x *FrameRefSet) StateFields() []string {
+func (f *FrameRefSet) StateFields() []string {
return []string{
"root",
}
}
-func (x *FrameRefSet) beforeSave() {}
+func (f *FrameRefSet) beforeSave() {}
-func (x *FrameRefSet) StateSave(m state.Sink) {
- x.beforeSave()
- var root *FrameRefSegmentDataSlices = x.saveRoot()
- m.SaveValue(0, root)
+func (f *FrameRefSet) StateSave(stateSinkObject state.Sink) {
+ f.beforeSave()
+ var rootValue *FrameRefSegmentDataSlices = f.saveRoot()
+ stateSinkObject.SaveValue(0, rootValue)
}
-func (x *FrameRefSet) afterLoad() {}
+func (f *FrameRefSet) afterLoad() {}
-func (x *FrameRefSet) StateLoad(m state.Source) {
- m.LoadValue(0, new(*FrameRefSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FrameRefSegmentDataSlices)) })
+func (f *FrameRefSet) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.LoadValue(0, new(*FrameRefSegmentDataSlices), func(y interface{}) { f.loadRoot(y.(*FrameRefSegmentDataSlices)) })
}
-func (x *FrameRefnode) StateTypeName() string {
+func (f *FrameRefnode) StateTypeName() string {
return "pkg/sentry/fs/fsutil.FrameRefnode"
}
-func (x *FrameRefnode) StateFields() []string {
+func (f *FrameRefnode) StateFields() []string {
return []string{
"nrSegments",
"parent",
@@ -241,38 +241,38 @@ func (x *FrameRefnode) StateFields() []string {
}
}
-func (x *FrameRefnode) beforeSave() {}
+func (f *FrameRefnode) beforeSave() {}
-func (x *FrameRefnode) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.nrSegments)
- m.Save(1, &x.parent)
- m.Save(2, &x.parentIndex)
- m.Save(3, &x.hasChildren)
- m.Save(4, &x.maxGap)
- m.Save(5, &x.keys)
- m.Save(6, &x.values)
- m.Save(7, &x.children)
+func (f *FrameRefnode) StateSave(stateSinkObject state.Sink) {
+ f.beforeSave()
+ stateSinkObject.Save(0, &f.nrSegments)
+ stateSinkObject.Save(1, &f.parent)
+ stateSinkObject.Save(2, &f.parentIndex)
+ stateSinkObject.Save(3, &f.hasChildren)
+ stateSinkObject.Save(4, &f.maxGap)
+ stateSinkObject.Save(5, &f.keys)
+ stateSinkObject.Save(6, &f.values)
+ stateSinkObject.Save(7, &f.children)
}
-func (x *FrameRefnode) afterLoad() {}
+func (f *FrameRefnode) afterLoad() {}
-func (x *FrameRefnode) StateLoad(m state.Source) {
- m.Load(0, &x.nrSegments)
- m.Load(1, &x.parent)
- m.Load(2, &x.parentIndex)
- m.Load(3, &x.hasChildren)
- m.Load(4, &x.maxGap)
- m.Load(5, &x.keys)
- m.Load(6, &x.values)
- m.Load(7, &x.children)
+func (f *FrameRefnode) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &f.nrSegments)
+ stateSourceObject.Load(1, &f.parent)
+ stateSourceObject.Load(2, &f.parentIndex)
+ stateSourceObject.Load(3, &f.hasChildren)
+ stateSourceObject.Load(4, &f.maxGap)
+ stateSourceObject.Load(5, &f.keys)
+ stateSourceObject.Load(6, &f.values)
+ stateSourceObject.Load(7, &f.children)
}
-func (x *FrameRefSegmentDataSlices) StateTypeName() string {
+func (f *FrameRefSegmentDataSlices) StateTypeName() string {
return "pkg/sentry/fs/fsutil.FrameRefSegmentDataSlices"
}
-func (x *FrameRefSegmentDataSlices) StateFields() []string {
+func (f *FrameRefSegmentDataSlices) StateFields() []string {
return []string{
"Start",
"End",
@@ -280,21 +280,21 @@ func (x *FrameRefSegmentDataSlices) StateFields() []string {
}
}
-func (x *FrameRefSegmentDataSlices) beforeSave() {}
+func (f *FrameRefSegmentDataSlices) beforeSave() {}
-func (x *FrameRefSegmentDataSlices) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.Start)
- m.Save(1, &x.End)
- m.Save(2, &x.Values)
+func (f *FrameRefSegmentDataSlices) StateSave(stateSinkObject state.Sink) {
+ f.beforeSave()
+ stateSinkObject.Save(0, &f.Start)
+ stateSinkObject.Save(1, &f.End)
+ stateSinkObject.Save(2, &f.Values)
}
-func (x *FrameRefSegmentDataSlices) afterLoad() {}
+func (f *FrameRefSegmentDataSlices) afterLoad() {}
-func (x *FrameRefSegmentDataSlices) StateLoad(m state.Source) {
- m.Load(0, &x.Start)
- m.Load(1, &x.End)
- m.Load(2, &x.Values)
+func (f *FrameRefSegmentDataSlices) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &f.Start)
+ stateSourceObject.Load(1, &f.End)
+ stateSourceObject.Load(2, &f.Values)
}
func init() {
diff --git a/pkg/sentry/fs/fsutil/fsutil_state_autogen.go b/pkg/sentry/fs/fsutil/fsutil_state_autogen.go
index 8e2a4c961..43016f689 100644
--- a/pkg/sentry/fs/fsutil/fsutil_state_autogen.go
+++ b/pkg/sentry/fs/fsutil/fsutil_state_autogen.go
@@ -6,124 +6,124 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
-func (x *DirtyInfo) StateTypeName() string {
+func (d *DirtyInfo) StateTypeName() string {
return "pkg/sentry/fs/fsutil.DirtyInfo"
}
-func (x *DirtyInfo) StateFields() []string {
+func (d *DirtyInfo) StateFields() []string {
return []string{
"Keep",
}
}
-func (x *DirtyInfo) beforeSave() {}
+func (d *DirtyInfo) beforeSave() {}
-func (x *DirtyInfo) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.Keep)
+func (d *DirtyInfo) StateSave(stateSinkObject state.Sink) {
+ d.beforeSave()
+ stateSinkObject.Save(0, &d.Keep)
}
-func (x *DirtyInfo) afterLoad() {}
+func (d *DirtyInfo) afterLoad() {}
-func (x *DirtyInfo) StateLoad(m state.Source) {
- m.Load(0, &x.Keep)
+func (d *DirtyInfo) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &d.Keep)
}
-func (x *StaticDirFileOperations) StateTypeName() string {
+func (s *StaticDirFileOperations) StateTypeName() string {
return "pkg/sentry/fs/fsutil.StaticDirFileOperations"
}
-func (x *StaticDirFileOperations) StateFields() []string {
+func (s *StaticDirFileOperations) StateFields() []string {
return []string{
"dentryMap",
"dirCursor",
}
}
-func (x *StaticDirFileOperations) beforeSave() {}
+func (s *StaticDirFileOperations) beforeSave() {}
-func (x *StaticDirFileOperations) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.dentryMap)
- m.Save(1, &x.dirCursor)
+func (s *StaticDirFileOperations) StateSave(stateSinkObject state.Sink) {
+ s.beforeSave()
+ stateSinkObject.Save(0, &s.dentryMap)
+ stateSinkObject.Save(1, &s.dirCursor)
}
-func (x *StaticDirFileOperations) afterLoad() {}
+func (s *StaticDirFileOperations) afterLoad() {}
-func (x *StaticDirFileOperations) StateLoad(m state.Source) {
- m.Load(0, &x.dentryMap)
- m.Load(1, &x.dirCursor)
+func (s *StaticDirFileOperations) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &s.dentryMap)
+ stateSourceObject.Load(1, &s.dirCursor)
}
-func (x *NoReadWriteFile) StateTypeName() string {
+func (n *NoReadWriteFile) StateTypeName() string {
return "pkg/sentry/fs/fsutil.NoReadWriteFile"
}
-func (x *NoReadWriteFile) StateFields() []string {
+func (n *NoReadWriteFile) StateFields() []string {
return []string{}
}
-func (x *NoReadWriteFile) beforeSave() {}
+func (n *NoReadWriteFile) beforeSave() {}
-func (x *NoReadWriteFile) StateSave(m state.Sink) {
- x.beforeSave()
+func (n *NoReadWriteFile) StateSave(stateSinkObject state.Sink) {
+ n.beforeSave()
}
-func (x *NoReadWriteFile) afterLoad() {}
+func (n *NoReadWriteFile) afterLoad() {}
-func (x *NoReadWriteFile) StateLoad(m state.Source) {
+func (n *NoReadWriteFile) StateLoad(stateSourceObject state.Source) {
}
-func (x *FileStaticContentReader) StateTypeName() string {
+func (f *FileStaticContentReader) StateTypeName() string {
return "pkg/sentry/fs/fsutil.FileStaticContentReader"
}
-func (x *FileStaticContentReader) StateFields() []string {
+func (f *FileStaticContentReader) StateFields() []string {
return []string{
"content",
}
}
-func (x *FileStaticContentReader) beforeSave() {}
+func (f *FileStaticContentReader) beforeSave() {}
-func (x *FileStaticContentReader) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.content)
+func (f *FileStaticContentReader) StateSave(stateSinkObject state.Sink) {
+ f.beforeSave()
+ stateSinkObject.Save(0, &f.content)
}
-func (x *FileStaticContentReader) afterLoad() {}
+func (f *FileStaticContentReader) afterLoad() {}
-func (x *FileStaticContentReader) StateLoad(m state.Source) {
- m.Load(0, &x.content)
+func (f *FileStaticContentReader) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &f.content)
}
-func (x *HostFileMapper) StateTypeName() string {
+func (h *HostFileMapper) StateTypeName() string {
return "pkg/sentry/fs/fsutil.HostFileMapper"
}
-func (x *HostFileMapper) StateFields() []string {
+func (h *HostFileMapper) StateFields() []string {
return []string{
"refs",
}
}
-func (x *HostFileMapper) beforeSave() {}
+func (h *HostFileMapper) beforeSave() {}
-func (x *HostFileMapper) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.refs)
+func (h *HostFileMapper) StateSave(stateSinkObject state.Sink) {
+ h.beforeSave()
+ stateSinkObject.Save(0, &h.refs)
}
-func (x *HostFileMapper) StateLoad(m state.Source) {
- m.Load(0, &x.refs)
- m.AfterLoad(x.afterLoad)
+func (h *HostFileMapper) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &h.refs)
+ stateSourceObject.AfterLoad(h.afterLoad)
}
-func (x *HostMappable) StateTypeName() string {
+func (h *HostMappable) StateTypeName() string {
return "pkg/sentry/fs/fsutil.HostMappable"
}
-func (x *HostMappable) StateFields() []string {
+func (h *HostMappable) StateFields() []string {
return []string{
"hostFileMapper",
"backingFile",
@@ -131,169 +131,169 @@ func (x *HostMappable) StateFields() []string {
}
}
-func (x *HostMappable) beforeSave() {}
+func (h *HostMappable) beforeSave() {}
-func (x *HostMappable) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.hostFileMapper)
- m.Save(1, &x.backingFile)
- m.Save(2, &x.mappings)
+func (h *HostMappable) StateSave(stateSinkObject state.Sink) {
+ h.beforeSave()
+ stateSinkObject.Save(0, &h.hostFileMapper)
+ stateSinkObject.Save(1, &h.backingFile)
+ stateSinkObject.Save(2, &h.mappings)
}
-func (x *HostMappable) afterLoad() {}
+func (h *HostMappable) afterLoad() {}
-func (x *HostMappable) StateLoad(m state.Source) {
- m.Load(0, &x.hostFileMapper)
- m.Load(1, &x.backingFile)
- m.Load(2, &x.mappings)
+func (h *HostMappable) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &h.hostFileMapper)
+ stateSourceObject.Load(1, &h.backingFile)
+ stateSourceObject.Load(2, &h.mappings)
}
-func (x *SimpleFileInode) StateTypeName() string {
+func (s *SimpleFileInode) StateTypeName() string {
return "pkg/sentry/fs/fsutil.SimpleFileInode"
}
-func (x *SimpleFileInode) StateFields() []string {
+func (s *SimpleFileInode) StateFields() []string {
return []string{
"InodeSimpleAttributes",
}
}
-func (x *SimpleFileInode) beforeSave() {}
+func (s *SimpleFileInode) beforeSave() {}
-func (x *SimpleFileInode) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.InodeSimpleAttributes)
+func (s *SimpleFileInode) StateSave(stateSinkObject state.Sink) {
+ s.beforeSave()
+ stateSinkObject.Save(0, &s.InodeSimpleAttributes)
}
-func (x *SimpleFileInode) afterLoad() {}
+func (s *SimpleFileInode) afterLoad() {}
-func (x *SimpleFileInode) StateLoad(m state.Source) {
- m.Load(0, &x.InodeSimpleAttributes)
+func (s *SimpleFileInode) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &s.InodeSimpleAttributes)
}
-func (x *NoReadWriteFileInode) StateTypeName() string {
+func (n *NoReadWriteFileInode) StateTypeName() string {
return "pkg/sentry/fs/fsutil.NoReadWriteFileInode"
}
-func (x *NoReadWriteFileInode) StateFields() []string {
+func (n *NoReadWriteFileInode) StateFields() []string {
return []string{
"InodeSimpleAttributes",
}
}
-func (x *NoReadWriteFileInode) beforeSave() {}
+func (n *NoReadWriteFileInode) beforeSave() {}
-func (x *NoReadWriteFileInode) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.InodeSimpleAttributes)
+func (n *NoReadWriteFileInode) StateSave(stateSinkObject state.Sink) {
+ n.beforeSave()
+ stateSinkObject.Save(0, &n.InodeSimpleAttributes)
}
-func (x *NoReadWriteFileInode) afterLoad() {}
+func (n *NoReadWriteFileInode) afterLoad() {}
-func (x *NoReadWriteFileInode) StateLoad(m state.Source) {
- m.Load(0, &x.InodeSimpleAttributes)
+func (n *NoReadWriteFileInode) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &n.InodeSimpleAttributes)
}
-func (x *InodeSimpleAttributes) StateTypeName() string {
+func (i *InodeSimpleAttributes) StateTypeName() string {
return "pkg/sentry/fs/fsutil.InodeSimpleAttributes"
}
-func (x *InodeSimpleAttributes) StateFields() []string {
+func (i *InodeSimpleAttributes) StateFields() []string {
return []string{
"fsType",
"unstable",
}
}
-func (x *InodeSimpleAttributes) beforeSave() {}
+func (i *InodeSimpleAttributes) beforeSave() {}
-func (x *InodeSimpleAttributes) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.fsType)
- m.Save(1, &x.unstable)
+func (i *InodeSimpleAttributes) StateSave(stateSinkObject state.Sink) {
+ i.beforeSave()
+ stateSinkObject.Save(0, &i.fsType)
+ stateSinkObject.Save(1, &i.unstable)
}
-func (x *InodeSimpleAttributes) afterLoad() {}
+func (i *InodeSimpleAttributes) afterLoad() {}
-func (x *InodeSimpleAttributes) StateLoad(m state.Source) {
- m.Load(0, &x.fsType)
- m.Load(1, &x.unstable)
+func (i *InodeSimpleAttributes) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &i.fsType)
+ stateSourceObject.Load(1, &i.unstable)
}
-func (x *InodeSimpleExtendedAttributes) StateTypeName() string {
+func (i *InodeSimpleExtendedAttributes) StateTypeName() string {
return "pkg/sentry/fs/fsutil.InodeSimpleExtendedAttributes"
}
-func (x *InodeSimpleExtendedAttributes) StateFields() []string {
+func (i *InodeSimpleExtendedAttributes) StateFields() []string {
return []string{
"xattrs",
}
}
-func (x *InodeSimpleExtendedAttributes) beforeSave() {}
+func (i *InodeSimpleExtendedAttributes) beforeSave() {}
-func (x *InodeSimpleExtendedAttributes) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.xattrs)
+func (i *InodeSimpleExtendedAttributes) StateSave(stateSinkObject state.Sink) {
+ i.beforeSave()
+ stateSinkObject.Save(0, &i.xattrs)
}
-func (x *InodeSimpleExtendedAttributes) afterLoad() {}
+func (i *InodeSimpleExtendedAttributes) afterLoad() {}
-func (x *InodeSimpleExtendedAttributes) StateLoad(m state.Source) {
- m.Load(0, &x.xattrs)
+func (i *InodeSimpleExtendedAttributes) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &i.xattrs)
}
-func (x *staticFile) StateTypeName() string {
+func (s *staticFile) StateTypeName() string {
return "pkg/sentry/fs/fsutil.staticFile"
}
-func (x *staticFile) StateFields() []string {
+func (s *staticFile) StateFields() []string {
return []string{
"FileStaticContentReader",
}
}
-func (x *staticFile) beforeSave() {}
+func (s *staticFile) beforeSave() {}
-func (x *staticFile) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.FileStaticContentReader)
+func (s *staticFile) StateSave(stateSinkObject state.Sink) {
+ s.beforeSave()
+ stateSinkObject.Save(0, &s.FileStaticContentReader)
}
-func (x *staticFile) afterLoad() {}
+func (s *staticFile) afterLoad() {}
-func (x *staticFile) StateLoad(m state.Source) {
- m.Load(0, &x.FileStaticContentReader)
+func (s *staticFile) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &s.FileStaticContentReader)
}
-func (x *InodeStaticFileGetter) StateTypeName() string {
+func (i *InodeStaticFileGetter) StateTypeName() string {
return "pkg/sentry/fs/fsutil.InodeStaticFileGetter"
}
-func (x *InodeStaticFileGetter) StateFields() []string {
+func (i *InodeStaticFileGetter) StateFields() []string {
return []string{
"Contents",
}
}
-func (x *InodeStaticFileGetter) beforeSave() {}
+func (i *InodeStaticFileGetter) beforeSave() {}
-func (x *InodeStaticFileGetter) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.Contents)
+func (i *InodeStaticFileGetter) StateSave(stateSinkObject state.Sink) {
+ i.beforeSave()
+ stateSinkObject.Save(0, &i.Contents)
}
-func (x *InodeStaticFileGetter) afterLoad() {}
+func (i *InodeStaticFileGetter) afterLoad() {}
-func (x *InodeStaticFileGetter) StateLoad(m state.Source) {
- m.Load(0, &x.Contents)
+func (i *InodeStaticFileGetter) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &i.Contents)
}
-func (x *CachingInodeOperations) StateTypeName() string {
+func (c *CachingInodeOperations) StateTypeName() string {
return "pkg/sentry/fs/fsutil.CachingInodeOperations"
}
-func (x *CachingInodeOperations) StateFields() []string {
+func (c *CachingInodeOperations) StateFields() []string {
return []string{
"backingFile",
"mfp",
@@ -308,61 +308,61 @@ func (x *CachingInodeOperations) StateFields() []string {
}
}
-func (x *CachingInodeOperations) beforeSave() {}
+func (c *CachingInodeOperations) beforeSave() {}
-func (x *CachingInodeOperations) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.backingFile)
- m.Save(1, &x.mfp)
- m.Save(2, &x.opts)
- m.Save(3, &x.attr)
- m.Save(4, &x.dirtyAttr)
- m.Save(5, &x.mappings)
- m.Save(6, &x.cache)
- m.Save(7, &x.dirty)
- m.Save(8, &x.hostFileMapper)
- m.Save(9, &x.refs)
+func (c *CachingInodeOperations) StateSave(stateSinkObject state.Sink) {
+ c.beforeSave()
+ stateSinkObject.Save(0, &c.backingFile)
+ stateSinkObject.Save(1, &c.mfp)
+ stateSinkObject.Save(2, &c.opts)
+ stateSinkObject.Save(3, &c.attr)
+ stateSinkObject.Save(4, &c.dirtyAttr)
+ stateSinkObject.Save(5, &c.mappings)
+ stateSinkObject.Save(6, &c.cache)
+ stateSinkObject.Save(7, &c.dirty)
+ stateSinkObject.Save(8, &c.hostFileMapper)
+ stateSinkObject.Save(9, &c.refs)
}
-func (x *CachingInodeOperations) afterLoad() {}
+func (c *CachingInodeOperations) afterLoad() {}
-func (x *CachingInodeOperations) StateLoad(m state.Source) {
- m.Load(0, &x.backingFile)
- m.Load(1, &x.mfp)
- m.Load(2, &x.opts)
- m.Load(3, &x.attr)
- m.Load(4, &x.dirtyAttr)
- m.Load(5, &x.mappings)
- m.Load(6, &x.cache)
- m.Load(7, &x.dirty)
- m.Load(8, &x.hostFileMapper)
- m.Load(9, &x.refs)
+func (c *CachingInodeOperations) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &c.backingFile)
+ stateSourceObject.Load(1, &c.mfp)
+ stateSourceObject.Load(2, &c.opts)
+ stateSourceObject.Load(3, &c.attr)
+ stateSourceObject.Load(4, &c.dirtyAttr)
+ stateSourceObject.Load(5, &c.mappings)
+ stateSourceObject.Load(6, &c.cache)
+ stateSourceObject.Load(7, &c.dirty)
+ stateSourceObject.Load(8, &c.hostFileMapper)
+ stateSourceObject.Load(9, &c.refs)
}
-func (x *CachingInodeOperationsOptions) StateTypeName() string {
+func (c *CachingInodeOperationsOptions) StateTypeName() string {
return "pkg/sentry/fs/fsutil.CachingInodeOperationsOptions"
}
-func (x *CachingInodeOperationsOptions) StateFields() []string {
+func (c *CachingInodeOperationsOptions) StateFields() []string {
return []string{
"ForcePageCache",
"LimitHostFDTranslation",
}
}
-func (x *CachingInodeOperationsOptions) beforeSave() {}
+func (c *CachingInodeOperationsOptions) beforeSave() {}
-func (x *CachingInodeOperationsOptions) StateSave(m state.Sink) {
- x.beforeSave()
- m.Save(0, &x.ForcePageCache)
- m.Save(1, &x.LimitHostFDTranslation)
+func (c *CachingInodeOperationsOptions) StateSave(stateSinkObject state.Sink) {
+ c.beforeSave()
+ stateSinkObject.Save(0, &c.ForcePageCache)
+ stateSinkObject.Save(1, &c.LimitHostFDTranslation)
}
-func (x *CachingInodeOperationsOptions) afterLoad() {}
+func (c *CachingInodeOperationsOptions) afterLoad() {}
-func (x *CachingInodeOperationsOptions) StateLoad(m state.Source) {
- m.Load(0, &x.ForcePageCache)
- m.Load(1, &x.LimitHostFDTranslation)
+func (c *CachingInodeOperationsOptions) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &c.ForcePageCache)
+ stateSourceObject.Load(1, &c.LimitHostFDTranslation)
}
func init() {
diff --git a/pkg/sentry/fs/fsutil/inode_cached.go b/pkg/sentry/fs/fsutil/inode_cached.go
index 9eb6f522e..85a23432b 100644
--- a/pkg/sentry/fs/fsutil/inode_cached.go
+++ b/pkg/sentry/fs/fsutil/inode_cached.go
@@ -22,7 +22,6 @@ import (
"gvisor.dev/gvisor/pkg/log"
"gvisor.dev/gvisor/pkg/safemem"
"gvisor.dev/gvisor/pkg/sentry/fs"
- "gvisor.dev/gvisor/pkg/sentry/kernel/time"
ktime "gvisor.dev/gvisor/pkg/sentry/kernel/time"
"gvisor.dev/gvisor/pkg/sentry/memmap"
"gvisor.dev/gvisor/pkg/sentry/pgalloc"
@@ -444,7 +443,7 @@ func (c *CachingInodeOperations) TouchAccessTime(ctx context.Context, inode *fs.
// time.
//
// Preconditions: c.attrMu is locked for writing.
-func (c *CachingInodeOperations) touchAccessTimeLocked(now time.Time) {
+func (c *CachingInodeOperations) touchAccessTimeLocked(now ktime.Time) {
c.attr.AccessTime = now
c.dirtyAttr.AccessTime = true
}
@@ -461,7 +460,7 @@ func (c *CachingInodeOperations) TouchModificationAndStatusChangeTime(ctx contex
// and status change times in-place to the current time.
//
// Preconditions: c.attrMu is locked for writing.
-func (c *CachingInodeOperations) touchModificationAndStatusChangeTimeLocked(now time.Time) {
+func (c *CachingInodeOperations) touchModificationAndStatusChangeTimeLocked(now ktime.Time) {
c.attr.ModificationTime = now
c.dirtyAttr.ModificationTime = true
c.attr.StatusChangeTime = now
@@ -480,7 +479,7 @@ func (c *CachingInodeOperations) TouchStatusChangeTime(ctx context.Context) {
// in-place to the current time.
//
// Preconditions: c.attrMu is locked for writing.
-func (c *CachingInodeOperations) touchStatusChangeTimeLocked(now time.Time) {
+func (c *CachingInodeOperations) touchStatusChangeTimeLocked(now ktime.Time) {
c.attr.StatusChangeTime = now
c.dirtyAttr.StatusChangeTime = true
}
@@ -672,9 +671,6 @@ func (rw *inodeReadWriter) ReadToBlocks(dsts safemem.BlockSeq) (uint64, error) {
// Continue.
seg, gap = gap.NextSegment(), FileRangeGapIterator{}
}
-
- default:
- break
}
}
unlock()
@@ -768,9 +764,6 @@ func (rw *inodeReadWriter) WriteFromBlocks(srcs safemem.BlockSeq) (uint64, error
// Continue.
seg, gap = gap.NextSegment(), FileRangeGapIterator{}
-
- default:
- break
}
}
rw.maybeGrowFile()