diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-06-24 06:37:35 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-06-24 06:37:35 +0000 |
commit | 9183888b520beeee8609170819a28bea89202909 (patch) | |
tree | 3cdcfa4de9ced4c539ab7c57e4cf58ffea980f6c /pkg/sentry/fsimpl/kernfs | |
parent | cab13958a54419262aba2a0cd7f1075ed02c8ee0 (diff) | |
parent | 364ac92baf83f2352f78b718090472639bd92a76 (diff) |
Merge release-20200608.0-119-g364ac92ba (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/kernfs')
-rw-r--r-- | pkg/sentry/fsimpl/kernfs/kernfs_state_autogen.go | 190 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/kernfs/slot_list.go | 6 |
2 files changed, 136 insertions, 60 deletions
diff --git a/pkg/sentry/fsimpl/kernfs/kernfs_state_autogen.go b/pkg/sentry/fsimpl/kernfs/kernfs_state_autogen.go index 61b2c460f..371b1481c 100644 --- a/pkg/sentry/fsimpl/kernfs/kernfs_state_autogen.go +++ b/pkg/sentry/fsimpl/kernfs/kernfs_state_autogen.go @@ -6,97 +6,173 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *DynamicBytesFile) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.DynamicBytesFile" +} + +func (x *DynamicBytesFile) StateFields() []string { + return []string{ + "InodeAttrs", + "InodeNoopRefCount", + "InodeNotDirectory", + "InodeNotSymlink", + "locks", + "data", + } +} + func (x *DynamicBytesFile) beforeSave() {} -func (x *DynamicBytesFile) save(m state.Map) { + +func (x *DynamicBytesFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("InodeNoopRefCount", &x.InodeNoopRefCount) - m.Save("InodeNotDirectory", &x.InodeNotDirectory) - m.Save("InodeNotSymlink", &x.InodeNotSymlink) - m.Save("locks", &x.locks) - m.Save("data", &x.data) + m.Save(0, &x.InodeAttrs) + m.Save(1, &x.InodeNoopRefCount) + m.Save(2, &x.InodeNotDirectory) + m.Save(3, &x.InodeNotSymlink) + m.Save(4, &x.locks) + m.Save(5, &x.data) } func (x *DynamicBytesFile) afterLoad() {} -func (x *DynamicBytesFile) load(m state.Map) { - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("InodeNoopRefCount", &x.InodeNoopRefCount) - m.Load("InodeNotDirectory", &x.InodeNotDirectory) - m.Load("InodeNotSymlink", &x.InodeNotSymlink) - m.Load("locks", &x.locks) - m.Load("data", &x.data) + +func (x *DynamicBytesFile) StateLoad(m state.Source) { + m.Load(0, &x.InodeAttrs) + m.Load(1, &x.InodeNoopRefCount) + m.Load(2, &x.InodeNotDirectory) + m.Load(3, &x.InodeNotSymlink) + m.Load(4, &x.locks) + m.Load(5, &x.data) +} + +func (x *DynamicBytesFD) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.DynamicBytesFD" +} + +func (x *DynamicBytesFD) StateFields() []string { + return []string{ + "FileDescriptionDefaultImpl", + "DynamicBytesFileDescriptionImpl", + "LockFD", + "vfsfd", + "inode", + } } func (x *DynamicBytesFD) beforeSave() {} -func (x *DynamicBytesFD) save(m state.Map) { + +func (x *DynamicBytesFD) StateSave(m state.Sink) { x.beforeSave() - m.Save("FileDescriptionDefaultImpl", &x.FileDescriptionDefaultImpl) - m.Save("DynamicBytesFileDescriptionImpl", &x.DynamicBytesFileDescriptionImpl) - m.Save("LockFD", &x.LockFD) - m.Save("vfsfd", &x.vfsfd) - m.Save("inode", &x.inode) + m.Save(0, &x.FileDescriptionDefaultImpl) + m.Save(1, &x.DynamicBytesFileDescriptionImpl) + m.Save(2, &x.LockFD) + m.Save(3, &x.vfsfd) + m.Save(4, &x.inode) } func (x *DynamicBytesFD) afterLoad() {} -func (x *DynamicBytesFD) load(m state.Map) { - m.Load("FileDescriptionDefaultImpl", &x.FileDescriptionDefaultImpl) - m.Load("DynamicBytesFileDescriptionImpl", &x.DynamicBytesFileDescriptionImpl) - m.Load("LockFD", &x.LockFD) - m.Load("vfsfd", &x.vfsfd) - m.Load("inode", &x.inode) + +func (x *DynamicBytesFD) StateLoad(m state.Source) { + m.Load(0, &x.FileDescriptionDefaultImpl) + m.Load(1, &x.DynamicBytesFileDescriptionImpl) + m.Load(2, &x.LockFD) + m.Load(3, &x.vfsfd) + m.Load(4, &x.inode) +} + +func (x *StaticDirectory) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.StaticDirectory" +} + +func (x *StaticDirectory) StateFields() []string { + return []string{ + "InodeNotSymlink", + "InodeDirectoryNoNewChildren", + "InodeAttrs", + "InodeNoDynamicLookup", + "OrderedChildren", + "locks", + } } func (x *StaticDirectory) beforeSave() {} -func (x *StaticDirectory) save(m state.Map) { + +func (x *StaticDirectory) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeNotSymlink", &x.InodeNotSymlink) - m.Save("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("InodeNoDynamicLookup", &x.InodeNoDynamicLookup) - m.Save("OrderedChildren", &x.OrderedChildren) - m.Save("locks", &x.locks) + m.Save(0, &x.InodeNotSymlink) + m.Save(1, &x.InodeDirectoryNoNewChildren) + m.Save(2, &x.InodeAttrs) + m.Save(3, &x.InodeNoDynamicLookup) + m.Save(4, &x.OrderedChildren) + m.Save(5, &x.locks) } func (x *StaticDirectory) afterLoad() {} -func (x *StaticDirectory) load(m state.Map) { - m.Load("InodeNotSymlink", &x.InodeNotSymlink) - m.Load("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("InodeNoDynamicLookup", &x.InodeNoDynamicLookup) - m.Load("OrderedChildren", &x.OrderedChildren) - m.Load("locks", &x.locks) + +func (x *StaticDirectory) StateLoad(m state.Source) { + m.Load(0, &x.InodeNotSymlink) + m.Load(1, &x.InodeDirectoryNoNewChildren) + m.Load(2, &x.InodeAttrs) + m.Load(3, &x.InodeNoDynamicLookup) + m.Load(4, &x.OrderedChildren) + m.Load(5, &x.locks) +} + +func (x *slotList) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.slotList" +} + +func (x *slotList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *slotList) beforeSave() {} -func (x *slotList) save(m state.Map) { + +func (x *slotList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *slotList) afterLoad() {} -func (x *slotList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *slotList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *slotEntry) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.slotEntry" +} + +func (x *slotEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *slotEntry) beforeSave() {} -func (x *slotEntry) save(m state.Map) { + +func (x *slotEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *slotEntry) afterLoad() {} -func (x *slotEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *slotEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) } func init() { - state.Register("pkg/sentry/fsimpl/kernfs.DynamicBytesFile", (*DynamicBytesFile)(nil), state.Fns{Save: (*DynamicBytesFile).save, Load: (*DynamicBytesFile).load}) - state.Register("pkg/sentry/fsimpl/kernfs.DynamicBytesFD", (*DynamicBytesFD)(nil), state.Fns{Save: (*DynamicBytesFD).save, Load: (*DynamicBytesFD).load}) - state.Register("pkg/sentry/fsimpl/kernfs.StaticDirectory", (*StaticDirectory)(nil), state.Fns{Save: (*StaticDirectory).save, Load: (*StaticDirectory).load}) - state.Register("pkg/sentry/fsimpl/kernfs.slotList", (*slotList)(nil), state.Fns{Save: (*slotList).save, Load: (*slotList).load}) - state.Register("pkg/sentry/fsimpl/kernfs.slotEntry", (*slotEntry)(nil), state.Fns{Save: (*slotEntry).save, Load: (*slotEntry).load}) + state.Register((*DynamicBytesFile)(nil)) + state.Register((*DynamicBytesFD)(nil)) + state.Register((*StaticDirectory)(nil)) + state.Register((*slotList)(nil)) + state.Register((*slotEntry)(nil)) } diff --git a/pkg/sentry/fsimpl/kernfs/slot_list.go b/pkg/sentry/fsimpl/kernfs/slot_list.go index 09c30bca7..c6cd74660 100644 --- a/pkg/sentry/fsimpl/kernfs/slot_list.go +++ b/pkg/sentry/fsimpl/kernfs/slot_list.go @@ -56,7 +56,7 @@ func (l *slotList) Back() *slot { // // NOTE: This is an O(n) operation. func (l *slotList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (slotElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *slotList) Remove(e *slot) { if prev != nil { slotElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { slotElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } |