diff options
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r-- | pkg/sentry/fs/dev/dev_state_autogen.go | 250 | ||||
-rw-r--r-- | pkg/sentry/fs/dirent_list.go | 6 | ||||
-rw-r--r-- | pkg/sentry/fs/event_list.go | 6 | ||||
-rw-r--r-- | pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go | 30 | ||||
-rw-r--r-- | pkg/sentry/fs/fs_state_autogen.go | 1305 | ||||
-rw-r--r-- | pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go | 333 | ||||
-rw-r--r-- | pkg/sentry/fs/fsutil/fsutil_state_autogen.go | 371 | ||||
-rw-r--r-- | pkg/sentry/fs/gofer/gofer_state_autogen.go | 278 | ||||
-rw-r--r-- | pkg/sentry/fs/host/host_state_autogen.go | 209 | ||||
-rw-r--r-- | pkg/sentry/fs/lock/lock_state_autogen.go | 189 | ||||
-rw-r--r-- | pkg/sentry/fs/proc/proc_state_autogen.go | 1374 | ||||
-rw-r--r-- | pkg/sentry/fs/proc/seqfile/seqfile_state_autogen.go | 96 | ||||
-rw-r--r-- | pkg/sentry/fs/ramfs/ramfs_state_autogen.go | 160 | ||||
-rw-r--r-- | pkg/sentry/fs/sys/sys_state_autogen.go | 43 | ||||
-rw-r--r-- | pkg/sentry/fs/timerfd/timerfd_state_autogen.go | 29 | ||||
-rw-r--r-- | pkg/sentry/fs/tmpfs/tmpfs_state_autogen.go | 187 | ||||
-rw-r--r-- | pkg/sentry/fs/tty/tty_state_autogen.go | 381 |
17 files changed, 3805 insertions, 1442 deletions
diff --git a/pkg/sentry/fs/dev/dev_state_autogen.go b/pkg/sentry/fs/dev/dev_state_autogen.go index 272f02672..48a60e45f 100644 --- a/pkg/sentry/fs/dev/dev_state_autogen.go +++ b/pkg/sentry/fs/dev/dev_state_autogen.go @@ -6,149 +6,293 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/dev.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} +} + func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *fullDevice) StateTypeName() string { + return "pkg/sentry/fs/dev.fullDevice" +} + +func (x *fullDevice) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *fullDevice) beforeSave() {} -func (x *fullDevice) save(m state.Map) { + +func (x *fullDevice) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *fullDevice) afterLoad() {} -func (x *fullDevice) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *fullDevice) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *fullFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.fullFileOperations" +} + +func (x *fullFileOperations) StateFields() []string { + return []string{} } func (x *fullFileOperations) beforeSave() {} -func (x *fullFileOperations) save(m state.Map) { + +func (x *fullFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *fullFileOperations) afterLoad() {} -func (x *fullFileOperations) load(m state.Map) { + +func (x *fullFileOperations) StateLoad(m state.Source) { +} + +func (x *netTunInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.netTunInodeOperations" +} + +func (x *netTunInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *netTunInodeOperations) beforeSave() {} -func (x *netTunInodeOperations) save(m state.Map) { + +func (x *netTunInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *netTunInodeOperations) afterLoad() {} -func (x *netTunInodeOperations) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *netTunInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *netTunFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.netTunFileOperations" +} + +func (x *netTunFileOperations) StateFields() []string { + return []string{ + "device", + } } func (x *netTunFileOperations) beforeSave() {} -func (x *netTunFileOperations) save(m state.Map) { + +func (x *netTunFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("device", &x.device) + m.Save(0, &x.device) } func (x *netTunFileOperations) afterLoad() {} -func (x *netTunFileOperations) load(m state.Map) { - m.Load("device", &x.device) + +func (x *netTunFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.device) +} + +func (x *nullDevice) StateTypeName() string { + return "pkg/sentry/fs/dev.nullDevice" +} + +func (x *nullDevice) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *nullDevice) beforeSave() {} -func (x *nullDevice) save(m state.Map) { + +func (x *nullDevice) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *nullDevice) afterLoad() {} -func (x *nullDevice) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *nullDevice) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *nullFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.nullFileOperations" +} + +func (x *nullFileOperations) StateFields() []string { + return []string{} } func (x *nullFileOperations) beforeSave() {} -func (x *nullFileOperations) save(m state.Map) { + +func (x *nullFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *nullFileOperations) afterLoad() {} -func (x *nullFileOperations) load(m state.Map) { + +func (x *nullFileOperations) StateLoad(m state.Source) { +} + +func (x *zeroDevice) StateTypeName() string { + return "pkg/sentry/fs/dev.zeroDevice" +} + +func (x *zeroDevice) StateFields() []string { + return []string{ + "nullDevice", + } } func (x *zeroDevice) beforeSave() {} -func (x *zeroDevice) save(m state.Map) { + +func (x *zeroDevice) StateSave(m state.Sink) { x.beforeSave() - m.Save("nullDevice", &x.nullDevice) + m.Save(0, &x.nullDevice) } func (x *zeroDevice) afterLoad() {} -func (x *zeroDevice) load(m state.Map) { - m.Load("nullDevice", &x.nullDevice) + +func (x *zeroDevice) StateLoad(m state.Source) { + m.Load(0, &x.nullDevice) +} + +func (x *zeroFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.zeroFileOperations" +} + +func (x *zeroFileOperations) StateFields() []string { + return []string{} } func (x *zeroFileOperations) beforeSave() {} -func (x *zeroFileOperations) save(m state.Map) { + +func (x *zeroFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *zeroFileOperations) afterLoad() {} -func (x *zeroFileOperations) load(m state.Map) { + +func (x *zeroFileOperations) StateLoad(m state.Source) { +} + +func (x *randomDevice) StateTypeName() string { + return "pkg/sentry/fs/dev.randomDevice" +} + +func (x *randomDevice) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *randomDevice) beforeSave() {} -func (x *randomDevice) save(m state.Map) { + +func (x *randomDevice) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *randomDevice) afterLoad() {} -func (x *randomDevice) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *randomDevice) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *randomFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.randomFileOperations" +} + +func (x *randomFileOperations) StateFields() []string { + return []string{} } func (x *randomFileOperations) beforeSave() {} -func (x *randomFileOperations) save(m state.Map) { + +func (x *randomFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *randomFileOperations) afterLoad() {} -func (x *randomFileOperations) load(m state.Map) { + +func (x *randomFileOperations) StateLoad(m state.Source) { +} + +func (x *ttyInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.ttyInodeOperations" +} + +func (x *ttyInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *ttyInodeOperations) beforeSave() {} -func (x *ttyInodeOperations) save(m state.Map) { + +func (x *ttyInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *ttyInodeOperations) afterLoad() {} -func (x *ttyInodeOperations) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *ttyInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *ttyFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.ttyFileOperations" +} + +func (x *ttyFileOperations) StateFields() []string { + return []string{} } func (x *ttyFileOperations) beforeSave() {} -func (x *ttyFileOperations) save(m state.Map) { + +func (x *ttyFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *ttyFileOperations) afterLoad() {} -func (x *ttyFileOperations) load(m state.Map) { + +func (x *ttyFileOperations) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/fs/dev.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/dev.fullDevice", (*fullDevice)(nil), state.Fns{Save: (*fullDevice).save, Load: (*fullDevice).load}) - state.Register("pkg/sentry/fs/dev.fullFileOperations", (*fullFileOperations)(nil), state.Fns{Save: (*fullFileOperations).save, Load: (*fullFileOperations).load}) - state.Register("pkg/sentry/fs/dev.netTunInodeOperations", (*netTunInodeOperations)(nil), state.Fns{Save: (*netTunInodeOperations).save, Load: (*netTunInodeOperations).load}) - state.Register("pkg/sentry/fs/dev.netTunFileOperations", (*netTunFileOperations)(nil), state.Fns{Save: (*netTunFileOperations).save, Load: (*netTunFileOperations).load}) - state.Register("pkg/sentry/fs/dev.nullDevice", (*nullDevice)(nil), state.Fns{Save: (*nullDevice).save, Load: (*nullDevice).load}) - state.Register("pkg/sentry/fs/dev.nullFileOperations", (*nullFileOperations)(nil), state.Fns{Save: (*nullFileOperations).save, Load: (*nullFileOperations).load}) - state.Register("pkg/sentry/fs/dev.zeroDevice", (*zeroDevice)(nil), state.Fns{Save: (*zeroDevice).save, Load: (*zeroDevice).load}) - state.Register("pkg/sentry/fs/dev.zeroFileOperations", (*zeroFileOperations)(nil), state.Fns{Save: (*zeroFileOperations).save, Load: (*zeroFileOperations).load}) - state.Register("pkg/sentry/fs/dev.randomDevice", (*randomDevice)(nil), state.Fns{Save: (*randomDevice).save, Load: (*randomDevice).load}) - state.Register("pkg/sentry/fs/dev.randomFileOperations", (*randomFileOperations)(nil), state.Fns{Save: (*randomFileOperations).save, Load: (*randomFileOperations).load}) - state.Register("pkg/sentry/fs/dev.ttyInodeOperations", (*ttyInodeOperations)(nil), state.Fns{Save: (*ttyInodeOperations).save, Load: (*ttyInodeOperations).load}) - state.Register("pkg/sentry/fs/dev.ttyFileOperations", (*ttyFileOperations)(nil), state.Fns{Save: (*ttyFileOperations).save, Load: (*ttyFileOperations).load}) + state.Register((*filesystem)(nil)) + state.Register((*fullDevice)(nil)) + state.Register((*fullFileOperations)(nil)) + state.Register((*netTunInodeOperations)(nil)) + state.Register((*netTunFileOperations)(nil)) + state.Register((*nullDevice)(nil)) + state.Register((*nullFileOperations)(nil)) + state.Register((*zeroDevice)(nil)) + state.Register((*zeroFileOperations)(nil)) + state.Register((*randomDevice)(nil)) + state.Register((*randomFileOperations)(nil)) + state.Register((*ttyInodeOperations)(nil)) + state.Register((*ttyFileOperations)(nil)) } diff --git a/pkg/sentry/fs/dirent_list.go b/pkg/sentry/fs/dirent_list.go index ecbbd7883..357ea925d 100644 --- a/pkg/sentry/fs/dirent_list.go +++ b/pkg/sentry/fs/dirent_list.go @@ -56,7 +56,7 @@ func (l *direntList) Back() *Dirent { // // NOTE: This is an O(n) operation. func (l *direntList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (direntElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *direntList) Remove(e *Dirent) { if prev != nil { direntElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { direntElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/fs/event_list.go b/pkg/sentry/fs/event_list.go index 167fdf906..277d8458e 100644 --- a/pkg/sentry/fs/event_list.go +++ b/pkg/sentry/fs/event_list.go @@ -56,7 +56,7 @@ func (l *eventList) Back() *Event { // // NOTE: This is an O(n) operation. func (l *eventList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (eventElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *eventList) Remove(e *Event) { if prev != nil { eventElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { eventElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go b/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go index 9ed7a3d41..359d52e92 100644 --- a/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go +++ b/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go @@ -7,21 +7,33 @@ import ( "gvisor.dev/gvisor/pkg/state" ) -func (x *pipeOperations) save(m state.Map) { +func (x *pipeOperations) StateTypeName() string { + return "pkg/sentry/fs/fdpipe.pipeOperations" +} + +func (x *pipeOperations) StateFields() []string { + return []string{ + "flags", + "opener", + "readAheadBuffer", + } +} + +func (x *pipeOperations) StateSave(m state.Sink) { x.beforeSave() var flags fs.FileFlags = x.saveFlags() - m.SaveValue("flags", flags) - m.Save("opener", &x.opener) - m.Save("readAheadBuffer", &x.readAheadBuffer) + m.SaveValue(0, flags) + m.Save(1, &x.opener) + m.Save(2, &x.readAheadBuffer) } -func (x *pipeOperations) load(m state.Map) { - m.LoadWait("opener", &x.opener) - m.Load("readAheadBuffer", &x.readAheadBuffer) - m.LoadValue("flags", new(fs.FileFlags), func(y interface{}) { x.loadFlags(y.(fs.FileFlags)) }) +func (x *pipeOperations) StateLoad(m state.Source) { + m.LoadWait(1, &x.opener) + m.Load(2, &x.readAheadBuffer) + m.LoadValue(0, new(fs.FileFlags), func(y interface{}) { x.loadFlags(y.(fs.FileFlags)) }) m.AfterLoad(x.afterLoad) } func init() { - state.Register("pkg/sentry/fs/fdpipe.pipeOperations", (*pipeOperations)(nil), state.Fns{Save: (*pipeOperations).save, Load: (*pipeOperations).load}) + state.Register((*pipeOperations)(nil)) } diff --git a/pkg/sentry/fs/fs_state_autogen.go b/pkg/sentry/fs/fs_state_autogen.go index 502a90d71..78e30e0e4 100644 --- a/pkg/sentry/fs/fs_state_autogen.go +++ b/pkg/sentry/fs/fs_state_autogen.go @@ -6,633 +6,1136 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *StableAttr) StateTypeName() string { + return "pkg/sentry/fs.StableAttr" +} + +func (x *StableAttr) StateFields() []string { + return []string{ + "Type", + "DeviceID", + "InodeID", + "BlockSize", + "DeviceFileMajor", + "DeviceFileMinor", + } +} + func (x *StableAttr) beforeSave() {} -func (x *StableAttr) save(m state.Map) { + +func (x *StableAttr) StateSave(m state.Sink) { x.beforeSave() - m.Save("Type", &x.Type) - m.Save("DeviceID", &x.DeviceID) - m.Save("InodeID", &x.InodeID) - m.Save("BlockSize", &x.BlockSize) - m.Save("DeviceFileMajor", &x.DeviceFileMajor) - m.Save("DeviceFileMinor", &x.DeviceFileMinor) + m.Save(0, &x.Type) + m.Save(1, &x.DeviceID) + m.Save(2, &x.InodeID) + m.Save(3, &x.BlockSize) + m.Save(4, &x.DeviceFileMajor) + m.Save(5, &x.DeviceFileMinor) } func (x *StableAttr) afterLoad() {} -func (x *StableAttr) load(m state.Map) { - m.Load("Type", &x.Type) - m.Load("DeviceID", &x.DeviceID) - m.Load("InodeID", &x.InodeID) - m.Load("BlockSize", &x.BlockSize) - m.Load("DeviceFileMajor", &x.DeviceFileMajor) - m.Load("DeviceFileMinor", &x.DeviceFileMinor) + +func (x *StableAttr) StateLoad(m state.Source) { + m.Load(0, &x.Type) + m.Load(1, &x.DeviceID) + m.Load(2, &x.InodeID) + m.Load(3, &x.BlockSize) + m.Load(4, &x.DeviceFileMajor) + m.Load(5, &x.DeviceFileMinor) +} + +func (x *UnstableAttr) StateTypeName() string { + return "pkg/sentry/fs.UnstableAttr" +} + +func (x *UnstableAttr) StateFields() []string { + return []string{ + "Size", + "Usage", + "Perms", + "Owner", + "AccessTime", + "ModificationTime", + "StatusChangeTime", + "Links", + } } func (x *UnstableAttr) beforeSave() {} -func (x *UnstableAttr) save(m state.Map) { + +func (x *UnstableAttr) StateSave(m state.Sink) { x.beforeSave() - m.Save("Size", &x.Size) - m.Save("Usage", &x.Usage) - m.Save("Perms", &x.Perms) - m.Save("Owner", &x.Owner) - m.Save("AccessTime", &x.AccessTime) - m.Save("ModificationTime", &x.ModificationTime) - m.Save("StatusChangeTime", &x.StatusChangeTime) - m.Save("Links", &x.Links) + m.Save(0, &x.Size) + m.Save(1, &x.Usage) + m.Save(2, &x.Perms) + m.Save(3, &x.Owner) + m.Save(4, &x.AccessTime) + m.Save(5, &x.ModificationTime) + m.Save(6, &x.StatusChangeTime) + m.Save(7, &x.Links) } func (x *UnstableAttr) afterLoad() {} -func (x *UnstableAttr) load(m state.Map) { - m.Load("Size", &x.Size) - m.Load("Usage", &x.Usage) - m.Load("Perms", &x.Perms) - m.Load("Owner", &x.Owner) - m.Load("AccessTime", &x.AccessTime) - m.Load("ModificationTime", &x.ModificationTime) - m.Load("StatusChangeTime", &x.StatusChangeTime) - m.Load("Links", &x.Links) + +func (x *UnstableAttr) StateLoad(m state.Source) { + m.Load(0, &x.Size) + m.Load(1, &x.Usage) + m.Load(2, &x.Perms) + m.Load(3, &x.Owner) + m.Load(4, &x.AccessTime) + m.Load(5, &x.ModificationTime) + m.Load(6, &x.StatusChangeTime) + m.Load(7, &x.Links) +} + +func (x *AttrMask) StateTypeName() string { + return "pkg/sentry/fs.AttrMask" +} + +func (x *AttrMask) StateFields() []string { + return []string{ + "Type", + "DeviceID", + "InodeID", + "BlockSize", + "Size", + "Usage", + "Perms", + "UID", + "GID", + "AccessTime", + "ModificationTime", + "StatusChangeTime", + "Links", + } } func (x *AttrMask) beforeSave() {} -func (x *AttrMask) save(m state.Map) { - x.beforeSave() - m.Save("Type", &x.Type) - m.Save("DeviceID", &x.DeviceID) - m.Save("InodeID", &x.InodeID) - m.Save("BlockSize", &x.BlockSize) - m.Save("Size", &x.Size) - m.Save("Usage", &x.Usage) - m.Save("Perms", &x.Perms) - m.Save("UID", &x.UID) - m.Save("GID", &x.GID) - m.Save("AccessTime", &x.AccessTime) - m.Save("ModificationTime", &x.ModificationTime) - m.Save("StatusChangeTime", &x.StatusChangeTime) - m.Save("Links", &x.Links) + +func (x *AttrMask) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.Type) + m.Save(1, &x.DeviceID) + m.Save(2, &x.InodeID) + m.Save(3, &x.BlockSize) + m.Save(4, &x.Size) + m.Save(5, &x.Usage) + m.Save(6, &x.Perms) + m.Save(7, &x.UID) + m.Save(8, &x.GID) + m.Save(9, &x.AccessTime) + m.Save(10, &x.ModificationTime) + m.Save(11, &x.StatusChangeTime) + m.Save(12, &x.Links) } func (x *AttrMask) afterLoad() {} -func (x *AttrMask) load(m state.Map) { - m.Load("Type", &x.Type) - m.Load("DeviceID", &x.DeviceID) - m.Load("InodeID", &x.InodeID) - m.Load("BlockSize", &x.BlockSize) - m.Load("Size", &x.Size) - m.Load("Usage", &x.Usage) - m.Load("Perms", &x.Perms) - m.Load("UID", &x.UID) - m.Load("GID", &x.GID) - m.Load("AccessTime", &x.AccessTime) - m.Load("ModificationTime", &x.ModificationTime) - m.Load("StatusChangeTime", &x.StatusChangeTime) - m.Load("Links", &x.Links) + +func (x *AttrMask) StateLoad(m state.Source) { + m.Load(0, &x.Type) + m.Load(1, &x.DeviceID) + m.Load(2, &x.InodeID) + m.Load(3, &x.BlockSize) + m.Load(4, &x.Size) + m.Load(5, &x.Usage) + m.Load(6, &x.Perms) + m.Load(7, &x.UID) + m.Load(8, &x.GID) + m.Load(9, &x.AccessTime) + m.Load(10, &x.ModificationTime) + m.Load(11, &x.StatusChangeTime) + m.Load(12, &x.Links) +} + +func (x *PermMask) StateTypeName() string { + return "pkg/sentry/fs.PermMask" +} + +func (x *PermMask) StateFields() []string { + return []string{ + "Read", + "Write", + "Execute", + } } func (x *PermMask) beforeSave() {} -func (x *PermMask) save(m state.Map) { + +func (x *PermMask) StateSave(m state.Sink) { x.beforeSave() - m.Save("Read", &x.Read) - m.Save("Write", &x.Write) - m.Save("Execute", &x.Execute) + m.Save(0, &x.Read) + m.Save(1, &x.Write) + m.Save(2, &x.Execute) } func (x *PermMask) afterLoad() {} -func (x *PermMask) load(m state.Map) { - m.Load("Read", &x.Read) - m.Load("Write", &x.Write) - m.Load("Execute", &x.Execute) + +func (x *PermMask) StateLoad(m state.Source) { + m.Load(0, &x.Read) + m.Load(1, &x.Write) + m.Load(2, &x.Execute) +} + +func (x *FilePermissions) StateTypeName() string { + return "pkg/sentry/fs.FilePermissions" +} + +func (x *FilePermissions) StateFields() []string { + return []string{ + "User", + "Group", + "Other", + "Sticky", + "SetUID", + "SetGID", + } } func (x *FilePermissions) beforeSave() {} -func (x *FilePermissions) save(m state.Map) { + +func (x *FilePermissions) StateSave(m state.Sink) { x.beforeSave() - m.Save("User", &x.User) - m.Save("Group", &x.Group) - m.Save("Other", &x.Other) - m.Save("Sticky", &x.Sticky) - m.Save("SetUID", &x.SetUID) - m.Save("SetGID", &x.SetGID) + m.Save(0, &x.User) + m.Save(1, &x.Group) + m.Save(2, &x.Other) + m.Save(3, &x.Sticky) + m.Save(4, &x.SetUID) + m.Save(5, &x.SetGID) } func (x *FilePermissions) afterLoad() {} -func (x *FilePermissions) load(m state.Map) { - m.Load("User", &x.User) - m.Load("Group", &x.Group) - m.Load("Other", &x.Other) - m.Load("Sticky", &x.Sticky) - m.Load("SetUID", &x.SetUID) - m.Load("SetGID", &x.SetGID) + +func (x *FilePermissions) StateLoad(m state.Source) { + m.Load(0, &x.User) + m.Load(1, &x.Group) + m.Load(2, &x.Other) + m.Load(3, &x.Sticky) + m.Load(4, &x.SetUID) + m.Load(5, &x.SetGID) +} + +func (x *FileOwner) StateTypeName() string { + return "pkg/sentry/fs.FileOwner" +} + +func (x *FileOwner) StateFields() []string { + return []string{ + "UID", + "GID", + } } func (x *FileOwner) beforeSave() {} -func (x *FileOwner) save(m state.Map) { + +func (x *FileOwner) StateSave(m state.Sink) { x.beforeSave() - m.Save("UID", &x.UID) - m.Save("GID", &x.GID) + m.Save(0, &x.UID) + m.Save(1, &x.GID) } func (x *FileOwner) afterLoad() {} -func (x *FileOwner) load(m state.Map) { - m.Load("UID", &x.UID) - m.Load("GID", &x.GID) + +func (x *FileOwner) StateLoad(m state.Source) { + m.Load(0, &x.UID) + m.Load(1, &x.GID) +} + +func (x *DentAttr) StateTypeName() string { + return "pkg/sentry/fs.DentAttr" +} + +func (x *DentAttr) StateFields() []string { + return []string{ + "Type", + "InodeID", + } } func (x *DentAttr) beforeSave() {} -func (x *DentAttr) save(m state.Map) { + +func (x *DentAttr) StateSave(m state.Sink) { x.beforeSave() - m.Save("Type", &x.Type) - m.Save("InodeID", &x.InodeID) + m.Save(0, &x.Type) + m.Save(1, &x.InodeID) } func (x *DentAttr) afterLoad() {} -func (x *DentAttr) load(m state.Map) { - m.Load("Type", &x.Type) - m.Load("InodeID", &x.InodeID) + +func (x *DentAttr) StateLoad(m state.Source) { + m.Load(0, &x.Type) + m.Load(1, &x.InodeID) +} + +func (x *SortedDentryMap) StateTypeName() string { + return "pkg/sentry/fs.SortedDentryMap" +} + +func (x *SortedDentryMap) StateFields() []string { + return []string{ + "names", + "entries", + } } func (x *SortedDentryMap) beforeSave() {} -func (x *SortedDentryMap) save(m state.Map) { + +func (x *SortedDentryMap) StateSave(m state.Sink) { x.beforeSave() - m.Save("names", &x.names) - m.Save("entries", &x.entries) + m.Save(0, &x.names) + m.Save(1, &x.entries) } func (x *SortedDentryMap) afterLoad() {} -func (x *SortedDentryMap) load(m state.Map) { - m.Load("names", &x.names) - m.Load("entries", &x.entries) + +func (x *SortedDentryMap) StateLoad(m state.Source) { + m.Load(0, &x.names) + m.Load(1, &x.entries) } -func (x *Dirent) save(m state.Map) { +func (x *Dirent) StateTypeName() string { + return "pkg/sentry/fs.Dirent" +} + +func (x *Dirent) StateFields() []string { + return []string{ + "AtomicRefCount", + "userVisible", + "Inode", + "name", + "parent", + "deleted", + "mounted", + "children", + } +} + +func (x *Dirent) StateSave(m state.Sink) { x.beforeSave() var children map[string]*Dirent = x.saveChildren() - m.SaveValue("children", children) - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("userVisible", &x.userVisible) - m.Save("Inode", &x.Inode) - m.Save("name", &x.name) - m.Save("parent", &x.parent) - m.Save("deleted", &x.deleted) - m.Save("mounted", &x.mounted) -} - -func (x *Dirent) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("userVisible", &x.userVisible) - m.Load("Inode", &x.Inode) - m.Load("name", &x.name) - m.Load("parent", &x.parent) - m.Load("deleted", &x.deleted) - m.Load("mounted", &x.mounted) - m.LoadValue("children", new(map[string]*Dirent), func(y interface{}) { x.loadChildren(y.(map[string]*Dirent)) }) + m.SaveValue(7, children) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.userVisible) + m.Save(2, &x.Inode) + m.Save(3, &x.name) + m.Save(4, &x.parent) + m.Save(5, &x.deleted) + m.Save(6, &x.mounted) +} + +func (x *Dirent) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.userVisible) + m.Load(2, &x.Inode) + m.Load(3, &x.name) + m.Load(4, &x.parent) + m.Load(5, &x.deleted) + m.Load(6, &x.mounted) + m.LoadValue(7, new(map[string]*Dirent), func(y interface{}) { x.loadChildren(y.(map[string]*Dirent)) }) m.AfterLoad(x.afterLoad) } +func (x *DirentCache) StateTypeName() string { + return "pkg/sentry/fs.DirentCache" +} + +func (x *DirentCache) StateFields() []string { + return []string{ + "maxSize", + "limit", + } +} + func (x *DirentCache) beforeSave() {} -func (x *DirentCache) save(m state.Map) { + +func (x *DirentCache) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.currentSize) { - m.Failf("currentSize is %#v, expected zero", &x.currentSize) + state.Failf("currentSize is %#v, expected zero", &x.currentSize) } if !state.IsZeroValue(&x.list) { - m.Failf("list is %#v, expected zero", &x.list) + state.Failf("list is %#v, expected zero", &x.list) } - m.Save("maxSize", &x.maxSize) - m.Save("limit", &x.limit) + m.Save(0, &x.maxSize) + m.Save(1, &x.limit) } func (x *DirentCache) afterLoad() {} -func (x *DirentCache) load(m state.Map) { - m.Load("maxSize", &x.maxSize) - m.Load("limit", &x.limit) + +func (x *DirentCache) StateLoad(m state.Source) { + m.Load(0, &x.maxSize) + m.Load(1, &x.limit) +} + +func (x *DirentCacheLimiter) StateTypeName() string { + return "pkg/sentry/fs.DirentCacheLimiter" +} + +func (x *DirentCacheLimiter) StateFields() []string { + return []string{ + "max", + } } func (x *DirentCacheLimiter) beforeSave() {} -func (x *DirentCacheLimiter) save(m state.Map) { + +func (x *DirentCacheLimiter) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.count) { - m.Failf("count is %#v, expected zero", &x.count) + state.Failf("count is %#v, expected zero", &x.count) } - m.Save("max", &x.max) + m.Save(0, &x.max) } func (x *DirentCacheLimiter) afterLoad() {} -func (x *DirentCacheLimiter) load(m state.Map) { - m.Load("max", &x.max) + +func (x *DirentCacheLimiter) StateLoad(m state.Source) { + m.Load(0, &x.max) +} + +func (x *direntList) StateTypeName() string { + return "pkg/sentry/fs.direntList" +} + +func (x *direntList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *direntList) beforeSave() {} -func (x *direntList) save(m state.Map) { + +func (x *direntList) 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 *direntList) afterLoad() {} -func (x *direntList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *direntList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *direntEntry) StateTypeName() string { + return "pkg/sentry/fs.direntEntry" +} + +func (x *direntEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *direntEntry) beforeSave() {} -func (x *direntEntry) save(m state.Map) { + +func (x *direntEntry) 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 *direntEntry) afterLoad() {} -func (x *direntEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *direntEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *eventList) StateTypeName() string { + return "pkg/sentry/fs.eventList" +} + +func (x *eventList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *eventList) beforeSave() {} -func (x *eventList) save(m state.Map) { + +func (x *eventList) 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 *eventList) afterLoad() {} -func (x *eventList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *eventList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *eventEntry) StateTypeName() string { + return "pkg/sentry/fs.eventEntry" +} + +func (x *eventEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *eventEntry) beforeSave() {} -func (x *eventEntry) save(m state.Map) { + +func (x *eventEntry) 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 *eventEntry) afterLoad() {} -func (x *eventEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) -} - -func (x *File) save(m state.Map) { - x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("UniqueID", &x.UniqueID) - m.Save("Dirent", &x.Dirent) - m.Save("flags", &x.flags) - m.Save("async", &x.async) - m.Save("FileOperations", &x.FileOperations) - m.Save("offset", &x.offset) -} - -func (x *File) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("UniqueID", &x.UniqueID) - m.Load("Dirent", &x.Dirent) - m.Load("flags", &x.flags) - m.Load("async", &x.async) - m.LoadWait("FileOperations", &x.FileOperations) - m.Load("offset", &x.offset) + +func (x *eventEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *File) StateTypeName() string { + return "pkg/sentry/fs.File" +} + +func (x *File) StateFields() []string { + return []string{ + "AtomicRefCount", + "UniqueID", + "Dirent", + "flags", + "async", + "FileOperations", + "offset", + } +} + +func (x *File) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.UniqueID) + m.Save(2, &x.Dirent) + m.Save(3, &x.flags) + m.Save(4, &x.async) + m.Save(5, &x.FileOperations) + m.Save(6, &x.offset) +} + +func (x *File) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.UniqueID) + m.Load(2, &x.Dirent) + m.Load(3, &x.flags) + m.Load(4, &x.async) + m.LoadWait(5, &x.FileOperations) + m.Load(6, &x.offset) m.AfterLoad(x.afterLoad) } +func (x *overlayFileOperations) StateTypeName() string { + return "pkg/sentry/fs.overlayFileOperations" +} + +func (x *overlayFileOperations) StateFields() []string { + return []string{ + "upper", + "lower", + "dirCursor", + } +} + func (x *overlayFileOperations) beforeSave() {} -func (x *overlayFileOperations) save(m state.Map) { + +func (x *overlayFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("upper", &x.upper) - m.Save("lower", &x.lower) - m.Save("dirCursor", &x.dirCursor) + m.Save(0, &x.upper) + m.Save(1, &x.lower) + m.Save(2, &x.dirCursor) } func (x *overlayFileOperations) afterLoad() {} -func (x *overlayFileOperations) load(m state.Map) { - m.Load("upper", &x.upper) - m.Load("lower", &x.lower) - m.Load("dirCursor", &x.dirCursor) + +func (x *overlayFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.upper) + m.Load(1, &x.lower) + m.Load(2, &x.dirCursor) +} + +func (x *overlayMappingIdentity) StateTypeName() string { + return "pkg/sentry/fs.overlayMappingIdentity" +} + +func (x *overlayMappingIdentity) StateFields() []string { + return []string{ + "AtomicRefCount", + "id", + "overlayFile", + } } func (x *overlayMappingIdentity) beforeSave() {} -func (x *overlayMappingIdentity) save(m state.Map) { + +func (x *overlayMappingIdentity) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("id", &x.id) - m.Save("overlayFile", &x.overlayFile) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.id) + m.Save(2, &x.overlayFile) } func (x *overlayMappingIdentity) afterLoad() {} -func (x *overlayMappingIdentity) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("id", &x.id) - m.Load("overlayFile", &x.overlayFile) + +func (x *overlayMappingIdentity) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.id) + m.Load(2, &x.overlayFile) +} + +func (x *MountSourceFlags) StateTypeName() string { + return "pkg/sentry/fs.MountSourceFlags" +} + +func (x *MountSourceFlags) StateFields() []string { + return []string{ + "ReadOnly", + "NoAtime", + "ForcePageCache", + "NoExec", + } } func (x *MountSourceFlags) beforeSave() {} -func (x *MountSourceFlags) save(m state.Map) { + +func (x *MountSourceFlags) StateSave(m state.Sink) { x.beforeSave() - m.Save("ReadOnly", &x.ReadOnly) - m.Save("NoAtime", &x.NoAtime) - m.Save("ForcePageCache", &x.ForcePageCache) - m.Save("NoExec", &x.NoExec) + m.Save(0, &x.ReadOnly) + m.Save(1, &x.NoAtime) + m.Save(2, &x.ForcePageCache) + m.Save(3, &x.NoExec) } func (x *MountSourceFlags) afterLoad() {} -func (x *MountSourceFlags) load(m state.Map) { - m.Load("ReadOnly", &x.ReadOnly) - m.Load("NoAtime", &x.NoAtime) - m.Load("ForcePageCache", &x.ForcePageCache) - m.Load("NoExec", &x.NoExec) + +func (x *MountSourceFlags) StateLoad(m state.Source) { + m.Load(0, &x.ReadOnly) + m.Load(1, &x.NoAtime) + m.Load(2, &x.ForcePageCache) + m.Load(3, &x.NoExec) +} + +func (x *FileFlags) StateTypeName() string { + return "pkg/sentry/fs.FileFlags" +} + +func (x *FileFlags) StateFields() []string { + return []string{ + "Direct", + "NonBlocking", + "DSync", + "Sync", + "Append", + "Read", + "Write", + "Pread", + "Pwrite", + "Directory", + "Async", + "LargeFile", + "NonSeekable", + "Truncate", + } } func (x *FileFlags) beforeSave() {} -func (x *FileFlags) save(m state.Map) { - x.beforeSave() - m.Save("Direct", &x.Direct) - m.Save("NonBlocking", &x.NonBlocking) - m.Save("DSync", &x.DSync) - m.Save("Sync", &x.Sync) - m.Save("Append", &x.Append) - m.Save("Read", &x.Read) - m.Save("Write", &x.Write) - m.Save("Pread", &x.Pread) - m.Save("Pwrite", &x.Pwrite) - m.Save("Directory", &x.Directory) - m.Save("Async", &x.Async) - m.Save("LargeFile", &x.LargeFile) - m.Save("NonSeekable", &x.NonSeekable) - m.Save("Truncate", &x.Truncate) + +func (x *FileFlags) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.Direct) + m.Save(1, &x.NonBlocking) + m.Save(2, &x.DSync) + m.Save(3, &x.Sync) + m.Save(4, &x.Append) + m.Save(5, &x.Read) + m.Save(6, &x.Write) + m.Save(7, &x.Pread) + m.Save(8, &x.Pwrite) + m.Save(9, &x.Directory) + m.Save(10, &x.Async) + m.Save(11, &x.LargeFile) + m.Save(12, &x.NonSeekable) + m.Save(13, &x.Truncate) } func (x *FileFlags) afterLoad() {} -func (x *FileFlags) load(m state.Map) { - m.Load("Direct", &x.Direct) - m.Load("NonBlocking", &x.NonBlocking) - m.Load("DSync", &x.DSync) - m.Load("Sync", &x.Sync) - m.Load("Append", &x.Append) - m.Load("Read", &x.Read) - m.Load("Write", &x.Write) - m.Load("Pread", &x.Pread) - m.Load("Pwrite", &x.Pwrite) - m.Load("Directory", &x.Directory) - m.Load("Async", &x.Async) - m.Load("LargeFile", &x.LargeFile) - m.Load("NonSeekable", &x.NonSeekable) - m.Load("Truncate", &x.Truncate) + +func (x *FileFlags) StateLoad(m state.Source) { + m.Load(0, &x.Direct) + m.Load(1, &x.NonBlocking) + m.Load(2, &x.DSync) + m.Load(3, &x.Sync) + m.Load(4, &x.Append) + m.Load(5, &x.Read) + m.Load(6, &x.Write) + m.Load(7, &x.Pread) + m.Load(8, &x.Pwrite) + m.Load(9, &x.Directory) + m.Load(10, &x.Async) + m.Load(11, &x.LargeFile) + m.Load(12, &x.NonSeekable) + m.Load(13, &x.Truncate) +} + +func (x *Inode) StateTypeName() string { + return "pkg/sentry/fs.Inode" +} + +func (x *Inode) StateFields() []string { + return []string{ + "AtomicRefCount", + "InodeOperations", + "StableAttr", + "LockCtx", + "Watches", + "MountSource", + "overlay", + } } func (x *Inode) beforeSave() {} -func (x *Inode) save(m state.Map) { + +func (x *Inode) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("InodeOperations", &x.InodeOperations) - m.Save("StableAttr", &x.StableAttr) - m.Save("LockCtx", &x.LockCtx) - m.Save("Watches", &x.Watches) - m.Save("MountSource", &x.MountSource) - m.Save("overlay", &x.overlay) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.InodeOperations) + m.Save(2, &x.StableAttr) + m.Save(3, &x.LockCtx) + m.Save(4, &x.Watches) + m.Save(5, &x.MountSource) + m.Save(6, &x.overlay) } func (x *Inode) afterLoad() {} -func (x *Inode) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("InodeOperations", &x.InodeOperations) - m.Load("StableAttr", &x.StableAttr) - m.Load("LockCtx", &x.LockCtx) - m.Load("Watches", &x.Watches) - m.Load("MountSource", &x.MountSource) - m.Load("overlay", &x.overlay) + +func (x *Inode) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.InodeOperations) + m.Load(2, &x.StableAttr) + m.Load(3, &x.LockCtx) + m.Load(4, &x.Watches) + m.Load(5, &x.MountSource) + m.Load(6, &x.overlay) +} + +func (x *LockCtx) StateTypeName() string { + return "pkg/sentry/fs.LockCtx" +} + +func (x *LockCtx) StateFields() []string { + return []string{ + "Posix", + "BSD", + } } func (x *LockCtx) beforeSave() {} -func (x *LockCtx) save(m state.Map) { + +func (x *LockCtx) StateSave(m state.Sink) { x.beforeSave() - m.Save("Posix", &x.Posix) - m.Save("BSD", &x.BSD) + m.Save(0, &x.Posix) + m.Save(1, &x.BSD) } func (x *LockCtx) afterLoad() {} -func (x *LockCtx) load(m state.Map) { - m.Load("Posix", &x.Posix) - m.Load("BSD", &x.BSD) + +func (x *LockCtx) StateLoad(m state.Source) { + m.Load(0, &x.Posix) + m.Load(1, &x.BSD) +} + +func (x *Watches) StateTypeName() string { + return "pkg/sentry/fs.Watches" +} + +func (x *Watches) StateFields() []string { + return []string{ + "ws", + "unlinked", + } } func (x *Watches) beforeSave() {} -func (x *Watches) save(m state.Map) { + +func (x *Watches) StateSave(m state.Sink) { x.beforeSave() - m.Save("ws", &x.ws) - m.Save("unlinked", &x.unlinked) + m.Save(0, &x.ws) + m.Save(1, &x.unlinked) } func (x *Watches) afterLoad() {} -func (x *Watches) load(m state.Map) { - m.Load("ws", &x.ws) - m.Load("unlinked", &x.unlinked) + +func (x *Watches) StateLoad(m state.Source) { + m.Load(0, &x.ws) + m.Load(1, &x.unlinked) +} + +func (x *Inotify) StateTypeName() string { + return "pkg/sentry/fs.Inotify" +} + +func (x *Inotify) StateFields() []string { + return []string{ + "id", + "events", + "scratch", + "nextWatch", + "watches", + } } func (x *Inotify) beforeSave() {} -func (x *Inotify) save(m state.Map) { + +func (x *Inotify) StateSave(m state.Sink) { x.beforeSave() - m.Save("id", &x.id) - m.Save("events", &x.events) - m.Save("scratch", &x.scratch) - m.Save("nextWatch", &x.nextWatch) - m.Save("watches", &x.watches) + m.Save(0, &x.id) + m.Save(1, &x.events) + m.Save(2, &x.scratch) + m.Save(3, &x.nextWatch) + m.Save(4, &x.watches) } func (x *Inotify) afterLoad() {} -func (x *Inotify) load(m state.Map) { - m.Load("id", &x.id) - m.Load("events", &x.events) - m.Load("scratch", &x.scratch) - m.Load("nextWatch", &x.nextWatch) - m.Load("watches", &x.watches) + +func (x *Inotify) StateLoad(m state.Source) { + m.Load(0, &x.id) + m.Load(1, &x.events) + m.Load(2, &x.scratch) + m.Load(3, &x.nextWatch) + m.Load(4, &x.watches) +} + +func (x *Event) StateTypeName() string { + return "pkg/sentry/fs.Event" +} + +func (x *Event) StateFields() []string { + return []string{ + "eventEntry", + "wd", + "mask", + "cookie", + "len", + "name", + } } func (x *Event) beforeSave() {} -func (x *Event) save(m state.Map) { + +func (x *Event) StateSave(m state.Sink) { x.beforeSave() - m.Save("eventEntry", &x.eventEntry) - m.Save("wd", &x.wd) - m.Save("mask", &x.mask) - m.Save("cookie", &x.cookie) - m.Save("len", &x.len) - m.Save("name", &x.name) + m.Save(0, &x.eventEntry) + m.Save(1, &x.wd) + m.Save(2, &x.mask) + m.Save(3, &x.cookie) + m.Save(4, &x.len) + m.Save(5, &x.name) } func (x *Event) afterLoad() {} -func (x *Event) load(m state.Map) { - m.Load("eventEntry", &x.eventEntry) - m.Load("wd", &x.wd) - m.Load("mask", &x.mask) - m.Load("cookie", &x.cookie) - m.Load("len", &x.len) - m.Load("name", &x.name) + +func (x *Event) StateLoad(m state.Source) { + m.Load(0, &x.eventEntry) + m.Load(1, &x.wd) + m.Load(2, &x.mask) + m.Load(3, &x.cookie) + m.Load(4, &x.len) + m.Load(5, &x.name) +} + +func (x *Watch) StateTypeName() string { + return "pkg/sentry/fs.Watch" +} + +func (x *Watch) StateFields() []string { + return []string{ + "owner", + "wd", + "target", + "unpinned", + "mask", + "pins", + } } func (x *Watch) beforeSave() {} -func (x *Watch) save(m state.Map) { + +func (x *Watch) StateSave(m state.Sink) { x.beforeSave() - m.Save("owner", &x.owner) - m.Save("wd", &x.wd) - m.Save("target", &x.target) - m.Save("unpinned", &x.unpinned) - m.Save("mask", &x.mask) - m.Save("pins", &x.pins) + m.Save(0, &x.owner) + m.Save(1, &x.wd) + m.Save(2, &x.target) + m.Save(3, &x.unpinned) + m.Save(4, &x.mask) + m.Save(5, &x.pins) } func (x *Watch) afterLoad() {} -func (x *Watch) load(m state.Map) { - m.Load("owner", &x.owner) - m.Load("wd", &x.wd) - m.Load("target", &x.target) - m.Load("unpinned", &x.unpinned) - m.Load("mask", &x.mask) - m.Load("pins", &x.pins) + +func (x *Watch) StateLoad(m state.Source) { + m.Load(0, &x.owner) + m.Load(1, &x.wd) + m.Load(2, &x.target) + m.Load(3, &x.unpinned) + m.Load(4, &x.mask) + m.Load(5, &x.pins) +} + +func (x *MountSource) StateTypeName() string { + return "pkg/sentry/fs.MountSource" +} + +func (x *MountSource) StateFields() []string { + return []string{ + "AtomicRefCount", + "MountSourceOperations", + "FilesystemType", + "Flags", + "fscache", + "direntRefs", + } } func (x *MountSource) beforeSave() {} -func (x *MountSource) save(m state.Map) { + +func (x *MountSource) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("MountSourceOperations", &x.MountSourceOperations) - m.Save("FilesystemType", &x.FilesystemType) - m.Save("Flags", &x.Flags) - m.Save("fscache", &x.fscache) - m.Save("direntRefs", &x.direntRefs) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.MountSourceOperations) + m.Save(2, &x.FilesystemType) + m.Save(3, &x.Flags) + m.Save(4, &x.fscache) + m.Save(5, &x.direntRefs) } func (x *MountSource) afterLoad() {} -func (x *MountSource) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("MountSourceOperations", &x.MountSourceOperations) - m.Load("FilesystemType", &x.FilesystemType) - m.Load("Flags", &x.Flags) - m.Load("fscache", &x.fscache) - m.Load("direntRefs", &x.direntRefs) + +func (x *MountSource) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.MountSourceOperations) + m.Load(2, &x.FilesystemType) + m.Load(3, &x.Flags) + m.Load(4, &x.fscache) + m.Load(5, &x.direntRefs) +} + +func (x *SimpleMountSourceOperations) StateTypeName() string { + return "pkg/sentry/fs.SimpleMountSourceOperations" +} + +func (x *SimpleMountSourceOperations) StateFields() []string { + return []string{ + "keep", + "revalidate", + "cacheReaddir", + } } func (x *SimpleMountSourceOperations) beforeSave() {} -func (x *SimpleMountSourceOperations) save(m state.Map) { + +func (x *SimpleMountSourceOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("keep", &x.keep) - m.Save("revalidate", &x.revalidate) - m.Save("cacheReaddir", &x.cacheReaddir) + m.Save(0, &x.keep) + m.Save(1, &x.revalidate) + m.Save(2, &x.cacheReaddir) } func (x *SimpleMountSourceOperations) afterLoad() {} -func (x *SimpleMountSourceOperations) load(m state.Map) { - m.Load("keep", &x.keep) - m.Load("revalidate", &x.revalidate) - m.Load("cacheReaddir", &x.cacheReaddir) + +func (x *SimpleMountSourceOperations) StateLoad(m state.Source) { + m.Load(0, &x.keep) + m.Load(1, &x.revalidate) + m.Load(2, &x.cacheReaddir) +} + +func (x *overlayMountSourceOperations) StateTypeName() string { + return "pkg/sentry/fs.overlayMountSourceOperations" +} + +func (x *overlayMountSourceOperations) StateFields() []string { + return []string{ + "upper", + "lower", + } } func (x *overlayMountSourceOperations) beforeSave() {} -func (x *overlayMountSourceOperations) save(m state.Map) { + +func (x *overlayMountSourceOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("upper", &x.upper) - m.Save("lower", &x.lower) + m.Save(0, &x.upper) + m.Save(1, &x.lower) } func (x *overlayMountSourceOperations) afterLoad() {} -func (x *overlayMountSourceOperations) load(m state.Map) { - m.Load("upper", &x.upper) - m.Load("lower", &x.lower) + +func (x *overlayMountSourceOperations) StateLoad(m state.Source) { + m.Load(0, &x.upper) + m.Load(1, &x.lower) +} + +func (x *overlayFilesystem) StateTypeName() string { + return "pkg/sentry/fs.overlayFilesystem" +} + +func (x *overlayFilesystem) StateFields() []string { + return []string{} } func (x *overlayFilesystem) beforeSave() {} -func (x *overlayFilesystem) save(m state.Map) { + +func (x *overlayFilesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *overlayFilesystem) afterLoad() {} -func (x *overlayFilesystem) load(m state.Map) { + +func (x *overlayFilesystem) StateLoad(m state.Source) { +} + +func (x *Mount) StateTypeName() string { + return "pkg/sentry/fs.Mount" +} + +func (x *Mount) StateFields() []string { + return []string{ + "ID", + "ParentID", + "root", + "previous", + } } func (x *Mount) beforeSave() {} -func (x *Mount) save(m state.Map) { + +func (x *Mount) StateSave(m state.Sink) { x.beforeSave() - m.Save("ID", &x.ID) - m.Save("ParentID", &x.ParentID) - m.Save("root", &x.root) - m.Save("previous", &x.previous) + m.Save(0, &x.ID) + m.Save(1, &x.ParentID) + m.Save(2, &x.root) + m.Save(3, &x.previous) } func (x *Mount) afterLoad() {} -func (x *Mount) load(m state.Map) { - m.Load("ID", &x.ID) - m.Load("ParentID", &x.ParentID) - m.Load("root", &x.root) - m.Load("previous", &x.previous) + +func (x *Mount) StateLoad(m state.Source) { + m.Load(0, &x.ID) + m.Load(1, &x.ParentID) + m.Load(2, &x.root) + m.Load(3, &x.previous) +} + +func (x *MountNamespace) StateTypeName() string { + return "pkg/sentry/fs.MountNamespace" +} + +func (x *MountNamespace) StateFields() []string { + return []string{ + "AtomicRefCount", + "userns", + "root", + "mounts", + "mountID", + } } func (x *MountNamespace) beforeSave() {} -func (x *MountNamespace) save(m state.Map) { + +func (x *MountNamespace) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("userns", &x.userns) - m.Save("root", &x.root) - m.Save("mounts", &x.mounts) - m.Save("mountID", &x.mountID) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.userns) + m.Save(2, &x.root) + m.Save(3, &x.mounts) + m.Save(4, &x.mountID) } func (x *MountNamespace) afterLoad() {} -func (x *MountNamespace) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("userns", &x.userns) - m.Load("root", &x.root) - m.Load("mounts", &x.mounts) - m.Load("mountID", &x.mountID) + +func (x *MountNamespace) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.userns) + m.Load(2, &x.root) + m.Load(3, &x.mounts) + m.Load(4, &x.mountID) +} + +func (x *overlayEntry) StateTypeName() string { + return "pkg/sentry/fs.overlayEntry" +} + +func (x *overlayEntry) StateFields() []string { + return []string{ + "lowerExists", + "lower", + "mappings", + "upper", + "dirCache", + } } func (x *overlayEntry) beforeSave() {} -func (x *overlayEntry) save(m state.Map) { + +func (x *overlayEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("lowerExists", &x.lowerExists) - m.Save("lower", &x.lower) - m.Save("mappings", &x.mappings) - m.Save("upper", &x.upper) - m.Save("dirCache", &x.dirCache) + m.Save(0, &x.lowerExists) + m.Save(1, &x.lower) + m.Save(2, &x.mappings) + m.Save(3, &x.upper) + m.Save(4, &x.dirCache) } func (x *overlayEntry) afterLoad() {} -func (x *overlayEntry) load(m state.Map) { - m.Load("lowerExists", &x.lowerExists) - m.Load("lower", &x.lower) - m.Load("mappings", &x.mappings) - m.Load("upper", &x.upper) - m.Load("dirCache", &x.dirCache) + +func (x *overlayEntry) StateLoad(m state.Source) { + m.Load(0, &x.lowerExists) + m.Load(1, &x.lower) + m.Load(2, &x.mappings) + m.Load(3, &x.upper) + m.Load(4, &x.dirCache) } func init() { - state.Register("pkg/sentry/fs.StableAttr", (*StableAttr)(nil), state.Fns{Save: (*StableAttr).save, Load: (*StableAttr).load}) - state.Register("pkg/sentry/fs.UnstableAttr", (*UnstableAttr)(nil), state.Fns{Save: (*UnstableAttr).save, Load: (*UnstableAttr).load}) - state.Register("pkg/sentry/fs.AttrMask", (*AttrMask)(nil), state.Fns{Save: (*AttrMask).save, Load: (*AttrMask).load}) - state.Register("pkg/sentry/fs.PermMask", (*PermMask)(nil), state.Fns{Save: (*PermMask).save, Load: (*PermMask).load}) - state.Register("pkg/sentry/fs.FilePermissions", (*FilePermissions)(nil), state.Fns{Save: (*FilePermissions).save, Load: (*FilePermissions).load}) - state.Register("pkg/sentry/fs.FileOwner", (*FileOwner)(nil), state.Fns{Save: (*FileOwner).save, Load: (*FileOwner).load}) - state.Register("pkg/sentry/fs.DentAttr", (*DentAttr)(nil), state.Fns{Save: (*DentAttr).save, Load: (*DentAttr).load}) - state.Register("pkg/sentry/fs.SortedDentryMap", (*SortedDentryMap)(nil), state.Fns{Save: (*SortedDentryMap).save, Load: (*SortedDentryMap).load}) - state.Register("pkg/sentry/fs.Dirent", (*Dirent)(nil), state.Fns{Save: (*Dirent).save, Load: (*Dirent).load}) - state.Register("pkg/sentry/fs.DirentCache", (*DirentCache)(nil), state.Fns{Save: (*DirentCache).save, Load: (*DirentCache).load}) - state.Register("pkg/sentry/fs.DirentCacheLimiter", (*DirentCacheLimiter)(nil), state.Fns{Save: (*DirentCacheLimiter).save, Load: (*DirentCacheLimiter).load}) - state.Register("pkg/sentry/fs.direntList", (*direntList)(nil), state.Fns{Save: (*direntList).save, Load: (*direntList).load}) - state.Register("pkg/sentry/fs.direntEntry", (*direntEntry)(nil), state.Fns{Save: (*direntEntry).save, Load: (*direntEntry).load}) - state.Register("pkg/sentry/fs.eventList", (*eventList)(nil), state.Fns{Save: (*eventList).save, Load: (*eventList).load}) - state.Register("pkg/sentry/fs.eventEntry", (*eventEntry)(nil), state.Fns{Save: (*eventEntry).save, Load: (*eventEntry).load}) - state.Register("pkg/sentry/fs.File", (*File)(nil), state.Fns{Save: (*File).save, Load: (*File).load}) - state.Register("pkg/sentry/fs.overlayFileOperations", (*overlayFileOperations)(nil), state.Fns{Save: (*overlayFileOperations).save, Load: (*overlayFileOperations).load}) - state.Register("pkg/sentry/fs.overlayMappingIdentity", (*overlayMappingIdentity)(nil), state.Fns{Save: (*overlayMappingIdentity).save, Load: (*overlayMappingIdentity).load}) - state.Register("pkg/sentry/fs.MountSourceFlags", (*MountSourceFlags)(nil), state.Fns{Save: (*MountSourceFlags).save, Load: (*MountSourceFlags).load}) - state.Register("pkg/sentry/fs.FileFlags", (*FileFlags)(nil), state.Fns{Save: (*FileFlags).save, Load: (*FileFlags).load}) - state.Register("pkg/sentry/fs.Inode", (*Inode)(nil), state.Fns{Save: (*Inode).save, Load: (*Inode).load}) - state.Register("pkg/sentry/fs.LockCtx", (*LockCtx)(nil), state.Fns{Save: (*LockCtx).save, Load: (*LockCtx).load}) - state.Register("pkg/sentry/fs.Watches", (*Watches)(nil), state.Fns{Save: (*Watches).save, Load: (*Watches).load}) - state.Register("pkg/sentry/fs.Inotify", (*Inotify)(nil), state.Fns{Save: (*Inotify).save, Load: (*Inotify).load}) - state.Register("pkg/sentry/fs.Event", (*Event)(nil), state.Fns{Save: (*Event).save, Load: (*Event).load}) - state.Register("pkg/sentry/fs.Watch", (*Watch)(nil), state.Fns{Save: (*Watch).save, Load: (*Watch).load}) - state.Register("pkg/sentry/fs.MountSource", (*MountSource)(nil), state.Fns{Save: (*MountSource).save, Load: (*MountSource).load}) - state.Register("pkg/sentry/fs.SimpleMountSourceOperations", (*SimpleMountSourceOperations)(nil), state.Fns{Save: (*SimpleMountSourceOperations).save, Load: (*SimpleMountSourceOperations).load}) - state.Register("pkg/sentry/fs.overlayMountSourceOperations", (*overlayMountSourceOperations)(nil), state.Fns{Save: (*overlayMountSourceOperations).save, Load: (*overlayMountSourceOperations).load}) - state.Register("pkg/sentry/fs.overlayFilesystem", (*overlayFilesystem)(nil), state.Fns{Save: (*overlayFilesystem).save, Load: (*overlayFilesystem).load}) - state.Register("pkg/sentry/fs.Mount", (*Mount)(nil), state.Fns{Save: (*Mount).save, Load: (*Mount).load}) - state.Register("pkg/sentry/fs.MountNamespace", (*MountNamespace)(nil), state.Fns{Save: (*MountNamespace).save, Load: (*MountNamespace).load}) - state.Register("pkg/sentry/fs.overlayEntry", (*overlayEntry)(nil), state.Fns{Save: (*overlayEntry).save, Load: (*overlayEntry).load}) + state.Register((*StableAttr)(nil)) + state.Register((*UnstableAttr)(nil)) + state.Register((*AttrMask)(nil)) + state.Register((*PermMask)(nil)) + state.Register((*FilePermissions)(nil)) + state.Register((*FileOwner)(nil)) + state.Register((*DentAttr)(nil)) + state.Register((*SortedDentryMap)(nil)) + state.Register((*Dirent)(nil)) + state.Register((*DirentCache)(nil)) + state.Register((*DirentCacheLimiter)(nil)) + state.Register((*direntList)(nil)) + state.Register((*direntEntry)(nil)) + state.Register((*eventList)(nil)) + state.Register((*eventEntry)(nil)) + state.Register((*File)(nil)) + state.Register((*overlayFileOperations)(nil)) + state.Register((*overlayMappingIdentity)(nil)) + state.Register((*MountSourceFlags)(nil)) + state.Register((*FileFlags)(nil)) + state.Register((*Inode)(nil)) + state.Register((*LockCtx)(nil)) + state.Register((*Watches)(nil)) + state.Register((*Inotify)(nil)) + state.Register((*Event)(nil)) + state.Register((*Watch)(nil)) + state.Register((*MountSource)(nil)) + state.Register((*SimpleMountSourceOperations)(nil)) + state.Register((*overlayMountSourceOperations)(nil)) + state.Register((*overlayFilesystem)(nil)) + state.Register((*Mount)(nil)) + state.Register((*MountNamespace)(nil)) + state.Register((*overlayEntry)(nil)) } diff --git a/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go b/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go index 79d4610f0..b3270d11d 100644 --- a/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go +++ b/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go @@ -6,170 +6,305 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *DirtySet) StateTypeName() string { + return "pkg/sentry/fs/fsutil.DirtySet" +} + +func (x *DirtySet) StateFields() []string { + return []string{ + "root", + } +} + func (x *DirtySet) beforeSave() {} -func (x *DirtySet) save(m state.Map) { + +func (x *DirtySet) StateSave(m state.Sink) { x.beforeSave() var root *DirtySegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *DirtySet) afterLoad() {} -func (x *DirtySet) load(m state.Map) { - m.LoadValue("root", new(*DirtySegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*DirtySegmentDataSlices)) }) + +func (x *DirtySet) StateLoad(m state.Source) { + m.LoadValue(0, new(*DirtySegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*DirtySegmentDataSlices)) }) +} + +func (x *Dirtynode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.Dirtynode" +} + +func (x *Dirtynode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *Dirtynode) beforeSave() {} -func (x *Dirtynode) save(m state.Map) { + +func (x *Dirtynode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + 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 (x *Dirtynode) afterLoad() {} -func (x *Dirtynode) load(m state.Map) { - m.Load("nrSegments", &x.nrSegments) - m.Load("parent", &x.parent) - m.Load("parentIndex", &x.parentIndex) - m.Load("hasChildren", &x.hasChildren) - m.Load("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +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 (x *DirtySegmentDataSlices) StateTypeName() string { + return "pkg/sentry/fs/fsutil.DirtySegmentDataSlices" +} + +func (x *DirtySegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *DirtySegmentDataSlices) beforeSave() {} -func (x *DirtySegmentDataSlices) save(m state.Map) { + +func (x *DirtySegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *DirtySegmentDataSlices) afterLoad() {} -func (x *DirtySegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *DirtySegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) +} + +func (x *FileRangeSet) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FileRangeSet" +} + +func (x *FileRangeSet) StateFields() []string { + return []string{ + "root", + } } func (x *FileRangeSet) beforeSave() {} -func (x *FileRangeSet) save(m state.Map) { + +func (x *FileRangeSet) StateSave(m state.Sink) { x.beforeSave() var root *FileRangeSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *FileRangeSet) afterLoad() {} -func (x *FileRangeSet) load(m state.Map) { - m.LoadValue("root", new(*FileRangeSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FileRangeSegmentDataSlices)) }) + +func (x *FileRangeSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*FileRangeSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FileRangeSegmentDataSlices)) }) +} + +func (x *FileRangenode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FileRangenode" +} + +func (x *FileRangenode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *FileRangenode) beforeSave() {} -func (x *FileRangenode) save(m state.Map) { + +func (x *FileRangenode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + 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 (x *FileRangenode) afterLoad() {} -func (x *FileRangenode) load(m state.Map) { - m.Load("nrSegments", &x.nrSegments) - m.Load("parent", &x.parent) - m.Load("parentIndex", &x.parentIndex) - m.Load("hasChildren", &x.hasChildren) - m.Load("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +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 (x *FileRangeSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FileRangeSegmentDataSlices" +} + +func (x *FileRangeSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *FileRangeSegmentDataSlices) beforeSave() {} -func (x *FileRangeSegmentDataSlices) save(m state.Map) { + +func (x *FileRangeSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *FileRangeSegmentDataSlices) afterLoad() {} -func (x *FileRangeSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *FileRangeSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) +} + +func (x *FrameRefSet) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FrameRefSet" +} + +func (x *FrameRefSet) StateFields() []string { + return []string{ + "root", + } } func (x *FrameRefSet) beforeSave() {} -func (x *FrameRefSet) save(m state.Map) { + +func (x *FrameRefSet) StateSave(m state.Sink) { x.beforeSave() var root *FrameRefSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *FrameRefSet) afterLoad() {} -func (x *FrameRefSet) load(m state.Map) { - m.LoadValue("root", new(*FrameRefSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FrameRefSegmentDataSlices)) }) + +func (x *FrameRefSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*FrameRefSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FrameRefSegmentDataSlices)) }) +} + +func (x *FrameRefnode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FrameRefnode" +} + +func (x *FrameRefnode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *FrameRefnode) beforeSave() {} -func (x *FrameRefnode) save(m state.Map) { + +func (x *FrameRefnode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + 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 (x *FrameRefnode) afterLoad() {} -func (x *FrameRefnode) load(m state.Map) { - m.Load("nrSegments", &x.nrSegments) - m.Load("parent", &x.parent) - m.Load("parentIndex", &x.parentIndex) - m.Load("hasChildren", &x.hasChildren) - m.Load("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +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 (x *FrameRefSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FrameRefSegmentDataSlices" +} + +func (x *FrameRefSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *FrameRefSegmentDataSlices) beforeSave() {} -func (x *FrameRefSegmentDataSlices) save(m state.Map) { + +func (x *FrameRefSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *FrameRefSegmentDataSlices) afterLoad() {} -func (x *FrameRefSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *FrameRefSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) } func init() { - state.Register("pkg/sentry/fs/fsutil.DirtySet", (*DirtySet)(nil), state.Fns{Save: (*DirtySet).save, Load: (*DirtySet).load}) - state.Register("pkg/sentry/fs/fsutil.Dirtynode", (*Dirtynode)(nil), state.Fns{Save: (*Dirtynode).save, Load: (*Dirtynode).load}) - state.Register("pkg/sentry/fs/fsutil.DirtySegmentDataSlices", (*DirtySegmentDataSlices)(nil), state.Fns{Save: (*DirtySegmentDataSlices).save, Load: (*DirtySegmentDataSlices).load}) - state.Register("pkg/sentry/fs/fsutil.FileRangeSet", (*FileRangeSet)(nil), state.Fns{Save: (*FileRangeSet).save, Load: (*FileRangeSet).load}) - state.Register("pkg/sentry/fs/fsutil.FileRangenode", (*FileRangenode)(nil), state.Fns{Save: (*FileRangenode).save, Load: (*FileRangenode).load}) - state.Register("pkg/sentry/fs/fsutil.FileRangeSegmentDataSlices", (*FileRangeSegmentDataSlices)(nil), state.Fns{Save: (*FileRangeSegmentDataSlices).save, Load: (*FileRangeSegmentDataSlices).load}) - state.Register("pkg/sentry/fs/fsutil.FrameRefSet", (*FrameRefSet)(nil), state.Fns{Save: (*FrameRefSet).save, Load: (*FrameRefSet).load}) - state.Register("pkg/sentry/fs/fsutil.FrameRefnode", (*FrameRefnode)(nil), state.Fns{Save: (*FrameRefnode).save, Load: (*FrameRefnode).load}) - state.Register("pkg/sentry/fs/fsutil.FrameRefSegmentDataSlices", (*FrameRefSegmentDataSlices)(nil), state.Fns{Save: (*FrameRefSegmentDataSlices).save, Load: (*FrameRefSegmentDataSlices).load}) + state.Register((*DirtySet)(nil)) + state.Register((*Dirtynode)(nil)) + state.Register((*DirtySegmentDataSlices)(nil)) + state.Register((*FileRangeSet)(nil)) + state.Register((*FileRangenode)(nil)) + state.Register((*FileRangeSegmentDataSlices)(nil)) + state.Register((*FrameRefSet)(nil)) + state.Register((*FrameRefnode)(nil)) + state.Register((*FrameRefSegmentDataSlices)(nil)) } diff --git a/pkg/sentry/fs/fsutil/fsutil_state_autogen.go b/pkg/sentry/fs/fsutil/fsutil_state_autogen.go index 80b93ad25..8e2a4c961 100644 --- a/pkg/sentry/fs/fsutil/fsutil_state_autogen.go +++ b/pkg/sentry/fs/fsutil/fsutil_state_autogen.go @@ -6,199 +6,378 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *DirtyInfo) StateTypeName() string { + return "pkg/sentry/fs/fsutil.DirtyInfo" +} + +func (x *DirtyInfo) StateFields() []string { + return []string{ + "Keep", + } +} + func (x *DirtyInfo) beforeSave() {} -func (x *DirtyInfo) save(m state.Map) { + +func (x *DirtyInfo) StateSave(m state.Sink) { x.beforeSave() - m.Save("Keep", &x.Keep) + m.Save(0, &x.Keep) } func (x *DirtyInfo) afterLoad() {} -func (x *DirtyInfo) load(m state.Map) { - m.Load("Keep", &x.Keep) + +func (x *DirtyInfo) StateLoad(m state.Source) { + m.Load(0, &x.Keep) +} + +func (x *StaticDirFileOperations) StateTypeName() string { + return "pkg/sentry/fs/fsutil.StaticDirFileOperations" +} + +func (x *StaticDirFileOperations) StateFields() []string { + return []string{ + "dentryMap", + "dirCursor", + } } func (x *StaticDirFileOperations) beforeSave() {} -func (x *StaticDirFileOperations) save(m state.Map) { + +func (x *StaticDirFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("dentryMap", &x.dentryMap) - m.Save("dirCursor", &x.dirCursor) + m.Save(0, &x.dentryMap) + m.Save(1, &x.dirCursor) } func (x *StaticDirFileOperations) afterLoad() {} -func (x *StaticDirFileOperations) load(m state.Map) { - m.Load("dentryMap", &x.dentryMap) - m.Load("dirCursor", &x.dirCursor) + +func (x *StaticDirFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.dentryMap) + m.Load(1, &x.dirCursor) +} + +func (x *NoReadWriteFile) StateTypeName() string { + return "pkg/sentry/fs/fsutil.NoReadWriteFile" +} + +func (x *NoReadWriteFile) StateFields() []string { + return []string{} } func (x *NoReadWriteFile) beforeSave() {} -func (x *NoReadWriteFile) save(m state.Map) { + +func (x *NoReadWriteFile) StateSave(m state.Sink) { x.beforeSave() } func (x *NoReadWriteFile) afterLoad() {} -func (x *NoReadWriteFile) load(m state.Map) { + +func (x *NoReadWriteFile) StateLoad(m state.Source) { +} + +func (x *FileStaticContentReader) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FileStaticContentReader" +} + +func (x *FileStaticContentReader) StateFields() []string { + return []string{ + "content", + } } func (x *FileStaticContentReader) beforeSave() {} -func (x *FileStaticContentReader) save(m state.Map) { + +func (x *FileStaticContentReader) StateSave(m state.Sink) { x.beforeSave() - m.Save("content", &x.content) + m.Save(0, &x.content) } func (x *FileStaticContentReader) afterLoad() {} -func (x *FileStaticContentReader) load(m state.Map) { - m.Load("content", &x.content) + +func (x *FileStaticContentReader) StateLoad(m state.Source) { + m.Load(0, &x.content) +} + +func (x *HostFileMapper) StateTypeName() string { + return "pkg/sentry/fs/fsutil.HostFileMapper" +} + +func (x *HostFileMapper) StateFields() []string { + return []string{ + "refs", + } } func (x *HostFileMapper) beforeSave() {} -func (x *HostFileMapper) save(m state.Map) { + +func (x *HostFileMapper) StateSave(m state.Sink) { x.beforeSave() - m.Save("refs", &x.refs) + m.Save(0, &x.refs) } -func (x *HostFileMapper) load(m state.Map) { - m.Load("refs", &x.refs) +func (x *HostFileMapper) StateLoad(m state.Source) { + m.Load(0, &x.refs) m.AfterLoad(x.afterLoad) } +func (x *HostMappable) StateTypeName() string { + return "pkg/sentry/fs/fsutil.HostMappable" +} + +func (x *HostMappable) StateFields() []string { + return []string{ + "hostFileMapper", + "backingFile", + "mappings", + } +} + func (x *HostMappable) beforeSave() {} -func (x *HostMappable) save(m state.Map) { + +func (x *HostMappable) StateSave(m state.Sink) { x.beforeSave() - m.Save("hostFileMapper", &x.hostFileMapper) - m.Save("backingFile", &x.backingFile) - m.Save("mappings", &x.mappings) + m.Save(0, &x.hostFileMapper) + m.Save(1, &x.backingFile) + m.Save(2, &x.mappings) } func (x *HostMappable) afterLoad() {} -func (x *HostMappable) load(m state.Map) { - m.Load("hostFileMapper", &x.hostFileMapper) - m.Load("backingFile", &x.backingFile) - m.Load("mappings", &x.mappings) + +func (x *HostMappable) StateLoad(m state.Source) { + m.Load(0, &x.hostFileMapper) + m.Load(1, &x.backingFile) + m.Load(2, &x.mappings) +} + +func (x *SimpleFileInode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.SimpleFileInode" +} + +func (x *SimpleFileInode) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *SimpleFileInode) beforeSave() {} -func (x *SimpleFileInode) save(m state.Map) { + +func (x *SimpleFileInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *SimpleFileInode) afterLoad() {} -func (x *SimpleFileInode) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *SimpleFileInode) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *NoReadWriteFileInode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.NoReadWriteFileInode" +} + +func (x *NoReadWriteFileInode) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *NoReadWriteFileInode) beforeSave() {} -func (x *NoReadWriteFileInode) save(m state.Map) { + +func (x *NoReadWriteFileInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *NoReadWriteFileInode) afterLoad() {} -func (x *NoReadWriteFileInode) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *NoReadWriteFileInode) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *InodeSimpleAttributes) StateTypeName() string { + return "pkg/sentry/fs/fsutil.InodeSimpleAttributes" +} + +func (x *InodeSimpleAttributes) StateFields() []string { + return []string{ + "fsType", + "unstable", + } } func (x *InodeSimpleAttributes) beforeSave() {} -func (x *InodeSimpleAttributes) save(m state.Map) { + +func (x *InodeSimpleAttributes) StateSave(m state.Sink) { x.beforeSave() - m.Save("fsType", &x.fsType) - m.Save("unstable", &x.unstable) + m.Save(0, &x.fsType) + m.Save(1, &x.unstable) } func (x *InodeSimpleAttributes) afterLoad() {} -func (x *InodeSimpleAttributes) load(m state.Map) { - m.Load("fsType", &x.fsType) - m.Load("unstable", &x.unstable) + +func (x *InodeSimpleAttributes) StateLoad(m state.Source) { + m.Load(0, &x.fsType) + m.Load(1, &x.unstable) +} + +func (x *InodeSimpleExtendedAttributes) StateTypeName() string { + return "pkg/sentry/fs/fsutil.InodeSimpleExtendedAttributes" +} + +func (x *InodeSimpleExtendedAttributes) StateFields() []string { + return []string{ + "xattrs", + } } func (x *InodeSimpleExtendedAttributes) beforeSave() {} -func (x *InodeSimpleExtendedAttributes) save(m state.Map) { + +func (x *InodeSimpleExtendedAttributes) StateSave(m state.Sink) { x.beforeSave() - m.Save("xattrs", &x.xattrs) + m.Save(0, &x.xattrs) } func (x *InodeSimpleExtendedAttributes) afterLoad() {} -func (x *InodeSimpleExtendedAttributes) load(m state.Map) { - m.Load("xattrs", &x.xattrs) + +func (x *InodeSimpleExtendedAttributes) StateLoad(m state.Source) { + m.Load(0, &x.xattrs) +} + +func (x *staticFile) StateTypeName() string { + return "pkg/sentry/fs/fsutil.staticFile" +} + +func (x *staticFile) StateFields() []string { + return []string{ + "FileStaticContentReader", + } } func (x *staticFile) beforeSave() {} -func (x *staticFile) save(m state.Map) { + +func (x *staticFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("FileStaticContentReader", &x.FileStaticContentReader) + m.Save(0, &x.FileStaticContentReader) } func (x *staticFile) afterLoad() {} -func (x *staticFile) load(m state.Map) { - m.Load("FileStaticContentReader", &x.FileStaticContentReader) + +func (x *staticFile) StateLoad(m state.Source) { + m.Load(0, &x.FileStaticContentReader) +} + +func (x *InodeStaticFileGetter) StateTypeName() string { + return "pkg/sentry/fs/fsutil.InodeStaticFileGetter" +} + +func (x *InodeStaticFileGetter) StateFields() []string { + return []string{ + "Contents", + } } func (x *InodeStaticFileGetter) beforeSave() {} -func (x *InodeStaticFileGetter) save(m state.Map) { + +func (x *InodeStaticFileGetter) StateSave(m state.Sink) { x.beforeSave() - m.Save("Contents", &x.Contents) + m.Save(0, &x.Contents) } func (x *InodeStaticFileGetter) afterLoad() {} -func (x *InodeStaticFileGetter) load(m state.Map) { - m.Load("Contents", &x.Contents) + +func (x *InodeStaticFileGetter) StateLoad(m state.Source) { + m.Load(0, &x.Contents) +} + +func (x *CachingInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/fsutil.CachingInodeOperations" +} + +func (x *CachingInodeOperations) StateFields() []string { + return []string{ + "backingFile", + "mfp", + "opts", + "attr", + "dirtyAttr", + "mappings", + "cache", + "dirty", + "hostFileMapper", + "refs", + } } func (x *CachingInodeOperations) beforeSave() {} -func (x *CachingInodeOperations) save(m state.Map) { + +func (x *CachingInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("backingFile", &x.backingFile) - m.Save("mfp", &x.mfp) - m.Save("opts", &x.opts) - m.Save("attr", &x.attr) - m.Save("dirtyAttr", &x.dirtyAttr) - m.Save("mappings", &x.mappings) - m.Save("cache", &x.cache) - m.Save("dirty", &x.dirty) - m.Save("hostFileMapper", &x.hostFileMapper) - m.Save("refs", &x.refs) + 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 (x *CachingInodeOperations) afterLoad() {} -func (x *CachingInodeOperations) load(m state.Map) { - m.Load("backingFile", &x.backingFile) - m.Load("mfp", &x.mfp) - m.Load("opts", &x.opts) - m.Load("attr", &x.attr) - m.Load("dirtyAttr", &x.dirtyAttr) - m.Load("mappings", &x.mappings) - m.Load("cache", &x.cache) - m.Load("dirty", &x.dirty) - m.Load("hostFileMapper", &x.hostFileMapper) - m.Load("refs", &x.refs) + +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 (x *CachingInodeOperationsOptions) StateTypeName() string { + return "pkg/sentry/fs/fsutil.CachingInodeOperationsOptions" +} + +func (x *CachingInodeOperationsOptions) StateFields() []string { + return []string{ + "ForcePageCache", + "LimitHostFDTranslation", + } } func (x *CachingInodeOperationsOptions) beforeSave() {} -func (x *CachingInodeOperationsOptions) save(m state.Map) { + +func (x *CachingInodeOperationsOptions) StateSave(m state.Sink) { x.beforeSave() - m.Save("ForcePageCache", &x.ForcePageCache) - m.Save("LimitHostFDTranslation", &x.LimitHostFDTranslation) + m.Save(0, &x.ForcePageCache) + m.Save(1, &x.LimitHostFDTranslation) } func (x *CachingInodeOperationsOptions) afterLoad() {} -func (x *CachingInodeOperationsOptions) load(m state.Map) { - m.Load("ForcePageCache", &x.ForcePageCache) - m.Load("LimitHostFDTranslation", &x.LimitHostFDTranslation) + +func (x *CachingInodeOperationsOptions) StateLoad(m state.Source) { + m.Load(0, &x.ForcePageCache) + m.Load(1, &x.LimitHostFDTranslation) } func init() { - state.Register("pkg/sentry/fs/fsutil.DirtyInfo", (*DirtyInfo)(nil), state.Fns{Save: (*DirtyInfo).save, Load: (*DirtyInfo).load}) - state.Register("pkg/sentry/fs/fsutil.StaticDirFileOperations", (*StaticDirFileOperations)(nil), state.Fns{Save: (*StaticDirFileOperations).save, Load: (*StaticDirFileOperations).load}) - state.Register("pkg/sentry/fs/fsutil.NoReadWriteFile", (*NoReadWriteFile)(nil), state.Fns{Save: (*NoReadWriteFile).save, Load: (*NoReadWriteFile).load}) - state.Register("pkg/sentry/fs/fsutil.FileStaticContentReader", (*FileStaticContentReader)(nil), state.Fns{Save: (*FileStaticContentReader).save, Load: (*FileStaticContentReader).load}) - state.Register("pkg/sentry/fs/fsutil.HostFileMapper", (*HostFileMapper)(nil), state.Fns{Save: (*HostFileMapper).save, Load: (*HostFileMapper).load}) - state.Register("pkg/sentry/fs/fsutil.HostMappable", (*HostMappable)(nil), state.Fns{Save: (*HostMappable).save, Load: (*HostMappable).load}) - state.Register("pkg/sentry/fs/fsutil.SimpleFileInode", (*SimpleFileInode)(nil), state.Fns{Save: (*SimpleFileInode).save, Load: (*SimpleFileInode).load}) - state.Register("pkg/sentry/fs/fsutil.NoReadWriteFileInode", (*NoReadWriteFileInode)(nil), state.Fns{Save: (*NoReadWriteFileInode).save, Load: (*NoReadWriteFileInode).load}) - state.Register("pkg/sentry/fs/fsutil.InodeSimpleAttributes", (*InodeSimpleAttributes)(nil), state.Fns{Save: (*InodeSimpleAttributes).save, Load: (*InodeSimpleAttributes).load}) - state.Register("pkg/sentry/fs/fsutil.InodeSimpleExtendedAttributes", (*InodeSimpleExtendedAttributes)(nil), state.Fns{Save: (*InodeSimpleExtendedAttributes).save, Load: (*InodeSimpleExtendedAttributes).load}) - state.Register("pkg/sentry/fs/fsutil.staticFile", (*staticFile)(nil), state.Fns{Save: (*staticFile).save, Load: (*staticFile).load}) - state.Register("pkg/sentry/fs/fsutil.InodeStaticFileGetter", (*InodeStaticFileGetter)(nil), state.Fns{Save: (*InodeStaticFileGetter).save, Load: (*InodeStaticFileGetter).load}) - state.Register("pkg/sentry/fs/fsutil.CachingInodeOperations", (*CachingInodeOperations)(nil), state.Fns{Save: (*CachingInodeOperations).save, Load: (*CachingInodeOperations).load}) - state.Register("pkg/sentry/fs/fsutil.CachingInodeOperationsOptions", (*CachingInodeOperationsOptions)(nil), state.Fns{Save: (*CachingInodeOperationsOptions).save, Load: (*CachingInodeOperationsOptions).load}) + state.Register((*DirtyInfo)(nil)) + state.Register((*StaticDirFileOperations)(nil)) + state.Register((*NoReadWriteFile)(nil)) + state.Register((*FileStaticContentReader)(nil)) + state.Register((*HostFileMapper)(nil)) + state.Register((*HostMappable)(nil)) + state.Register((*SimpleFileInode)(nil)) + state.Register((*NoReadWriteFileInode)(nil)) + state.Register((*InodeSimpleAttributes)(nil)) + state.Register((*InodeSimpleExtendedAttributes)(nil)) + state.Register((*staticFile)(nil)) + state.Register((*InodeStaticFileGetter)(nil)) + state.Register((*CachingInodeOperations)(nil)) + state.Register((*CachingInodeOperationsOptions)(nil)) } diff --git a/pkg/sentry/fs/gofer/gofer_state_autogen.go b/pkg/sentry/fs/gofer/gofer_state_autogen.go index 7db9211b4..1f7360ec8 100644 --- a/pkg/sentry/fs/gofer/gofer_state_autogen.go +++ b/pkg/sentry/fs/gofer/gofer_state_autogen.go @@ -6,140 +6,250 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *fifo) StateTypeName() string { + return "pkg/sentry/fs/gofer.fifo" +} + +func (x *fifo) StateFields() []string { + return []string{ + "InodeOperations", + "fileIops", + } +} + func (x *fifo) beforeSave() {} -func (x *fifo) save(m state.Map) { + +func (x *fifo) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeOperations", &x.InodeOperations) - m.Save("fileIops", &x.fileIops) + m.Save(0, &x.InodeOperations) + m.Save(1, &x.fileIops) } func (x *fifo) afterLoad() {} -func (x *fifo) load(m state.Map) { - m.Load("InodeOperations", &x.InodeOperations) - m.Load("fileIops", &x.fileIops) + +func (x *fifo) StateLoad(m state.Source) { + m.Load(0, &x.InodeOperations) + m.Load(1, &x.fileIops) +} + +func (x *fileOperations) StateTypeName() string { + return "pkg/sentry/fs/gofer.fileOperations" +} + +func (x *fileOperations) StateFields() []string { + return []string{ + "inodeOperations", + "dirCursor", + "flags", + } } func (x *fileOperations) beforeSave() {} -func (x *fileOperations) save(m state.Map) { + +func (x *fileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("inodeOperations", &x.inodeOperations) - m.Save("dirCursor", &x.dirCursor) - m.Save("flags", &x.flags) + m.Save(0, &x.inodeOperations) + m.Save(1, &x.dirCursor) + m.Save(2, &x.flags) } -func (x *fileOperations) load(m state.Map) { - m.LoadWait("inodeOperations", &x.inodeOperations) - m.Load("dirCursor", &x.dirCursor) - m.LoadWait("flags", &x.flags) +func (x *fileOperations) StateLoad(m state.Source) { + m.LoadWait(0, &x.inodeOperations) + m.Load(1, &x.dirCursor) + m.LoadWait(2, &x.flags) m.AfterLoad(x.afterLoad) } +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/gofer.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} +} + func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *inodeOperations) StateTypeName() string { + return "pkg/sentry/fs/gofer.inodeOperations" +} + +func (x *inodeOperations) StateFields() []string { + return []string{ + "fileState", + "cachingInodeOps", + } } func (x *inodeOperations) beforeSave() {} -func (x *inodeOperations) save(m state.Map) { + +func (x *inodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("fileState", &x.fileState) - m.Save("cachingInodeOps", &x.cachingInodeOps) + m.Save(0, &x.fileState) + m.Save(1, &x.cachingInodeOps) } func (x *inodeOperations) afterLoad() {} -func (x *inodeOperations) load(m state.Map) { - m.LoadWait("fileState", &x.fileState) - m.Load("cachingInodeOps", &x.cachingInodeOps) + +func (x *inodeOperations) StateLoad(m state.Source) { + m.LoadWait(0, &x.fileState) + m.Load(1, &x.cachingInodeOps) +} + +func (x *inodeFileState) StateTypeName() string { + return "pkg/sentry/fs/gofer.inodeFileState" } -func (x *inodeFileState) save(m state.Map) { +func (x *inodeFileState) StateFields() []string { + return []string{ + "s", + "sattr", + "loading", + "savedUAttr", + "hostMappable", + } +} + +func (x *inodeFileState) StateSave(m state.Sink) { x.beforeSave() var loading struct{} = x.saveLoading() - m.SaveValue("loading", loading) - m.Save("s", &x.s) - m.Save("sattr", &x.sattr) - m.Save("savedUAttr", &x.savedUAttr) - m.Save("hostMappable", &x.hostMappable) -} - -func (x *inodeFileState) load(m state.Map) { - m.LoadWait("s", &x.s) - m.LoadWait("sattr", &x.sattr) - m.Load("savedUAttr", &x.savedUAttr) - m.Load("hostMappable", &x.hostMappable) - m.LoadValue("loading", new(struct{}), func(y interface{}) { x.loadLoading(y.(struct{})) }) + m.SaveValue(2, loading) + m.Save(0, &x.s) + m.Save(1, &x.sattr) + m.Save(3, &x.savedUAttr) + m.Save(4, &x.hostMappable) +} + +func (x *inodeFileState) StateLoad(m state.Source) { + m.LoadWait(0, &x.s) + m.LoadWait(1, &x.sattr) + m.Load(3, &x.savedUAttr) + m.Load(4, &x.hostMappable) + m.LoadValue(2, new(struct{}), func(y interface{}) { x.loadLoading(y.(struct{})) }) m.AfterLoad(x.afterLoad) } +func (x *overrideInfo) StateTypeName() string { + return "pkg/sentry/fs/gofer.overrideInfo" +} + +func (x *overrideInfo) StateFields() []string { + return []string{ + "dirent", + "endpoint", + "inode", + } +} + func (x *overrideInfo) beforeSave() {} -func (x *overrideInfo) save(m state.Map) { + +func (x *overrideInfo) StateSave(m state.Sink) { x.beforeSave() - m.Save("dirent", &x.dirent) - m.Save("endpoint", &x.endpoint) - m.Save("inode", &x.inode) + m.Save(0, &x.dirent) + m.Save(1, &x.endpoint) + m.Save(2, &x.inode) } func (x *overrideInfo) afterLoad() {} -func (x *overrideInfo) load(m state.Map) { - m.Load("dirent", &x.dirent) - m.Load("endpoint", &x.endpoint) - m.Load("inode", &x.inode) + +func (x *overrideInfo) StateLoad(m state.Source) { + m.Load(0, &x.dirent) + m.Load(1, &x.endpoint) + m.Load(2, &x.inode) +} + +func (x *overrideMaps) StateTypeName() string { + return "pkg/sentry/fs/gofer.overrideMaps" +} + +func (x *overrideMaps) StateFields() []string { + return []string{ + "pathMap", + } } func (x *overrideMaps) beforeSave() {} -func (x *overrideMaps) save(m state.Map) { + +func (x *overrideMaps) StateSave(m state.Sink) { x.beforeSave() - m.Save("pathMap", &x.pathMap) + m.Save(0, &x.pathMap) } func (x *overrideMaps) afterLoad() {} -func (x *overrideMaps) load(m state.Map) { - m.Load("pathMap", &x.pathMap) + +func (x *overrideMaps) StateLoad(m state.Source) { + m.Load(0, &x.pathMap) +} + +func (x *session) StateTypeName() string { + return "pkg/sentry/fs/gofer.session" +} + +func (x *session) StateFields() []string { + return []string{ + "AtomicRefCount", + "msize", + "version", + "cachePolicy", + "aname", + "superBlockFlags", + "limitHostFDTranslation", + "overlayfsStaleRead", + "connID", + "inodeMappings", + "mounter", + "overrides", + } } -func (x *session) save(m state.Map) { +func (x *session) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("msize", &x.msize) - m.Save("version", &x.version) - m.Save("cachePolicy", &x.cachePolicy) - m.Save("aname", &x.aname) - m.Save("superBlockFlags", &x.superBlockFlags) - m.Save("limitHostFDTranslation", &x.limitHostFDTranslation) - m.Save("overlayfsStaleRead", &x.overlayfsStaleRead) - m.Save("connID", &x.connID) - m.Save("inodeMappings", &x.inodeMappings) - m.Save("mounter", &x.mounter) - m.Save("overrides", &x.overrides) -} - -func (x *session) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.LoadWait("msize", &x.msize) - m.LoadWait("version", &x.version) - m.LoadWait("cachePolicy", &x.cachePolicy) - m.LoadWait("aname", &x.aname) - m.LoadWait("superBlockFlags", &x.superBlockFlags) - m.Load("limitHostFDTranslation", &x.limitHostFDTranslation) - m.Load("overlayfsStaleRead", &x.overlayfsStaleRead) - m.LoadWait("connID", &x.connID) - m.LoadWait("inodeMappings", &x.inodeMappings) - m.LoadWait("mounter", &x.mounter) - m.LoadWait("overrides", &x.overrides) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.msize) + m.Save(2, &x.version) + m.Save(3, &x.cachePolicy) + m.Save(4, &x.aname) + m.Save(5, &x.superBlockFlags) + m.Save(6, &x.limitHostFDTranslation) + m.Save(7, &x.overlayfsStaleRead) + m.Save(8, &x.connID) + m.Save(9, &x.inodeMappings) + m.Save(10, &x.mounter) + m.Save(11, &x.overrides) +} + +func (x *session) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.LoadWait(1, &x.msize) + m.LoadWait(2, &x.version) + m.LoadWait(3, &x.cachePolicy) + m.LoadWait(4, &x.aname) + m.LoadWait(5, &x.superBlockFlags) + m.Load(6, &x.limitHostFDTranslation) + m.Load(7, &x.overlayfsStaleRead) + m.LoadWait(8, &x.connID) + m.LoadWait(9, &x.inodeMappings) + m.LoadWait(10, &x.mounter) + m.LoadWait(11, &x.overrides) m.AfterLoad(x.afterLoad) } func init() { - state.Register("pkg/sentry/fs/gofer.fifo", (*fifo)(nil), state.Fns{Save: (*fifo).save, Load: (*fifo).load}) - state.Register("pkg/sentry/fs/gofer.fileOperations", (*fileOperations)(nil), state.Fns{Save: (*fileOperations).save, Load: (*fileOperations).load}) - state.Register("pkg/sentry/fs/gofer.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/gofer.inodeOperations", (*inodeOperations)(nil), state.Fns{Save: (*inodeOperations).save, Load: (*inodeOperations).load}) - state.Register("pkg/sentry/fs/gofer.inodeFileState", (*inodeFileState)(nil), state.Fns{Save: (*inodeFileState).save, Load: (*inodeFileState).load}) - state.Register("pkg/sentry/fs/gofer.overrideInfo", (*overrideInfo)(nil), state.Fns{Save: (*overrideInfo).save, Load: (*overrideInfo).load}) - state.Register("pkg/sentry/fs/gofer.overrideMaps", (*overrideMaps)(nil), state.Fns{Save: (*overrideMaps).save, Load: (*overrideMaps).load}) - state.Register("pkg/sentry/fs/gofer.session", (*session)(nil), state.Fns{Save: (*session).save, Load: (*session).load}) + state.Register((*fifo)(nil)) + state.Register((*fileOperations)(nil)) + state.Register((*filesystem)(nil)) + state.Register((*inodeOperations)(nil)) + state.Register((*inodeFileState)(nil)) + state.Register((*overrideInfo)(nil)) + state.Register((*overrideMaps)(nil)) + state.Register((*session)(nil)) } diff --git a/pkg/sentry/fs/host/host_state_autogen.go b/pkg/sentry/fs/host/host_state_autogen.go index a6b97a154..6a1a75ca4 100644 --- a/pkg/sentry/fs/host/host_state_autogen.go +++ b/pkg/sentry/fs/host/host_state_autogen.go @@ -6,112 +6,201 @@ import ( "gvisor.dev/gvisor/pkg/state" ) -func (x *descriptor) save(m state.Map) { +func (x *descriptor) StateTypeName() string { + return "pkg/sentry/fs/host.descriptor" +} + +func (x *descriptor) StateFields() []string { + return []string{ + "origFD", + "wouldBlock", + } +} + +func (x *descriptor) StateSave(m state.Sink) { x.beforeSave() - m.Save("origFD", &x.origFD) - m.Save("wouldBlock", &x.wouldBlock) + m.Save(0, &x.origFD) + m.Save(1, &x.wouldBlock) } -func (x *descriptor) load(m state.Map) { - m.Load("origFD", &x.origFD) - m.Load("wouldBlock", &x.wouldBlock) +func (x *descriptor) StateLoad(m state.Source) { + m.Load(0, &x.origFD) + m.Load(1, &x.wouldBlock) m.AfterLoad(x.afterLoad) } +func (x *fileOperations) StateTypeName() string { + return "pkg/sentry/fs/host.fileOperations" +} + +func (x *fileOperations) StateFields() []string { + return []string{ + "iops", + "dirCursor", + } +} + func (x *fileOperations) beforeSave() {} -func (x *fileOperations) save(m state.Map) { + +func (x *fileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("iops", &x.iops) - m.Save("dirCursor", &x.dirCursor) + m.Save(0, &x.iops) + m.Save(1, &x.dirCursor) } func (x *fileOperations) afterLoad() {} -func (x *fileOperations) load(m state.Map) { - m.LoadWait("iops", &x.iops) - m.Load("dirCursor", &x.dirCursor) + +func (x *fileOperations) StateLoad(m state.Source) { + m.LoadWait(0, &x.iops) + m.Load(1, &x.dirCursor) +} + +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/host.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} } func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *inodeOperations) StateTypeName() string { + return "pkg/sentry/fs/host.inodeOperations" +} + +func (x *inodeOperations) StateFields() []string { + return []string{ + "fileState", + "cachingInodeOps", + } } func (x *inodeOperations) beforeSave() {} -func (x *inodeOperations) save(m state.Map) { + +func (x *inodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("fileState", &x.fileState) - m.Save("cachingInodeOps", &x.cachingInodeOps) + m.Save(0, &x.fileState) + m.Save(1, &x.cachingInodeOps) } func (x *inodeOperations) afterLoad() {} -func (x *inodeOperations) load(m state.Map) { - m.LoadWait("fileState", &x.fileState) - m.Load("cachingInodeOps", &x.cachingInodeOps) + +func (x *inodeOperations) StateLoad(m state.Source) { + m.LoadWait(0, &x.fileState) + m.Load(1, &x.cachingInodeOps) +} + +func (x *inodeFileState) StateTypeName() string { + return "pkg/sentry/fs/host.inodeFileState" +} + +func (x *inodeFileState) StateFields() []string { + return []string{ + "descriptor", + "sattr", + "savedUAttr", + } } func (x *inodeFileState) beforeSave() {} -func (x *inodeFileState) save(m state.Map) { + +func (x *inodeFileState) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.queue) { - m.Failf("queue is %#v, expected zero", &x.queue) + state.Failf("queue is %#v, expected zero", &x.queue) } - m.Save("descriptor", &x.descriptor) - m.Save("sattr", &x.sattr) - m.Save("savedUAttr", &x.savedUAttr) + m.Save(0, &x.descriptor) + m.Save(1, &x.sattr) + m.Save(2, &x.savedUAttr) } -func (x *inodeFileState) load(m state.Map) { - m.LoadWait("descriptor", &x.descriptor) - m.LoadWait("sattr", &x.sattr) - m.Load("savedUAttr", &x.savedUAttr) +func (x *inodeFileState) StateLoad(m state.Source) { + m.LoadWait(0, &x.descriptor) + m.LoadWait(1, &x.sattr) + m.Load(2, &x.savedUAttr) m.AfterLoad(x.afterLoad) } -func (x *ConnectedEndpoint) save(m state.Map) { +func (x *ConnectedEndpoint) StateTypeName() string { + return "pkg/sentry/fs/host.ConnectedEndpoint" +} + +func (x *ConnectedEndpoint) StateFields() []string { + return []string{ + "ref", + "queue", + "path", + "srfd", + "stype", + } +} + +func (x *ConnectedEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("ref", &x.ref) - m.Save("queue", &x.queue) - m.Save("path", &x.path) - m.Save("srfd", &x.srfd) - m.Save("stype", &x.stype) -} - -func (x *ConnectedEndpoint) load(m state.Map) { - m.Load("ref", &x.ref) - m.Load("queue", &x.queue) - m.Load("path", &x.path) - m.LoadWait("srfd", &x.srfd) - m.Load("stype", &x.stype) + m.Save(0, &x.ref) + m.Save(1, &x.queue) + m.Save(2, &x.path) + m.Save(3, &x.srfd) + m.Save(4, &x.stype) +} + +func (x *ConnectedEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.ref) + m.Load(1, &x.queue) + m.Load(2, &x.path) + m.LoadWait(3, &x.srfd) + m.Load(4, &x.stype) m.AfterLoad(x.afterLoad) } +func (x *TTYFileOperations) StateTypeName() string { + return "pkg/sentry/fs/host.TTYFileOperations" +} + +func (x *TTYFileOperations) StateFields() []string { + return []string{ + "fileOperations", + "session", + "fgProcessGroup", + "termios", + } +} + func (x *TTYFileOperations) beforeSave() {} -func (x *TTYFileOperations) save(m state.Map) { + +func (x *TTYFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("fileOperations", &x.fileOperations) - m.Save("session", &x.session) - m.Save("fgProcessGroup", &x.fgProcessGroup) - m.Save("termios", &x.termios) + m.Save(0, &x.fileOperations) + m.Save(1, &x.session) + m.Save(2, &x.fgProcessGroup) + m.Save(3, &x.termios) } func (x *TTYFileOperations) afterLoad() {} -func (x *TTYFileOperations) load(m state.Map) { - m.Load("fileOperations", &x.fileOperations) - m.Load("session", &x.session) - m.Load("fgProcessGroup", &x.fgProcessGroup) - m.Load("termios", &x.termios) + +func (x *TTYFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.fileOperations) + m.Load(1, &x.session) + m.Load(2, &x.fgProcessGroup) + m.Load(3, &x.termios) } func init() { - state.Register("pkg/sentry/fs/host.descriptor", (*descriptor)(nil), state.Fns{Save: (*descriptor).save, Load: (*descriptor).load}) - state.Register("pkg/sentry/fs/host.fileOperations", (*fileOperations)(nil), state.Fns{Save: (*fileOperations).save, Load: (*fileOperations).load}) - state.Register("pkg/sentry/fs/host.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/host.inodeOperations", (*inodeOperations)(nil), state.Fns{Save: (*inodeOperations).save, Load: (*inodeOperations).load}) - state.Register("pkg/sentry/fs/host.inodeFileState", (*inodeFileState)(nil), state.Fns{Save: (*inodeFileState).save, Load: (*inodeFileState).load}) - state.Register("pkg/sentry/fs/host.ConnectedEndpoint", (*ConnectedEndpoint)(nil), state.Fns{Save: (*ConnectedEndpoint).save, Load: (*ConnectedEndpoint).load}) - state.Register("pkg/sentry/fs/host.TTYFileOperations", (*TTYFileOperations)(nil), state.Fns{Save: (*TTYFileOperations).save, Load: (*TTYFileOperations).load}) + state.Register((*descriptor)(nil)) + state.Register((*fileOperations)(nil)) + state.Register((*filesystem)(nil)) + state.Register((*inodeOperations)(nil)) + state.Register((*inodeFileState)(nil)) + state.Register((*ConnectedEndpoint)(nil)) + state.Register((*TTYFileOperations)(nil)) } diff --git a/pkg/sentry/fs/lock/lock_state_autogen.go b/pkg/sentry/fs/lock/lock_state_autogen.go index 59c493fcb..8e2768c73 100644 --- a/pkg/sentry/fs/lock/lock_state_autogen.go +++ b/pkg/sentry/fs/lock/lock_state_autogen.go @@ -6,103 +6,186 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Lock) StateTypeName() string { + return "pkg/sentry/fs/lock.Lock" +} + +func (x *Lock) StateFields() []string { + return []string{ + "Readers", + "Writer", + } +} + func (x *Lock) beforeSave() {} -func (x *Lock) save(m state.Map) { + +func (x *Lock) StateSave(m state.Sink) { x.beforeSave() - m.Save("Readers", &x.Readers) - m.Save("Writer", &x.Writer) + m.Save(0, &x.Readers) + m.Save(1, &x.Writer) } func (x *Lock) afterLoad() {} -func (x *Lock) load(m state.Map) { - m.Load("Readers", &x.Readers) - m.Load("Writer", &x.Writer) + +func (x *Lock) StateLoad(m state.Source) { + m.Load(0, &x.Readers) + m.Load(1, &x.Writer) +} + +func (x *Locks) StateTypeName() string { + return "pkg/sentry/fs/lock.Locks" +} + +func (x *Locks) StateFields() []string { + return []string{ + "locks", + } } func (x *Locks) beforeSave() {} -func (x *Locks) save(m state.Map) { + +func (x *Locks) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.blockedQueue) { - m.Failf("blockedQueue is %#v, expected zero", &x.blockedQueue) + state.Failf("blockedQueue is %#v, expected zero", &x.blockedQueue) } - m.Save("locks", &x.locks) + m.Save(0, &x.locks) } func (x *Locks) afterLoad() {} -func (x *Locks) load(m state.Map) { - m.Load("locks", &x.locks) + +func (x *Locks) StateLoad(m state.Source) { + m.Load(0, &x.locks) +} + +func (x *LockRange) StateTypeName() string { + return "pkg/sentry/fs/lock.LockRange" +} + +func (x *LockRange) StateFields() []string { + return []string{ + "Start", + "End", + } } func (x *LockRange) beforeSave() {} -func (x *LockRange) save(m state.Map) { + +func (x *LockRange) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) + m.Save(0, &x.Start) + m.Save(1, &x.End) } func (x *LockRange) afterLoad() {} -func (x *LockRange) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) + +func (x *LockRange) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) +} + +func (x *LockSet) StateTypeName() string { + return "pkg/sentry/fs/lock.LockSet" +} + +func (x *LockSet) StateFields() []string { + return []string{ + "root", + } } func (x *LockSet) beforeSave() {} -func (x *LockSet) save(m state.Map) { + +func (x *LockSet) StateSave(m state.Sink) { x.beforeSave() var root *LockSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *LockSet) afterLoad() {} -func (x *LockSet) load(m state.Map) { - m.LoadValue("root", new(*LockSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*LockSegmentDataSlices)) }) + +func (x *LockSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*LockSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*LockSegmentDataSlices)) }) +} + +func (x *Locknode) StateTypeName() string { + return "pkg/sentry/fs/lock.Locknode" +} + +func (x *Locknode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *Locknode) beforeSave() {} -func (x *Locknode) save(m state.Map) { + +func (x *Locknode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + 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 (x *Locknode) afterLoad() {} -func (x *Locknode) load(m state.Map) { - m.Load("nrSegments", &x.nrSegments) - m.Load("parent", &x.parent) - m.Load("parentIndex", &x.parentIndex) - m.Load("hasChildren", &x.hasChildren) - m.Load("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *Locknode) 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 (x *LockSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/fs/lock.LockSegmentDataSlices" +} + +func (x *LockSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *LockSegmentDataSlices) beforeSave() {} -func (x *LockSegmentDataSlices) save(m state.Map) { + +func (x *LockSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *LockSegmentDataSlices) afterLoad() {} -func (x *LockSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *LockSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) } func init() { - state.Register("pkg/sentry/fs/lock.Lock", (*Lock)(nil), state.Fns{Save: (*Lock).save, Load: (*Lock).load}) - state.Register("pkg/sentry/fs/lock.Locks", (*Locks)(nil), state.Fns{Save: (*Locks).save, Load: (*Locks).load}) - state.Register("pkg/sentry/fs/lock.LockRange", (*LockRange)(nil), state.Fns{Save: (*LockRange).save, Load: (*LockRange).load}) - state.Register("pkg/sentry/fs/lock.LockSet", (*LockSet)(nil), state.Fns{Save: (*LockSet).save, Load: (*LockSet).load}) - state.Register("pkg/sentry/fs/lock.Locknode", (*Locknode)(nil), state.Fns{Save: (*Locknode).save, Load: (*Locknode).load}) - state.Register("pkg/sentry/fs/lock.LockSegmentDataSlices", (*LockSegmentDataSlices)(nil), state.Fns{Save: (*LockSegmentDataSlices).save, Load: (*LockSegmentDataSlices).load}) + state.Register((*Lock)(nil)) + state.Register((*Locks)(nil)) + state.Register((*LockRange)(nil)) + state.Register((*LockSet)(nil)) + state.Register((*Locknode)(nil)) + state.Register((*LockSegmentDataSlices)(nil)) } diff --git a/pkg/sentry/fs/proc/proc_state_autogen.go b/pkg/sentry/fs/proc/proc_state_autogen.go index baf7cd42b..87c979909 100644 --- a/pkg/sentry/fs/proc/proc_state_autogen.go +++ b/pkg/sentry/fs/proc/proc_state_autogen.go @@ -6,736 +6,1430 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *execArgInode) StateTypeName() string { + return "pkg/sentry/fs/proc.execArgInode" +} + +func (x *execArgInode) StateFields() []string { + return []string{ + "SimpleFileInode", + "arg", + "t", + } +} + func (x *execArgInode) beforeSave() {} -func (x *execArgInode) save(m state.Map) { + +func (x *execArgInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("arg", &x.arg) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.arg) + m.Save(2, &x.t) } func (x *execArgInode) afterLoad() {} -func (x *execArgInode) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("arg", &x.arg) - m.Load("t", &x.t) + +func (x *execArgInode) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.arg) + m.Load(2, &x.t) +} + +func (x *execArgFile) StateTypeName() string { + return "pkg/sentry/fs/proc.execArgFile" +} + +func (x *execArgFile) StateFields() []string { + return []string{ + "arg", + "t", + } } func (x *execArgFile) beforeSave() {} -func (x *execArgFile) save(m state.Map) { + +func (x *execArgFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("arg", &x.arg) - m.Save("t", &x.t) + m.Save(0, &x.arg) + m.Save(1, &x.t) } func (x *execArgFile) afterLoad() {} -func (x *execArgFile) load(m state.Map) { - m.Load("arg", &x.arg) - m.Load("t", &x.t) + +func (x *execArgFile) StateLoad(m state.Source) { + m.Load(0, &x.arg) + m.Load(1, &x.t) +} + +func (x *fdDir) StateTypeName() string { + return "pkg/sentry/fs/proc.fdDir" +} + +func (x *fdDir) StateFields() []string { + return []string{ + "Dir", + "t", + } } func (x *fdDir) beforeSave() {} -func (x *fdDir) save(m state.Map) { + +func (x *fdDir) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("t", &x.t) + m.Save(0, &x.Dir) + m.Save(1, &x.t) } func (x *fdDir) afterLoad() {} -func (x *fdDir) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("t", &x.t) + +func (x *fdDir) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.t) +} + +func (x *fdDirFile) StateTypeName() string { + return "pkg/sentry/fs/proc.fdDirFile" +} + +func (x *fdDirFile) StateFields() []string { + return []string{ + "isInfoFile", + "t", + } } func (x *fdDirFile) beforeSave() {} -func (x *fdDirFile) save(m state.Map) { + +func (x *fdDirFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("isInfoFile", &x.isInfoFile) - m.Save("t", &x.t) + m.Save(0, &x.isInfoFile) + m.Save(1, &x.t) } func (x *fdDirFile) afterLoad() {} -func (x *fdDirFile) load(m state.Map) { - m.Load("isInfoFile", &x.isInfoFile) - m.Load("t", &x.t) + +func (x *fdDirFile) StateLoad(m state.Source) { + m.Load(0, &x.isInfoFile) + m.Load(1, &x.t) +} + +func (x *fdInfoDir) StateTypeName() string { + return "pkg/sentry/fs/proc.fdInfoDir" +} + +func (x *fdInfoDir) StateFields() []string { + return []string{ + "Dir", + "t", + } } func (x *fdInfoDir) beforeSave() {} -func (x *fdInfoDir) save(m state.Map) { + +func (x *fdInfoDir) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("t", &x.t) + m.Save(0, &x.Dir) + m.Save(1, &x.t) } func (x *fdInfoDir) afterLoad() {} -func (x *fdInfoDir) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("t", &x.t) + +func (x *fdInfoDir) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.t) +} + +func (x *filesystemsData) StateTypeName() string { + return "pkg/sentry/fs/proc.filesystemsData" +} + +func (x *filesystemsData) StateFields() []string { + return []string{} } func (x *filesystemsData) beforeSave() {} -func (x *filesystemsData) save(m state.Map) { + +func (x *filesystemsData) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystemsData) afterLoad() {} -func (x *filesystemsData) load(m state.Map) { + +func (x *filesystemsData) StateLoad(m state.Source) { +} + +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/proc.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} } func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *taskOwnedInodeOps) StateTypeName() string { + return "pkg/sentry/fs/proc.taskOwnedInodeOps" +} + +func (x *taskOwnedInodeOps) StateFields() []string { + return []string{ + "InodeOperations", + "t", + } } func (x *taskOwnedInodeOps) beforeSave() {} -func (x *taskOwnedInodeOps) save(m state.Map) { + +func (x *taskOwnedInodeOps) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeOperations", &x.InodeOperations) - m.Save("t", &x.t) + m.Save(0, &x.InodeOperations) + m.Save(1, &x.t) } func (x *taskOwnedInodeOps) afterLoad() {} -func (x *taskOwnedInodeOps) load(m state.Map) { - m.Load("InodeOperations", &x.InodeOperations) - m.Load("t", &x.t) + +func (x *taskOwnedInodeOps) StateLoad(m state.Source) { + m.Load(0, &x.InodeOperations) + m.Load(1, &x.t) +} + +func (x *staticFileInodeOps) StateTypeName() string { + return "pkg/sentry/fs/proc.staticFileInodeOps" +} + +func (x *staticFileInodeOps) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeStaticFileGetter", + } } func (x *staticFileInodeOps) beforeSave() {} -func (x *staticFileInodeOps) save(m state.Map) { + +func (x *staticFileInodeOps) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeStaticFileGetter", &x.InodeStaticFileGetter) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeStaticFileGetter) } func (x *staticFileInodeOps) afterLoad() {} -func (x *staticFileInodeOps) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeStaticFileGetter", &x.InodeStaticFileGetter) + +func (x *staticFileInodeOps) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeStaticFileGetter) +} + +func (x *loadavgData) StateTypeName() string { + return "pkg/sentry/fs/proc.loadavgData" +} + +func (x *loadavgData) StateFields() []string { + return []string{} } func (x *loadavgData) beforeSave() {} -func (x *loadavgData) save(m state.Map) { + +func (x *loadavgData) StateSave(m state.Sink) { x.beforeSave() } func (x *loadavgData) afterLoad() {} -func (x *loadavgData) load(m state.Map) { + +func (x *loadavgData) StateLoad(m state.Source) { +} + +func (x *meminfoData) StateTypeName() string { + return "pkg/sentry/fs/proc.meminfoData" +} + +func (x *meminfoData) StateFields() []string { + return []string{ + "k", + } } func (x *meminfoData) beforeSave() {} -func (x *meminfoData) save(m state.Map) { + +func (x *meminfoData) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *meminfoData) afterLoad() {} -func (x *meminfoData) load(m state.Map) { - m.Load("k", &x.k) + +func (x *meminfoData) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *mountInfoFile) StateTypeName() string { + return "pkg/sentry/fs/proc.mountInfoFile" +} + +func (x *mountInfoFile) StateFields() []string { + return []string{ + "t", + } } func (x *mountInfoFile) beforeSave() {} -func (x *mountInfoFile) save(m state.Map) { + +func (x *mountInfoFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *mountInfoFile) afterLoad() {} -func (x *mountInfoFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *mountInfoFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *mountsFile) StateTypeName() string { + return "pkg/sentry/fs/proc.mountsFile" +} + +func (x *mountsFile) StateFields() []string { + return []string{ + "t", + } } func (x *mountsFile) beforeSave() {} -func (x *mountsFile) save(m state.Map) { + +func (x *mountsFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *mountsFile) afterLoad() {} -func (x *mountsFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *mountsFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *ifinet6) StateTypeName() string { + return "pkg/sentry/fs/proc.ifinet6" +} + +func (x *ifinet6) StateFields() []string { + return []string{ + "s", + } } func (x *ifinet6) beforeSave() {} -func (x *ifinet6) save(m state.Map) { + +func (x *ifinet6) StateSave(m state.Sink) { x.beforeSave() - m.Save("s", &x.s) + m.Save(0, &x.s) } func (x *ifinet6) afterLoad() {} -func (x *ifinet6) load(m state.Map) { - m.Load("s", &x.s) + +func (x *ifinet6) StateLoad(m state.Source) { + m.Load(0, &x.s) +} + +func (x *netDev) StateTypeName() string { + return "pkg/sentry/fs/proc.netDev" +} + +func (x *netDev) StateFields() []string { + return []string{ + "s", + } } func (x *netDev) beforeSave() {} -func (x *netDev) save(m state.Map) { + +func (x *netDev) StateSave(m state.Sink) { x.beforeSave() - m.Save("s", &x.s) + m.Save(0, &x.s) } func (x *netDev) afterLoad() {} -func (x *netDev) load(m state.Map) { - m.Load("s", &x.s) + +func (x *netDev) StateLoad(m state.Source) { + m.Load(0, &x.s) +} + +func (x *netSnmp) StateTypeName() string { + return "pkg/sentry/fs/proc.netSnmp" +} + +func (x *netSnmp) StateFields() []string { + return []string{ + "s", + } } func (x *netSnmp) beforeSave() {} -func (x *netSnmp) save(m state.Map) { + +func (x *netSnmp) StateSave(m state.Sink) { x.beforeSave() - m.Save("s", &x.s) + m.Save(0, &x.s) } func (x *netSnmp) afterLoad() {} -func (x *netSnmp) load(m state.Map) { - m.Load("s", &x.s) + +func (x *netSnmp) StateLoad(m state.Source) { + m.Load(0, &x.s) +} + +func (x *netRoute) StateTypeName() string { + return "pkg/sentry/fs/proc.netRoute" +} + +func (x *netRoute) StateFields() []string { + return []string{ + "s", + } } func (x *netRoute) beforeSave() {} -func (x *netRoute) save(m state.Map) { + +func (x *netRoute) StateSave(m state.Sink) { x.beforeSave() - m.Save("s", &x.s) + m.Save(0, &x.s) } func (x *netRoute) afterLoad() {} -func (x *netRoute) load(m state.Map) { - m.Load("s", &x.s) + +func (x *netRoute) StateLoad(m state.Source) { + m.Load(0, &x.s) +} + +func (x *netUnix) StateTypeName() string { + return "pkg/sentry/fs/proc.netUnix" +} + +func (x *netUnix) StateFields() []string { + return []string{ + "k", + } } func (x *netUnix) beforeSave() {} -func (x *netUnix) save(m state.Map) { + +func (x *netUnix) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *netUnix) afterLoad() {} -func (x *netUnix) load(m state.Map) { - m.Load("k", &x.k) + +func (x *netUnix) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *netTCP) StateTypeName() string { + return "pkg/sentry/fs/proc.netTCP" +} + +func (x *netTCP) StateFields() []string { + return []string{ + "k", + } } func (x *netTCP) beforeSave() {} -func (x *netTCP) save(m state.Map) { + +func (x *netTCP) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *netTCP) afterLoad() {} -func (x *netTCP) load(m state.Map) { - m.Load("k", &x.k) + +func (x *netTCP) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *netTCP6) StateTypeName() string { + return "pkg/sentry/fs/proc.netTCP6" +} + +func (x *netTCP6) StateFields() []string { + return []string{ + "k", + } } func (x *netTCP6) beforeSave() {} -func (x *netTCP6) save(m state.Map) { + +func (x *netTCP6) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *netTCP6) afterLoad() {} -func (x *netTCP6) load(m state.Map) { - m.Load("k", &x.k) + +func (x *netTCP6) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *netUDP) StateTypeName() string { + return "pkg/sentry/fs/proc.netUDP" +} + +func (x *netUDP) StateFields() []string { + return []string{ + "k", + } } func (x *netUDP) beforeSave() {} -func (x *netUDP) save(m state.Map) { + +func (x *netUDP) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *netUDP) afterLoad() {} -func (x *netUDP) load(m state.Map) { - m.Load("k", &x.k) + +func (x *netUDP) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *proc) StateTypeName() string { + return "pkg/sentry/fs/proc.proc" +} + +func (x *proc) StateFields() []string { + return []string{ + "Dir", + "k", + "pidns", + "cgroupControllers", + } } func (x *proc) beforeSave() {} -func (x *proc) save(m state.Map) { + +func (x *proc) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("k", &x.k) - m.Save("pidns", &x.pidns) - m.Save("cgroupControllers", &x.cgroupControllers) + m.Save(0, &x.Dir) + m.Save(1, &x.k) + m.Save(2, &x.pidns) + m.Save(3, &x.cgroupControllers) } func (x *proc) afterLoad() {} -func (x *proc) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("k", &x.k) - m.Load("pidns", &x.pidns) - m.Load("cgroupControllers", &x.cgroupControllers) + +func (x *proc) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.k) + m.Load(2, &x.pidns) + m.Load(3, &x.cgroupControllers) +} + +func (x *self) StateTypeName() string { + return "pkg/sentry/fs/proc.self" +} + +func (x *self) StateFields() []string { + return []string{ + "Symlink", + "pidns", + } } func (x *self) beforeSave() {} -func (x *self) save(m state.Map) { + +func (x *self) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) - m.Save("pidns", &x.pidns) + m.Save(0, &x.Symlink) + m.Save(1, &x.pidns) } func (x *self) afterLoad() {} -func (x *self) load(m state.Map) { - m.Load("Symlink", &x.Symlink) - m.Load("pidns", &x.pidns) + +func (x *self) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) + m.Load(1, &x.pidns) +} + +func (x *threadSelf) StateTypeName() string { + return "pkg/sentry/fs/proc.threadSelf" +} + +func (x *threadSelf) StateFields() []string { + return []string{ + "Symlink", + "pidns", + } } func (x *threadSelf) beforeSave() {} -func (x *threadSelf) save(m state.Map) { + +func (x *threadSelf) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) - m.Save("pidns", &x.pidns) + m.Save(0, &x.Symlink) + m.Save(1, &x.pidns) } func (x *threadSelf) afterLoad() {} -func (x *threadSelf) load(m state.Map) { - m.Load("Symlink", &x.Symlink) - m.Load("pidns", &x.pidns) + +func (x *threadSelf) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) + m.Load(1, &x.pidns) +} + +func (x *rootProcFile) StateTypeName() string { + return "pkg/sentry/fs/proc.rootProcFile" +} + +func (x *rootProcFile) StateFields() []string { + return []string{ + "iops", + } } func (x *rootProcFile) beforeSave() {} -func (x *rootProcFile) save(m state.Map) { + +func (x *rootProcFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("iops", &x.iops) + m.Save(0, &x.iops) } func (x *rootProcFile) afterLoad() {} -func (x *rootProcFile) load(m state.Map) { - m.Load("iops", &x.iops) + +func (x *rootProcFile) StateLoad(m state.Source) { + m.Load(0, &x.iops) +} + +func (x *statData) StateTypeName() string { + return "pkg/sentry/fs/proc.statData" +} + +func (x *statData) StateFields() []string { + return []string{ + "k", + } } func (x *statData) beforeSave() {} -func (x *statData) save(m state.Map) { + +func (x *statData) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *statData) afterLoad() {} -func (x *statData) load(m state.Map) { - m.Load("k", &x.k) + +func (x *statData) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *mmapMinAddrData) StateTypeName() string { + return "pkg/sentry/fs/proc.mmapMinAddrData" +} + +func (x *mmapMinAddrData) StateFields() []string { + return []string{ + "k", + } } func (x *mmapMinAddrData) beforeSave() {} -func (x *mmapMinAddrData) save(m state.Map) { + +func (x *mmapMinAddrData) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *mmapMinAddrData) afterLoad() {} -func (x *mmapMinAddrData) load(m state.Map) { - m.Load("k", &x.k) + +func (x *mmapMinAddrData) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *overcommitMemory) StateTypeName() string { + return "pkg/sentry/fs/proc.overcommitMemory" +} + +func (x *overcommitMemory) StateFields() []string { + return []string{} } func (x *overcommitMemory) beforeSave() {} -func (x *overcommitMemory) save(m state.Map) { + +func (x *overcommitMemory) StateSave(m state.Sink) { x.beforeSave() } func (x *overcommitMemory) afterLoad() {} -func (x *overcommitMemory) load(m state.Map) { + +func (x *overcommitMemory) StateLoad(m state.Source) { +} + +func (x *hostname) StateTypeName() string { + return "pkg/sentry/fs/proc.hostname" +} + +func (x *hostname) StateFields() []string { + return []string{ + "SimpleFileInode", + } } func (x *hostname) beforeSave() {} -func (x *hostname) save(m state.Map) { + +func (x *hostname) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) + m.Save(0, &x.SimpleFileInode) } func (x *hostname) afterLoad() {} -func (x *hostname) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) + +func (x *hostname) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) +} + +func (x *hostnameFile) StateTypeName() string { + return "pkg/sentry/fs/proc.hostnameFile" +} + +func (x *hostnameFile) StateFields() []string { + return []string{} } func (x *hostnameFile) beforeSave() {} -func (x *hostnameFile) save(m state.Map) { + +func (x *hostnameFile) StateSave(m state.Sink) { x.beforeSave() } func (x *hostnameFile) afterLoad() {} -func (x *hostnameFile) load(m state.Map) { + +func (x *hostnameFile) StateLoad(m state.Source) { +} + +func (x *tcpMemInode) StateTypeName() string { + return "pkg/sentry/fs/proc.tcpMemInode" +} + +func (x *tcpMemInode) StateFields() []string { + return []string{ + "SimpleFileInode", + "dir", + "s", + "size", + } } -func (x *tcpMemInode) save(m state.Map) { +func (x *tcpMemInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("dir", &x.dir) - m.Save("s", &x.s) - m.Save("size", &x.size) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.dir) + m.Save(2, &x.s) + m.Save(3, &x.size) } -func (x *tcpMemInode) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("dir", &x.dir) - m.LoadWait("s", &x.s) - m.Load("size", &x.size) +func (x *tcpMemInode) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.dir) + m.LoadWait(2, &x.s) + m.Load(3, &x.size) m.AfterLoad(x.afterLoad) } +func (x *tcpMemFile) StateTypeName() string { + return "pkg/sentry/fs/proc.tcpMemFile" +} + +func (x *tcpMemFile) StateFields() []string { + return []string{ + "tcpMemInode", + } +} + func (x *tcpMemFile) beforeSave() {} -func (x *tcpMemFile) save(m state.Map) { + +func (x *tcpMemFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("tcpMemInode", &x.tcpMemInode) + m.Save(0, &x.tcpMemInode) } func (x *tcpMemFile) afterLoad() {} -func (x *tcpMemFile) load(m state.Map) { - m.Load("tcpMemInode", &x.tcpMemInode) + +func (x *tcpMemFile) StateLoad(m state.Source) { + m.Load(0, &x.tcpMemInode) +} + +func (x *tcpSack) StateTypeName() string { + return "pkg/sentry/fs/proc.tcpSack" +} + +func (x *tcpSack) StateFields() []string { + return []string{ + "SimpleFileInode", + "stack", + "enabled", + } } func (x *tcpSack) beforeSave() {} -func (x *tcpSack) save(m state.Map) { + +func (x *tcpSack) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("stack", &x.stack) - m.Save("enabled", &x.enabled) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.stack) + m.Save(2, &x.enabled) } -func (x *tcpSack) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.LoadWait("stack", &x.stack) - m.Load("enabled", &x.enabled) +func (x *tcpSack) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.LoadWait(1, &x.stack) + m.Load(2, &x.enabled) m.AfterLoad(x.afterLoad) } +func (x *tcpSackFile) StateTypeName() string { + return "pkg/sentry/fs/proc.tcpSackFile" +} + +func (x *tcpSackFile) StateFields() []string { + return []string{ + "tcpSack", + "stack", + } +} + func (x *tcpSackFile) beforeSave() {} -func (x *tcpSackFile) save(m state.Map) { + +func (x *tcpSackFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("tcpSack", &x.tcpSack) - m.Save("stack", &x.stack) + m.Save(0, &x.tcpSack) + m.Save(1, &x.stack) } func (x *tcpSackFile) afterLoad() {} -func (x *tcpSackFile) load(m state.Map) { - m.Load("tcpSack", &x.tcpSack) - m.LoadWait("stack", &x.stack) + +func (x *tcpSackFile) StateLoad(m state.Source) { + m.Load(0, &x.tcpSack) + m.LoadWait(1, &x.stack) +} + +func (x *taskDir) StateTypeName() string { + return "pkg/sentry/fs/proc.taskDir" +} + +func (x *taskDir) StateFields() []string { + return []string{ + "Dir", + "t", + } } func (x *taskDir) beforeSave() {} -func (x *taskDir) save(m state.Map) { + +func (x *taskDir) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("t", &x.t) + m.Save(0, &x.Dir) + m.Save(1, &x.t) } func (x *taskDir) afterLoad() {} -func (x *taskDir) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("t", &x.t) + +func (x *taskDir) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.t) +} + +func (x *subtasks) StateTypeName() string { + return "pkg/sentry/fs/proc.subtasks" +} + +func (x *subtasks) StateFields() []string { + return []string{ + "Dir", + "t", + "p", + } } func (x *subtasks) beforeSave() {} -func (x *subtasks) save(m state.Map) { + +func (x *subtasks) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("t", &x.t) - m.Save("p", &x.p) + m.Save(0, &x.Dir) + m.Save(1, &x.t) + m.Save(2, &x.p) } func (x *subtasks) afterLoad() {} -func (x *subtasks) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("t", &x.t) - m.Load("p", &x.p) + +func (x *subtasks) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.t) + m.Load(2, &x.p) +} + +func (x *subtasksFile) StateTypeName() string { + return "pkg/sentry/fs/proc.subtasksFile" +} + +func (x *subtasksFile) StateFields() []string { + return []string{ + "t", + "pidns", + } } func (x *subtasksFile) beforeSave() {} -func (x *subtasksFile) save(m state.Map) { + +func (x *subtasksFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) - m.Save("pidns", &x.pidns) + m.Save(0, &x.t) + m.Save(1, &x.pidns) } func (x *subtasksFile) afterLoad() {} -func (x *subtasksFile) load(m state.Map) { - m.Load("t", &x.t) - m.Load("pidns", &x.pidns) + +func (x *subtasksFile) StateLoad(m state.Source) { + m.Load(0, &x.t) + m.Load(1, &x.pidns) +} + +func (x *exe) StateTypeName() string { + return "pkg/sentry/fs/proc.exe" +} + +func (x *exe) StateFields() []string { + return []string{ + "Symlink", + "t", + } } func (x *exe) beforeSave() {} -func (x *exe) save(m state.Map) { + +func (x *exe) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) - m.Save("t", &x.t) + m.Save(0, &x.Symlink) + m.Save(1, &x.t) } func (x *exe) afterLoad() {} -func (x *exe) load(m state.Map) { - m.Load("Symlink", &x.Symlink) - m.Load("t", &x.t) + +func (x *exe) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) + m.Load(1, &x.t) +} + +func (x *namespaceSymlink) StateTypeName() string { + return "pkg/sentry/fs/proc.namespaceSymlink" +} + +func (x *namespaceSymlink) StateFields() []string { + return []string{ + "Symlink", + "t", + } } func (x *namespaceSymlink) beforeSave() {} -func (x *namespaceSymlink) save(m state.Map) { + +func (x *namespaceSymlink) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) - m.Save("t", &x.t) + m.Save(0, &x.Symlink) + m.Save(1, &x.t) } func (x *namespaceSymlink) afterLoad() {} -func (x *namespaceSymlink) load(m state.Map) { - m.Load("Symlink", &x.Symlink) - m.Load("t", &x.t) + +func (x *namespaceSymlink) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) + m.Load(1, &x.t) +} + +func (x *mapsData) StateTypeName() string { + return "pkg/sentry/fs/proc.mapsData" +} + +func (x *mapsData) StateFields() []string { + return []string{ + "t", + } } func (x *mapsData) beforeSave() {} -func (x *mapsData) save(m state.Map) { + +func (x *mapsData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *mapsData) afterLoad() {} -func (x *mapsData) load(m state.Map) { - m.Load("t", &x.t) + +func (x *mapsData) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *smapsData) StateTypeName() string { + return "pkg/sentry/fs/proc.smapsData" +} + +func (x *smapsData) StateFields() []string { + return []string{ + "t", + } } func (x *smapsData) beforeSave() {} -func (x *smapsData) save(m state.Map) { + +func (x *smapsData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *smapsData) afterLoad() {} -func (x *smapsData) load(m state.Map) { - m.Load("t", &x.t) + +func (x *smapsData) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *taskStatData) StateTypeName() string { + return "pkg/sentry/fs/proc.taskStatData" +} + +func (x *taskStatData) StateFields() []string { + return []string{ + "t", + "tgstats", + "pidns", + } } func (x *taskStatData) beforeSave() {} -func (x *taskStatData) save(m state.Map) { + +func (x *taskStatData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) - m.Save("tgstats", &x.tgstats) - m.Save("pidns", &x.pidns) + m.Save(0, &x.t) + m.Save(1, &x.tgstats) + m.Save(2, &x.pidns) } func (x *taskStatData) afterLoad() {} -func (x *taskStatData) load(m state.Map) { - m.Load("t", &x.t) - m.Load("tgstats", &x.tgstats) - m.Load("pidns", &x.pidns) + +func (x *taskStatData) StateLoad(m state.Source) { + m.Load(0, &x.t) + m.Load(1, &x.tgstats) + m.Load(2, &x.pidns) +} + +func (x *statmData) StateTypeName() string { + return "pkg/sentry/fs/proc.statmData" +} + +func (x *statmData) StateFields() []string { + return []string{ + "t", + } } func (x *statmData) beforeSave() {} -func (x *statmData) save(m state.Map) { + +func (x *statmData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *statmData) afterLoad() {} -func (x *statmData) load(m state.Map) { - m.Load("t", &x.t) + +func (x *statmData) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *statusData) StateTypeName() string { + return "pkg/sentry/fs/proc.statusData" +} + +func (x *statusData) StateFields() []string { + return []string{ + "t", + "pidns", + } } func (x *statusData) beforeSave() {} -func (x *statusData) save(m state.Map) { + +func (x *statusData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) - m.Save("pidns", &x.pidns) + m.Save(0, &x.t) + m.Save(1, &x.pidns) } func (x *statusData) afterLoad() {} -func (x *statusData) load(m state.Map) { - m.Load("t", &x.t) - m.Load("pidns", &x.pidns) + +func (x *statusData) StateLoad(m state.Source) { + m.Load(0, &x.t) + m.Load(1, &x.pidns) +} + +func (x *ioData) StateTypeName() string { + return "pkg/sentry/fs/proc.ioData" +} + +func (x *ioData) StateFields() []string { + return []string{ + "ioUsage", + } } func (x *ioData) beforeSave() {} -func (x *ioData) save(m state.Map) { + +func (x *ioData) StateSave(m state.Sink) { x.beforeSave() - m.Save("ioUsage", &x.ioUsage) + m.Save(0, &x.ioUsage) } func (x *ioData) afterLoad() {} -func (x *ioData) load(m state.Map) { - m.Load("ioUsage", &x.ioUsage) + +func (x *ioData) StateLoad(m state.Source) { + m.Load(0, &x.ioUsage) +} + +func (x *comm) StateTypeName() string { + return "pkg/sentry/fs/proc.comm" +} + +func (x *comm) StateFields() []string { + return []string{ + "SimpleFileInode", + "t", + } } func (x *comm) beforeSave() {} -func (x *comm) save(m state.Map) { + +func (x *comm) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.t) } func (x *comm) afterLoad() {} -func (x *comm) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("t", &x.t) + +func (x *comm) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.t) +} + +func (x *commFile) StateTypeName() string { + return "pkg/sentry/fs/proc.commFile" +} + +func (x *commFile) StateFields() []string { + return []string{ + "t", + } } func (x *commFile) beforeSave() {} -func (x *commFile) save(m state.Map) { + +func (x *commFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *commFile) afterLoad() {} -func (x *commFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *commFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *auxvec) StateTypeName() string { + return "pkg/sentry/fs/proc.auxvec" +} + +func (x *auxvec) StateFields() []string { + return []string{ + "SimpleFileInode", + "t", + } } func (x *auxvec) beforeSave() {} -func (x *auxvec) save(m state.Map) { + +func (x *auxvec) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.t) } func (x *auxvec) afterLoad() {} -func (x *auxvec) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("t", &x.t) + +func (x *auxvec) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.t) +} + +func (x *auxvecFile) StateTypeName() string { + return "pkg/sentry/fs/proc.auxvecFile" +} + +func (x *auxvecFile) StateFields() []string { + return []string{ + "t", + } } func (x *auxvecFile) beforeSave() {} -func (x *auxvecFile) save(m state.Map) { + +func (x *auxvecFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *auxvecFile) afterLoad() {} -func (x *auxvecFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *auxvecFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *oomScoreAdj) StateTypeName() string { + return "pkg/sentry/fs/proc.oomScoreAdj" +} + +func (x *oomScoreAdj) StateFields() []string { + return []string{ + "SimpleFileInode", + "t", + } } func (x *oomScoreAdj) beforeSave() {} -func (x *oomScoreAdj) save(m state.Map) { + +func (x *oomScoreAdj) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.t) } func (x *oomScoreAdj) afterLoad() {} -func (x *oomScoreAdj) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("t", &x.t) + +func (x *oomScoreAdj) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.t) +} + +func (x *oomScoreAdjFile) StateTypeName() string { + return "pkg/sentry/fs/proc.oomScoreAdjFile" +} + +func (x *oomScoreAdjFile) StateFields() []string { + return []string{ + "t", + } } func (x *oomScoreAdjFile) beforeSave() {} -func (x *oomScoreAdjFile) save(m state.Map) { + +func (x *oomScoreAdjFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *oomScoreAdjFile) afterLoad() {} -func (x *oomScoreAdjFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *oomScoreAdjFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *idMapInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/proc.idMapInodeOperations" +} + +func (x *idMapInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeSimpleExtendedAttributes", + "t", + "gids", + } } func (x *idMapInodeOperations) beforeSave() {} -func (x *idMapInodeOperations) save(m state.Map) { + +func (x *idMapInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("t", &x.t) - m.Save("gids", &x.gids) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeSimpleExtendedAttributes) + m.Save(2, &x.t) + m.Save(3, &x.gids) } func (x *idMapInodeOperations) afterLoad() {} -func (x *idMapInodeOperations) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("t", &x.t) - m.Load("gids", &x.gids) + +func (x *idMapInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeSimpleExtendedAttributes) + m.Load(2, &x.t) + m.Load(3, &x.gids) +} + +func (x *idMapFileOperations) StateTypeName() string { + return "pkg/sentry/fs/proc.idMapFileOperations" +} + +func (x *idMapFileOperations) StateFields() []string { + return []string{ + "iops", + } } func (x *idMapFileOperations) beforeSave() {} -func (x *idMapFileOperations) save(m state.Map) { + +func (x *idMapFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("iops", &x.iops) + m.Save(0, &x.iops) } func (x *idMapFileOperations) afterLoad() {} -func (x *idMapFileOperations) load(m state.Map) { - m.Load("iops", &x.iops) + +func (x *idMapFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.iops) +} + +func (x *uptime) StateTypeName() string { + return "pkg/sentry/fs/proc.uptime" +} + +func (x *uptime) StateFields() []string { + return []string{ + "SimpleFileInode", + "startTime", + } } func (x *uptime) beforeSave() {} -func (x *uptime) save(m state.Map) { + +func (x *uptime) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("startTime", &x.startTime) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.startTime) } func (x *uptime) afterLoad() {} -func (x *uptime) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("startTime", &x.startTime) + +func (x *uptime) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.startTime) +} + +func (x *uptimeFile) StateTypeName() string { + return "pkg/sentry/fs/proc.uptimeFile" +} + +func (x *uptimeFile) StateFields() []string { + return []string{ + "startTime", + } } func (x *uptimeFile) beforeSave() {} -func (x *uptimeFile) save(m state.Map) { + +func (x *uptimeFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("startTime", &x.startTime) + m.Save(0, &x.startTime) } func (x *uptimeFile) afterLoad() {} -func (x *uptimeFile) load(m state.Map) { - m.Load("startTime", &x.startTime) + +func (x *uptimeFile) StateLoad(m state.Source) { + m.Load(0, &x.startTime) +} + +func (x *versionData) StateTypeName() string { + return "pkg/sentry/fs/proc.versionData" +} + +func (x *versionData) StateFields() []string { + return []string{ + "k", + } } func (x *versionData) beforeSave() {} -func (x *versionData) save(m state.Map) { + +func (x *versionData) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *versionData) afterLoad() {} -func (x *versionData) load(m state.Map) { - m.Load("k", &x.k) + +func (x *versionData) StateLoad(m state.Source) { + m.Load(0, &x.k) } func init() { - state.Register("pkg/sentry/fs/proc.execArgInode", (*execArgInode)(nil), state.Fns{Save: (*execArgInode).save, Load: (*execArgInode).load}) - state.Register("pkg/sentry/fs/proc.execArgFile", (*execArgFile)(nil), state.Fns{Save: (*execArgFile).save, Load: (*execArgFile).load}) - state.Register("pkg/sentry/fs/proc.fdDir", (*fdDir)(nil), state.Fns{Save: (*fdDir).save, Load: (*fdDir).load}) - state.Register("pkg/sentry/fs/proc.fdDirFile", (*fdDirFile)(nil), state.Fns{Save: (*fdDirFile).save, Load: (*fdDirFile).load}) - state.Register("pkg/sentry/fs/proc.fdInfoDir", (*fdInfoDir)(nil), state.Fns{Save: (*fdInfoDir).save, Load: (*fdInfoDir).load}) - state.Register("pkg/sentry/fs/proc.filesystemsData", (*filesystemsData)(nil), state.Fns{Save: (*filesystemsData).save, Load: (*filesystemsData).load}) - state.Register("pkg/sentry/fs/proc.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/proc.taskOwnedInodeOps", (*taskOwnedInodeOps)(nil), state.Fns{Save: (*taskOwnedInodeOps).save, Load: (*taskOwnedInodeOps).load}) - state.Register("pkg/sentry/fs/proc.staticFileInodeOps", (*staticFileInodeOps)(nil), state.Fns{Save: (*staticFileInodeOps).save, Load: (*staticFileInodeOps).load}) - state.Register("pkg/sentry/fs/proc.loadavgData", (*loadavgData)(nil), state.Fns{Save: (*loadavgData).save, Load: (*loadavgData).load}) - state.Register("pkg/sentry/fs/proc.meminfoData", (*meminfoData)(nil), state.Fns{Save: (*meminfoData).save, Load: (*meminfoData).load}) - state.Register("pkg/sentry/fs/proc.mountInfoFile", (*mountInfoFile)(nil), state.Fns{Save: (*mountInfoFile).save, Load: (*mountInfoFile).load}) - state.Register("pkg/sentry/fs/proc.mountsFile", (*mountsFile)(nil), state.Fns{Save: (*mountsFile).save, Load: (*mountsFile).load}) - state.Register("pkg/sentry/fs/proc.ifinet6", (*ifinet6)(nil), state.Fns{Save: (*ifinet6).save, Load: (*ifinet6).load}) - state.Register("pkg/sentry/fs/proc.netDev", (*netDev)(nil), state.Fns{Save: (*netDev).save, Load: (*netDev).load}) - state.Register("pkg/sentry/fs/proc.netSnmp", (*netSnmp)(nil), state.Fns{Save: (*netSnmp).save, Load: (*netSnmp).load}) - state.Register("pkg/sentry/fs/proc.netRoute", (*netRoute)(nil), state.Fns{Save: (*netRoute).save, Load: (*netRoute).load}) - state.Register("pkg/sentry/fs/proc.netUnix", (*netUnix)(nil), state.Fns{Save: (*netUnix).save, Load: (*netUnix).load}) - state.Register("pkg/sentry/fs/proc.netTCP", (*netTCP)(nil), state.Fns{Save: (*netTCP).save, Load: (*netTCP).load}) - state.Register("pkg/sentry/fs/proc.netTCP6", (*netTCP6)(nil), state.Fns{Save: (*netTCP6).save, Load: (*netTCP6).load}) - state.Register("pkg/sentry/fs/proc.netUDP", (*netUDP)(nil), state.Fns{Save: (*netUDP).save, Load: (*netUDP).load}) - state.Register("pkg/sentry/fs/proc.proc", (*proc)(nil), state.Fns{Save: (*proc).save, Load: (*proc).load}) - state.Register("pkg/sentry/fs/proc.self", (*self)(nil), state.Fns{Save: (*self).save, Load: (*self).load}) - state.Register("pkg/sentry/fs/proc.threadSelf", (*threadSelf)(nil), state.Fns{Save: (*threadSelf).save, Load: (*threadSelf).load}) - state.Register("pkg/sentry/fs/proc.rootProcFile", (*rootProcFile)(nil), state.Fns{Save: (*rootProcFile).save, Load: (*rootProcFile).load}) - state.Register("pkg/sentry/fs/proc.statData", (*statData)(nil), state.Fns{Save: (*statData).save, Load: (*statData).load}) - state.Register("pkg/sentry/fs/proc.mmapMinAddrData", (*mmapMinAddrData)(nil), state.Fns{Save: (*mmapMinAddrData).save, Load: (*mmapMinAddrData).load}) - state.Register("pkg/sentry/fs/proc.overcommitMemory", (*overcommitMemory)(nil), state.Fns{Save: (*overcommitMemory).save, Load: (*overcommitMemory).load}) - state.Register("pkg/sentry/fs/proc.hostname", (*hostname)(nil), state.Fns{Save: (*hostname).save, Load: (*hostname).load}) - state.Register("pkg/sentry/fs/proc.hostnameFile", (*hostnameFile)(nil), state.Fns{Save: (*hostnameFile).save, Load: (*hostnameFile).load}) - state.Register("pkg/sentry/fs/proc.tcpMemInode", (*tcpMemInode)(nil), state.Fns{Save: (*tcpMemInode).save, Load: (*tcpMemInode).load}) - state.Register("pkg/sentry/fs/proc.tcpMemFile", (*tcpMemFile)(nil), state.Fns{Save: (*tcpMemFile).save, Load: (*tcpMemFile).load}) - state.Register("pkg/sentry/fs/proc.tcpSack", (*tcpSack)(nil), state.Fns{Save: (*tcpSack).save, Load: (*tcpSack).load}) - state.Register("pkg/sentry/fs/proc.tcpSackFile", (*tcpSackFile)(nil), state.Fns{Save: (*tcpSackFile).save, Load: (*tcpSackFile).load}) - state.Register("pkg/sentry/fs/proc.taskDir", (*taskDir)(nil), state.Fns{Save: (*taskDir).save, Load: (*taskDir).load}) - state.Register("pkg/sentry/fs/proc.subtasks", (*subtasks)(nil), state.Fns{Save: (*subtasks).save, Load: (*subtasks).load}) - state.Register("pkg/sentry/fs/proc.subtasksFile", (*subtasksFile)(nil), state.Fns{Save: (*subtasksFile).save, Load: (*subtasksFile).load}) - state.Register("pkg/sentry/fs/proc.exe", (*exe)(nil), state.Fns{Save: (*exe).save, Load: (*exe).load}) - state.Register("pkg/sentry/fs/proc.namespaceSymlink", (*namespaceSymlink)(nil), state.Fns{Save: (*namespaceSymlink).save, Load: (*namespaceSymlink).load}) - state.Register("pkg/sentry/fs/proc.mapsData", (*mapsData)(nil), state.Fns{Save: (*mapsData).save, Load: (*mapsData).load}) - state.Register("pkg/sentry/fs/proc.smapsData", (*smapsData)(nil), state.Fns{Save: (*smapsData).save, Load: (*smapsData).load}) - state.Register("pkg/sentry/fs/proc.taskStatData", (*taskStatData)(nil), state.Fns{Save: (*taskStatData).save, Load: (*taskStatData).load}) - state.Register("pkg/sentry/fs/proc.statmData", (*statmData)(nil), state.Fns{Save: (*statmData).save, Load: (*statmData).load}) - state.Register("pkg/sentry/fs/proc.statusData", (*statusData)(nil), state.Fns{Save: (*statusData).save, Load: (*statusData).load}) - state.Register("pkg/sentry/fs/proc.ioData", (*ioData)(nil), state.Fns{Save: (*ioData).save, Load: (*ioData).load}) - state.Register("pkg/sentry/fs/proc.comm", (*comm)(nil), state.Fns{Save: (*comm).save, Load: (*comm).load}) - state.Register("pkg/sentry/fs/proc.commFile", (*commFile)(nil), state.Fns{Save: (*commFile).save, Load: (*commFile).load}) - state.Register("pkg/sentry/fs/proc.auxvec", (*auxvec)(nil), state.Fns{Save: (*auxvec).save, Load: (*auxvec).load}) - state.Register("pkg/sentry/fs/proc.auxvecFile", (*auxvecFile)(nil), state.Fns{Save: (*auxvecFile).save, Load: (*auxvecFile).load}) - state.Register("pkg/sentry/fs/proc.oomScoreAdj", (*oomScoreAdj)(nil), state.Fns{Save: (*oomScoreAdj).save, Load: (*oomScoreAdj).load}) - state.Register("pkg/sentry/fs/proc.oomScoreAdjFile", (*oomScoreAdjFile)(nil), state.Fns{Save: (*oomScoreAdjFile).save, Load: (*oomScoreAdjFile).load}) - state.Register("pkg/sentry/fs/proc.idMapInodeOperations", (*idMapInodeOperations)(nil), state.Fns{Save: (*idMapInodeOperations).save, Load: (*idMapInodeOperations).load}) - state.Register("pkg/sentry/fs/proc.idMapFileOperations", (*idMapFileOperations)(nil), state.Fns{Save: (*idMapFileOperations).save, Load: (*idMapFileOperations).load}) - state.Register("pkg/sentry/fs/proc.uptime", (*uptime)(nil), state.Fns{Save: (*uptime).save, Load: (*uptime).load}) - state.Register("pkg/sentry/fs/proc.uptimeFile", (*uptimeFile)(nil), state.Fns{Save: (*uptimeFile).save, Load: (*uptimeFile).load}) - state.Register("pkg/sentry/fs/proc.versionData", (*versionData)(nil), state.Fns{Save: (*versionData).save, Load: (*versionData).load}) + state.Register((*execArgInode)(nil)) + state.Register((*execArgFile)(nil)) + state.Register((*fdDir)(nil)) + state.Register((*fdDirFile)(nil)) + state.Register((*fdInfoDir)(nil)) + state.Register((*filesystemsData)(nil)) + state.Register((*filesystem)(nil)) + state.Register((*taskOwnedInodeOps)(nil)) + state.Register((*staticFileInodeOps)(nil)) + state.Register((*loadavgData)(nil)) + state.Register((*meminfoData)(nil)) + state.Register((*mountInfoFile)(nil)) + state.Register((*mountsFile)(nil)) + state.Register((*ifinet6)(nil)) + state.Register((*netDev)(nil)) + state.Register((*netSnmp)(nil)) + state.Register((*netRoute)(nil)) + state.Register((*netUnix)(nil)) + state.Register((*netTCP)(nil)) + state.Register((*netTCP6)(nil)) + state.Register((*netUDP)(nil)) + state.Register((*proc)(nil)) + state.Register((*self)(nil)) + state.Register((*threadSelf)(nil)) + state.Register((*rootProcFile)(nil)) + state.Register((*statData)(nil)) + state.Register((*mmapMinAddrData)(nil)) + state.Register((*overcommitMemory)(nil)) + state.Register((*hostname)(nil)) + state.Register((*hostnameFile)(nil)) + state.Register((*tcpMemInode)(nil)) + state.Register((*tcpMemFile)(nil)) + state.Register((*tcpSack)(nil)) + state.Register((*tcpSackFile)(nil)) + state.Register((*taskDir)(nil)) + state.Register((*subtasks)(nil)) + state.Register((*subtasksFile)(nil)) + state.Register((*exe)(nil)) + state.Register((*namespaceSymlink)(nil)) + state.Register((*mapsData)(nil)) + state.Register((*smapsData)(nil)) + state.Register((*taskStatData)(nil)) + state.Register((*statmData)(nil)) + state.Register((*statusData)(nil)) + state.Register((*ioData)(nil)) + state.Register((*comm)(nil)) + state.Register((*commFile)(nil)) + state.Register((*auxvec)(nil)) + state.Register((*auxvecFile)(nil)) + state.Register((*oomScoreAdj)(nil)) + state.Register((*oomScoreAdjFile)(nil)) + state.Register((*idMapInodeOperations)(nil)) + state.Register((*idMapFileOperations)(nil)) + state.Register((*uptime)(nil)) + state.Register((*uptimeFile)(nil)) + state.Register((*versionData)(nil)) } diff --git a/pkg/sentry/fs/proc/seqfile/seqfile_state_autogen.go b/pkg/sentry/fs/proc/seqfile/seqfile_state_autogen.go index cfd3a40b4..6f48a944a 100644 --- a/pkg/sentry/fs/proc/seqfile/seqfile_state_autogen.go +++ b/pkg/sentry/fs/proc/seqfile/seqfile_state_autogen.go @@ -6,53 +6,95 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SeqData) StateTypeName() string { + return "pkg/sentry/fs/proc/seqfile.SeqData" +} + +func (x *SeqData) StateFields() []string { + return []string{ + "Buf", + "Handle", + } +} + func (x *SeqData) beforeSave() {} -func (x *SeqData) save(m state.Map) { + +func (x *SeqData) StateSave(m state.Sink) { x.beforeSave() - m.Save("Buf", &x.Buf) - m.Save("Handle", &x.Handle) + m.Save(0, &x.Buf) + m.Save(1, &x.Handle) } func (x *SeqData) afterLoad() {} -func (x *SeqData) load(m state.Map) { - m.Load("Buf", &x.Buf) - m.Load("Handle", &x.Handle) + +func (x *SeqData) StateLoad(m state.Source) { + m.Load(0, &x.Buf) + m.Load(1, &x.Handle) +} + +func (x *SeqFile) StateTypeName() string { + return "pkg/sentry/fs/proc/seqfile.SeqFile" +} + +func (x *SeqFile) StateFields() []string { + return []string{ + "InodeSimpleExtendedAttributes", + "InodeSimpleAttributes", + "SeqSource", + "source", + "generation", + "lastRead", + } } func (x *SeqFile) beforeSave() {} -func (x *SeqFile) save(m state.Map) { + +func (x *SeqFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("SeqSource", &x.SeqSource) - m.Save("source", &x.source) - m.Save("generation", &x.generation) - m.Save("lastRead", &x.lastRead) + m.Save(0, &x.InodeSimpleExtendedAttributes) + m.Save(1, &x.InodeSimpleAttributes) + m.Save(2, &x.SeqSource) + m.Save(3, &x.source) + m.Save(4, &x.generation) + m.Save(5, &x.lastRead) } func (x *SeqFile) afterLoad() {} -func (x *SeqFile) load(m state.Map) { - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("SeqSource", &x.SeqSource) - m.Load("source", &x.source) - m.Load("generation", &x.generation) - m.Load("lastRead", &x.lastRead) + +func (x *SeqFile) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleExtendedAttributes) + m.Load(1, &x.InodeSimpleAttributes) + m.Load(2, &x.SeqSource) + m.Load(3, &x.source) + m.Load(4, &x.generation) + m.Load(5, &x.lastRead) +} + +func (x *seqFileOperations) StateTypeName() string { + return "pkg/sentry/fs/proc/seqfile.seqFileOperations" +} + +func (x *seqFileOperations) StateFields() []string { + return []string{ + "seqFile", + } } func (x *seqFileOperations) beforeSave() {} -func (x *seqFileOperations) save(m state.Map) { + +func (x *seqFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("seqFile", &x.seqFile) + m.Save(0, &x.seqFile) } func (x *seqFileOperations) afterLoad() {} -func (x *seqFileOperations) load(m state.Map) { - m.Load("seqFile", &x.seqFile) + +func (x *seqFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.seqFile) } func init() { - state.Register("pkg/sentry/fs/proc/seqfile.SeqData", (*SeqData)(nil), state.Fns{Save: (*SeqData).save, Load: (*SeqData).load}) - state.Register("pkg/sentry/fs/proc/seqfile.SeqFile", (*SeqFile)(nil), state.Fns{Save: (*SeqFile).save, Load: (*SeqFile).load}) - state.Register("pkg/sentry/fs/proc/seqfile.seqFileOperations", (*seqFileOperations)(nil), state.Fns{Save: (*seqFileOperations).save, Load: (*seqFileOperations).load}) + state.Register((*SeqData)(nil)) + state.Register((*SeqFile)(nil)) + state.Register((*seqFileOperations)(nil)) } diff --git a/pkg/sentry/fs/ramfs/ramfs_state_autogen.go b/pkg/sentry/fs/ramfs/ramfs_state_autogen.go index 0a001e0b6..bfa355c84 100644 --- a/pkg/sentry/fs/ramfs/ramfs_state_autogen.go +++ b/pkg/sentry/fs/ramfs/ramfs_state_autogen.go @@ -6,89 +6,165 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Dir) StateTypeName() string { + return "pkg/sentry/fs/ramfs.Dir" +} + +func (x *Dir) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeSimpleExtendedAttributes", + "children", + "dentryMap", + } +} + func (x *Dir) beforeSave() {} -func (x *Dir) save(m state.Map) { + +func (x *Dir) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("children", &x.children) - m.Save("dentryMap", &x.dentryMap) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeSimpleExtendedAttributes) + m.Save(2, &x.children) + m.Save(3, &x.dentryMap) } func (x *Dir) afterLoad() {} -func (x *Dir) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("children", &x.children) - m.Load("dentryMap", &x.dentryMap) + +func (x *Dir) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeSimpleExtendedAttributes) + m.Load(2, &x.children) + m.Load(3, &x.dentryMap) +} + +func (x *dirFileOperations) StateTypeName() string { + return "pkg/sentry/fs/ramfs.dirFileOperations" +} + +func (x *dirFileOperations) StateFields() []string { + return []string{ + "dirCursor", + "dir", + } } func (x *dirFileOperations) beforeSave() {} -func (x *dirFileOperations) save(m state.Map) { + +func (x *dirFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("dirCursor", &x.dirCursor) - m.Save("dir", &x.dir) + m.Save(0, &x.dirCursor) + m.Save(1, &x.dir) } func (x *dirFileOperations) afterLoad() {} -func (x *dirFileOperations) load(m state.Map) { - m.Load("dirCursor", &x.dirCursor) - m.Load("dir", &x.dir) + +func (x *dirFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.dirCursor) + m.Load(1, &x.dir) +} + +func (x *Socket) StateTypeName() string { + return "pkg/sentry/fs/ramfs.Socket" +} + +func (x *Socket) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeSimpleExtendedAttributes", + "ep", + } } func (x *Socket) beforeSave() {} -func (x *Socket) save(m state.Map) { + +func (x *Socket) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("ep", &x.ep) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeSimpleExtendedAttributes) + m.Save(2, &x.ep) } func (x *Socket) afterLoad() {} -func (x *Socket) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("ep", &x.ep) + +func (x *Socket) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeSimpleExtendedAttributes) + m.Load(2, &x.ep) +} + +func (x *socketFileOperations) StateTypeName() string { + return "pkg/sentry/fs/ramfs.socketFileOperations" +} + +func (x *socketFileOperations) StateFields() []string { + return []string{} } func (x *socketFileOperations) beforeSave() {} -func (x *socketFileOperations) save(m state.Map) { + +func (x *socketFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *socketFileOperations) afterLoad() {} -func (x *socketFileOperations) load(m state.Map) { + +func (x *socketFileOperations) StateLoad(m state.Source) { +} + +func (x *Symlink) StateTypeName() string { + return "pkg/sentry/fs/ramfs.Symlink" +} + +func (x *Symlink) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeSimpleExtendedAttributes", + "Target", + } } func (x *Symlink) beforeSave() {} -func (x *Symlink) save(m state.Map) { + +func (x *Symlink) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("Target", &x.Target) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeSimpleExtendedAttributes) + m.Save(2, &x.Target) } func (x *Symlink) afterLoad() {} -func (x *Symlink) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("Target", &x.Target) + +func (x *Symlink) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeSimpleExtendedAttributes) + m.Load(2, &x.Target) +} + +func (x *symlinkFileOperations) StateTypeName() string { + return "pkg/sentry/fs/ramfs.symlinkFileOperations" +} + +func (x *symlinkFileOperations) StateFields() []string { + return []string{} } func (x *symlinkFileOperations) beforeSave() {} -func (x *symlinkFileOperations) save(m state.Map) { + +func (x *symlinkFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *symlinkFileOperations) afterLoad() {} -func (x *symlinkFileOperations) load(m state.Map) { + +func (x *symlinkFileOperations) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/fs/ramfs.Dir", (*Dir)(nil), state.Fns{Save: (*Dir).save, Load: (*Dir).load}) - state.Register("pkg/sentry/fs/ramfs.dirFileOperations", (*dirFileOperations)(nil), state.Fns{Save: (*dirFileOperations).save, Load: (*dirFileOperations).load}) - state.Register("pkg/sentry/fs/ramfs.Socket", (*Socket)(nil), state.Fns{Save: (*Socket).save, Load: (*Socket).load}) - state.Register("pkg/sentry/fs/ramfs.socketFileOperations", (*socketFileOperations)(nil), state.Fns{Save: (*socketFileOperations).save, Load: (*socketFileOperations).load}) - state.Register("pkg/sentry/fs/ramfs.Symlink", (*Symlink)(nil), state.Fns{Save: (*Symlink).save, Load: (*Symlink).load}) - state.Register("pkg/sentry/fs/ramfs.symlinkFileOperations", (*symlinkFileOperations)(nil), state.Fns{Save: (*symlinkFileOperations).save, Load: (*symlinkFileOperations).load}) + state.Register((*Dir)(nil)) + state.Register((*dirFileOperations)(nil)) + state.Register((*Socket)(nil)) + state.Register((*socketFileOperations)(nil)) + state.Register((*Symlink)(nil)) + state.Register((*symlinkFileOperations)(nil)) } diff --git a/pkg/sentry/fs/sys/sys_state_autogen.go b/pkg/sentry/fs/sys/sys_state_autogen.go index 733c504b1..71e08a167 100644 --- a/pkg/sentry/fs/sys/sys_state_autogen.go +++ b/pkg/sentry/fs/sys/sys_state_autogen.go @@ -6,29 +6,52 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *cpunum) StateTypeName() string { + return "pkg/sentry/fs/sys.cpunum" +} + +func (x *cpunum) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeStaticFileGetter", + } +} + func (x *cpunum) beforeSave() {} -func (x *cpunum) save(m state.Map) { + +func (x *cpunum) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeStaticFileGetter", &x.InodeStaticFileGetter) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeStaticFileGetter) } func (x *cpunum) afterLoad() {} -func (x *cpunum) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeStaticFileGetter", &x.InodeStaticFileGetter) + +func (x *cpunum) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeStaticFileGetter) +} + +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/sys.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} } func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/fs/sys.cpunum", (*cpunum)(nil), state.Fns{Save: (*cpunum).save, Load: (*cpunum).load}) - state.Register("pkg/sentry/fs/sys.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) + state.Register((*cpunum)(nil)) + state.Register((*filesystem)(nil)) } diff --git a/pkg/sentry/fs/timerfd/timerfd_state_autogen.go b/pkg/sentry/fs/timerfd/timerfd_state_autogen.go index 955cf1d38..2a411ceab 100644 --- a/pkg/sentry/fs/timerfd/timerfd_state_autogen.go +++ b/pkg/sentry/fs/timerfd/timerfd_state_autogen.go @@ -6,22 +6,35 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *TimerOperations) StateTypeName() string { + return "pkg/sentry/fs/timerfd.TimerOperations" +} + +func (x *TimerOperations) StateFields() []string { + return []string{ + "timer", + "val", + } +} + func (x *TimerOperations) beforeSave() {} -func (x *TimerOperations) save(m state.Map) { + +func (x *TimerOperations) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.events) { - m.Failf("events is %#v, expected zero", &x.events) + state.Failf("events is %#v, expected zero", &x.events) } - m.Save("timer", &x.timer) - m.Save("val", &x.val) + m.Save(0, &x.timer) + m.Save(1, &x.val) } func (x *TimerOperations) afterLoad() {} -func (x *TimerOperations) load(m state.Map) { - m.Load("timer", &x.timer) - m.Load("val", &x.val) + +func (x *TimerOperations) StateLoad(m state.Source) { + m.Load(0, &x.timer) + m.Load(1, &x.val) } func init() { - state.Register("pkg/sentry/fs/timerfd.TimerOperations", (*TimerOperations)(nil), state.Fns{Save: (*TimerOperations).save, Load: (*TimerOperations).load}) + state.Register((*TimerOperations)(nil)) } diff --git a/pkg/sentry/fs/tmpfs/tmpfs_state_autogen.go b/pkg/sentry/fs/tmpfs/tmpfs_state_autogen.go index e4d2584fd..894d3679e 100644 --- a/pkg/sentry/fs/tmpfs/tmpfs_state_autogen.go +++ b/pkg/sentry/fs/tmpfs/tmpfs_state_autogen.go @@ -6,103 +6,192 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *regularFileOperations) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.regularFileOperations" +} + +func (x *regularFileOperations) StateFields() []string { + return []string{ + "iops", + } +} + func (x *regularFileOperations) beforeSave() {} -func (x *regularFileOperations) save(m state.Map) { + +func (x *regularFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("iops", &x.iops) + m.Save(0, &x.iops) } func (x *regularFileOperations) afterLoad() {} -func (x *regularFileOperations) load(m state.Map) { - m.Load("iops", &x.iops) + +func (x *regularFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.iops) +} + +func (x *Filesystem) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Filesystem" +} + +func (x *Filesystem) StateFields() []string { + return []string{} } func (x *Filesystem) beforeSave() {} -func (x *Filesystem) save(m state.Map) { + +func (x *Filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *Filesystem) afterLoad() {} -func (x *Filesystem) load(m state.Map) { + +func (x *Filesystem) StateLoad(m state.Source) { +} + +func (x *fileInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.fileInodeOperations" +} + +func (x *fileInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleExtendedAttributes", + "kernel", + "memUsage", + "attr", + "mappings", + "writableMappingPages", + "data", + "seals", + } } func (x *fileInodeOperations) beforeSave() {} -func (x *fileInodeOperations) save(m state.Map) { + +func (x *fileInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("kernel", &x.kernel) - m.Save("memUsage", &x.memUsage) - m.Save("attr", &x.attr) - m.Save("mappings", &x.mappings) - m.Save("writableMappingPages", &x.writableMappingPages) - m.Save("data", &x.data) - m.Save("seals", &x.seals) + m.Save(0, &x.InodeSimpleExtendedAttributes) + m.Save(1, &x.kernel) + m.Save(2, &x.memUsage) + m.Save(3, &x.attr) + m.Save(4, &x.mappings) + m.Save(5, &x.writableMappingPages) + m.Save(6, &x.data) + m.Save(7, &x.seals) } func (x *fileInodeOperations) afterLoad() {} -func (x *fileInodeOperations) load(m state.Map) { - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("kernel", &x.kernel) - m.Load("memUsage", &x.memUsage) - m.Load("attr", &x.attr) - m.Load("mappings", &x.mappings) - m.Load("writableMappingPages", &x.writableMappingPages) - m.Load("data", &x.data) - m.Load("seals", &x.seals) + +func (x *fileInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleExtendedAttributes) + m.Load(1, &x.kernel) + m.Load(2, &x.memUsage) + m.Load(3, &x.attr) + m.Load(4, &x.mappings) + m.Load(5, &x.writableMappingPages) + m.Load(6, &x.data) + m.Load(7, &x.seals) +} + +func (x *Dir) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Dir" +} + +func (x *Dir) StateFields() []string { + return []string{ + "ramfsDir", + "kernel", + } } func (x *Dir) beforeSave() {} -func (x *Dir) save(m state.Map) { + +func (x *Dir) StateSave(m state.Sink) { x.beforeSave() - m.Save("ramfsDir", &x.ramfsDir) - m.Save("kernel", &x.kernel) + m.Save(0, &x.ramfsDir) + m.Save(1, &x.kernel) } -func (x *Dir) load(m state.Map) { - m.Load("ramfsDir", &x.ramfsDir) - m.Load("kernel", &x.kernel) +func (x *Dir) StateLoad(m state.Source) { + m.Load(0, &x.ramfsDir) + m.Load(1, &x.kernel) m.AfterLoad(x.afterLoad) } +func (x *Symlink) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Symlink" +} + +func (x *Symlink) StateFields() []string { + return []string{ + "Symlink", + } +} + func (x *Symlink) beforeSave() {} -func (x *Symlink) save(m state.Map) { + +func (x *Symlink) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) + m.Save(0, &x.Symlink) } func (x *Symlink) afterLoad() {} -func (x *Symlink) load(m state.Map) { - m.Load("Symlink", &x.Symlink) + +func (x *Symlink) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) +} + +func (x *Socket) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Socket" +} + +func (x *Socket) StateFields() []string { + return []string{ + "Socket", + } } func (x *Socket) beforeSave() {} -func (x *Socket) save(m state.Map) { + +func (x *Socket) StateSave(m state.Sink) { x.beforeSave() - m.Save("Socket", &x.Socket) + m.Save(0, &x.Socket) } func (x *Socket) afterLoad() {} -func (x *Socket) load(m state.Map) { - m.Load("Socket", &x.Socket) + +func (x *Socket) StateLoad(m state.Source) { + m.Load(0, &x.Socket) +} + +func (x *Fifo) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Fifo" +} + +func (x *Fifo) StateFields() []string { + return []string{ + "InodeOperations", + } } func (x *Fifo) beforeSave() {} -func (x *Fifo) save(m state.Map) { + +func (x *Fifo) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeOperations", &x.InodeOperations) + m.Save(0, &x.InodeOperations) } func (x *Fifo) afterLoad() {} -func (x *Fifo) load(m state.Map) { - m.Load("InodeOperations", &x.InodeOperations) + +func (x *Fifo) StateLoad(m state.Source) { + m.Load(0, &x.InodeOperations) } func init() { - state.Register("pkg/sentry/fs/tmpfs.regularFileOperations", (*regularFileOperations)(nil), state.Fns{Save: (*regularFileOperations).save, Load: (*regularFileOperations).load}) - state.Register("pkg/sentry/fs/tmpfs.Filesystem", (*Filesystem)(nil), state.Fns{Save: (*Filesystem).save, Load: (*Filesystem).load}) - state.Register("pkg/sentry/fs/tmpfs.fileInodeOperations", (*fileInodeOperations)(nil), state.Fns{Save: (*fileInodeOperations).save, Load: (*fileInodeOperations).load}) - state.Register("pkg/sentry/fs/tmpfs.Dir", (*Dir)(nil), state.Fns{Save: (*Dir).save, Load: (*Dir).load}) - state.Register("pkg/sentry/fs/tmpfs.Symlink", (*Symlink)(nil), state.Fns{Save: (*Symlink).save, Load: (*Symlink).load}) - state.Register("pkg/sentry/fs/tmpfs.Socket", (*Socket)(nil), state.Fns{Save: (*Socket).save, Load: (*Socket).load}) - state.Register("pkg/sentry/fs/tmpfs.Fifo", (*Fifo)(nil), state.Fns{Save: (*Fifo).save, Load: (*Fifo).load}) + state.Register((*regularFileOperations)(nil)) + state.Register((*Filesystem)(nil)) + state.Register((*fileInodeOperations)(nil)) + state.Register((*Dir)(nil)) + state.Register((*Symlink)(nil)) + state.Register((*Socket)(nil)) + state.Register((*Fifo)(nil)) } diff --git a/pkg/sentry/fs/tty/tty_state_autogen.go b/pkg/sentry/fs/tty/tty_state_autogen.go index 25d601072..e82ca45a3 100644 --- a/pkg/sentry/fs/tty/tty_state_autogen.go +++ b/pkg/sentry/fs/tty/tty_state_autogen.go @@ -6,205 +6,376 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *dirInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.dirInodeOperations" +} + +func (x *dirInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "msrc", + "master", + "slaves", + "dentryMap", + "next", + } +} + func (x *dirInodeOperations) beforeSave() {} -func (x *dirInodeOperations) save(m state.Map) { + +func (x *dirInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("msrc", &x.msrc) - m.Save("master", &x.master) - m.Save("slaves", &x.slaves) - m.Save("dentryMap", &x.dentryMap) - m.Save("next", &x.next) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.msrc) + m.Save(2, &x.master) + m.Save(3, &x.slaves) + m.Save(4, &x.dentryMap) + m.Save(5, &x.next) } func (x *dirInodeOperations) afterLoad() {} -func (x *dirInodeOperations) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("msrc", &x.msrc) - m.Load("master", &x.master) - m.Load("slaves", &x.slaves) - m.Load("dentryMap", &x.dentryMap) - m.Load("next", &x.next) + +func (x *dirInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.msrc) + m.Load(2, &x.master) + m.Load(3, &x.slaves) + m.Load(4, &x.dentryMap) + m.Load(5, &x.next) +} + +func (x *dirFileOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.dirFileOperations" +} + +func (x *dirFileOperations) StateFields() []string { + return []string{ + "di", + "dirCursor", + } } func (x *dirFileOperations) beforeSave() {} -func (x *dirFileOperations) save(m state.Map) { + +func (x *dirFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("di", &x.di) - m.Save("dirCursor", &x.dirCursor) + m.Save(0, &x.di) + m.Save(1, &x.dirCursor) } func (x *dirFileOperations) afterLoad() {} -func (x *dirFileOperations) load(m state.Map) { - m.Load("di", &x.di) - m.Load("dirCursor", &x.dirCursor) + +func (x *dirFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.di) + m.Load(1, &x.dirCursor) +} + +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/tty.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} } func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *superOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.superOperations" +} + +func (x *superOperations) StateFields() []string { + return []string{} } func (x *superOperations) beforeSave() {} -func (x *superOperations) save(m state.Map) { + +func (x *superOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *superOperations) afterLoad() {} -func (x *superOperations) load(m state.Map) { + +func (x *superOperations) StateLoad(m state.Source) { +} + +func (x *lineDiscipline) StateTypeName() string { + return "pkg/sentry/fs/tty.lineDiscipline" +} + +func (x *lineDiscipline) StateFields() []string { + return []string{ + "size", + "inQueue", + "outQueue", + "termios", + "column", + } } func (x *lineDiscipline) beforeSave() {} -func (x *lineDiscipline) save(m state.Map) { + +func (x *lineDiscipline) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.masterWaiter) { - m.Failf("masterWaiter is %#v, expected zero", &x.masterWaiter) + state.Failf("masterWaiter is %#v, expected zero", &x.masterWaiter) } if !state.IsZeroValue(&x.slaveWaiter) { - m.Failf("slaveWaiter is %#v, expected zero", &x.slaveWaiter) + state.Failf("slaveWaiter is %#v, expected zero", &x.slaveWaiter) } - m.Save("size", &x.size) - m.Save("inQueue", &x.inQueue) - m.Save("outQueue", &x.outQueue) - m.Save("termios", &x.termios) - m.Save("column", &x.column) + m.Save(0, &x.size) + m.Save(1, &x.inQueue) + m.Save(2, &x.outQueue) + m.Save(3, &x.termios) + m.Save(4, &x.column) } func (x *lineDiscipline) afterLoad() {} -func (x *lineDiscipline) load(m state.Map) { - m.Load("size", &x.size) - m.Load("inQueue", &x.inQueue) - m.Load("outQueue", &x.outQueue) - m.Load("termios", &x.termios) - m.Load("column", &x.column) + +func (x *lineDiscipline) StateLoad(m state.Source) { + m.Load(0, &x.size) + m.Load(1, &x.inQueue) + m.Load(2, &x.outQueue) + m.Load(3, &x.termios) + m.Load(4, &x.column) +} + +func (x *outputQueueTransformer) StateTypeName() string { + return "pkg/sentry/fs/tty.outputQueueTransformer" +} + +func (x *outputQueueTransformer) StateFields() []string { + return []string{} } func (x *outputQueueTransformer) beforeSave() {} -func (x *outputQueueTransformer) save(m state.Map) { + +func (x *outputQueueTransformer) StateSave(m state.Sink) { x.beforeSave() } func (x *outputQueueTransformer) afterLoad() {} -func (x *outputQueueTransformer) load(m state.Map) { + +func (x *outputQueueTransformer) StateLoad(m state.Source) { +} + +func (x *inputQueueTransformer) StateTypeName() string { + return "pkg/sentry/fs/tty.inputQueueTransformer" +} + +func (x *inputQueueTransformer) StateFields() []string { + return []string{} } func (x *inputQueueTransformer) beforeSave() {} -func (x *inputQueueTransformer) save(m state.Map) { + +func (x *inputQueueTransformer) StateSave(m state.Sink) { x.beforeSave() } func (x *inputQueueTransformer) afterLoad() {} -func (x *inputQueueTransformer) load(m state.Map) { + +func (x *inputQueueTransformer) StateLoad(m state.Source) { +} + +func (x *masterInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.masterInodeOperations" +} + +func (x *masterInodeOperations) StateFields() []string { + return []string{ + "SimpleFileInode", + "d", + } } func (x *masterInodeOperations) beforeSave() {} -func (x *masterInodeOperations) save(m state.Map) { + +func (x *masterInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("d", &x.d) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.d) } func (x *masterInodeOperations) afterLoad() {} -func (x *masterInodeOperations) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("d", &x.d) + +func (x *masterInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.d) +} + +func (x *masterFileOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.masterFileOperations" +} + +func (x *masterFileOperations) StateFields() []string { + return []string{ + "d", + "t", + } } func (x *masterFileOperations) beforeSave() {} -func (x *masterFileOperations) save(m state.Map) { + +func (x *masterFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("d", &x.d) - m.Save("t", &x.t) + m.Save(0, &x.d) + m.Save(1, &x.t) } func (x *masterFileOperations) afterLoad() {} -func (x *masterFileOperations) load(m state.Map) { - m.Load("d", &x.d) - m.Load("t", &x.t) + +func (x *masterFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.d) + m.Load(1, &x.t) +} + +func (x *queue) StateTypeName() string { + return "pkg/sentry/fs/tty.queue" +} + +func (x *queue) StateFields() []string { + return []string{ + "readBuf", + "waitBuf", + "waitBufLen", + "readable", + "transformer", + } } func (x *queue) beforeSave() {} -func (x *queue) save(m state.Map) { + +func (x *queue) StateSave(m state.Sink) { x.beforeSave() - m.Save("readBuf", &x.readBuf) - m.Save("waitBuf", &x.waitBuf) - m.Save("waitBufLen", &x.waitBufLen) - m.Save("readable", &x.readable) - m.Save("transformer", &x.transformer) + m.Save(0, &x.readBuf) + m.Save(1, &x.waitBuf) + m.Save(2, &x.waitBufLen) + m.Save(3, &x.readable) + m.Save(4, &x.transformer) } func (x *queue) afterLoad() {} -func (x *queue) load(m state.Map) { - m.Load("readBuf", &x.readBuf) - m.Load("waitBuf", &x.waitBuf) - m.Load("waitBufLen", &x.waitBufLen) - m.Load("readable", &x.readable) - m.Load("transformer", &x.transformer) + +func (x *queue) StateLoad(m state.Source) { + m.Load(0, &x.readBuf) + m.Load(1, &x.waitBuf) + m.Load(2, &x.waitBufLen) + m.Load(3, &x.readable) + m.Load(4, &x.transformer) +} + +func (x *slaveInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.slaveInodeOperations" +} + +func (x *slaveInodeOperations) StateFields() []string { + return []string{ + "SimpleFileInode", + "d", + "t", + } } func (x *slaveInodeOperations) beforeSave() {} -func (x *slaveInodeOperations) save(m state.Map) { + +func (x *slaveInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("d", &x.d) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.d) + m.Save(2, &x.t) } func (x *slaveInodeOperations) afterLoad() {} -func (x *slaveInodeOperations) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("d", &x.d) - m.Load("t", &x.t) + +func (x *slaveInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.d) + m.Load(2, &x.t) +} + +func (x *slaveFileOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.slaveFileOperations" +} + +func (x *slaveFileOperations) StateFields() []string { + return []string{ + "si", + } } func (x *slaveFileOperations) beforeSave() {} -func (x *slaveFileOperations) save(m state.Map) { + +func (x *slaveFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("si", &x.si) + m.Save(0, &x.si) } func (x *slaveFileOperations) afterLoad() {} -func (x *slaveFileOperations) load(m state.Map) { - m.Load("si", &x.si) + +func (x *slaveFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.si) +} + +func (x *Terminal) StateTypeName() string { + return "pkg/sentry/fs/tty.Terminal" +} + +func (x *Terminal) StateFields() []string { + return []string{ + "AtomicRefCount", + "n", + "d", + "ld", + "masterKTTY", + "slaveKTTY", + } } func (x *Terminal) beforeSave() {} -func (x *Terminal) save(m state.Map) { + +func (x *Terminal) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("n", &x.n) - m.Save("d", &x.d) - m.Save("ld", &x.ld) - m.Save("masterKTTY", &x.masterKTTY) - m.Save("slaveKTTY", &x.slaveKTTY) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.n) + m.Save(2, &x.d) + m.Save(3, &x.ld) + m.Save(4, &x.masterKTTY) + m.Save(5, &x.slaveKTTY) } func (x *Terminal) afterLoad() {} -func (x *Terminal) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("n", &x.n) - m.Load("d", &x.d) - m.Load("ld", &x.ld) - m.Load("masterKTTY", &x.masterKTTY) - m.Load("slaveKTTY", &x.slaveKTTY) + +func (x *Terminal) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.n) + m.Load(2, &x.d) + m.Load(3, &x.ld) + m.Load(4, &x.masterKTTY) + m.Load(5, &x.slaveKTTY) } func init() { - state.Register("pkg/sentry/fs/tty.dirInodeOperations", (*dirInodeOperations)(nil), state.Fns{Save: (*dirInodeOperations).save, Load: (*dirInodeOperations).load}) - state.Register("pkg/sentry/fs/tty.dirFileOperations", (*dirFileOperations)(nil), state.Fns{Save: (*dirFileOperations).save, Load: (*dirFileOperations).load}) - state.Register("pkg/sentry/fs/tty.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/tty.superOperations", (*superOperations)(nil), state.Fns{Save: (*superOperations).save, Load: (*superOperations).load}) - state.Register("pkg/sentry/fs/tty.lineDiscipline", (*lineDiscipline)(nil), state.Fns{Save: (*lineDiscipline).save, Load: (*lineDiscipline).load}) - state.Register("pkg/sentry/fs/tty.outputQueueTransformer", (*outputQueueTransformer)(nil), state.Fns{Save: (*outputQueueTransformer).save, Load: (*outputQueueTransformer).load}) - state.Register("pkg/sentry/fs/tty.inputQueueTransformer", (*inputQueueTransformer)(nil), state.Fns{Save: (*inputQueueTransformer).save, Load: (*inputQueueTransformer).load}) - state.Register("pkg/sentry/fs/tty.masterInodeOperations", (*masterInodeOperations)(nil), state.Fns{Save: (*masterInodeOperations).save, Load: (*masterInodeOperations).load}) - state.Register("pkg/sentry/fs/tty.masterFileOperations", (*masterFileOperations)(nil), state.Fns{Save: (*masterFileOperations).save, Load: (*masterFileOperations).load}) - state.Register("pkg/sentry/fs/tty.queue", (*queue)(nil), state.Fns{Save: (*queue).save, Load: (*queue).load}) - state.Register("pkg/sentry/fs/tty.slaveInodeOperations", (*slaveInodeOperations)(nil), state.Fns{Save: (*slaveInodeOperations).save, Load: (*slaveInodeOperations).load}) - state.Register("pkg/sentry/fs/tty.slaveFileOperations", (*slaveFileOperations)(nil), state.Fns{Save: (*slaveFileOperations).save, Load: (*slaveFileOperations).load}) - state.Register("pkg/sentry/fs/tty.Terminal", (*Terminal)(nil), state.Fns{Save: (*Terminal).save, Load: (*Terminal).load}) + state.Register((*dirInodeOperations)(nil)) + state.Register((*dirFileOperations)(nil)) + state.Register((*filesystem)(nil)) + state.Register((*superOperations)(nil)) + state.Register((*lineDiscipline)(nil)) + state.Register((*outputQueueTransformer)(nil)) + state.Register((*inputQueueTransformer)(nil)) + state.Register((*masterInodeOperations)(nil)) + state.Register((*masterFileOperations)(nil)) + state.Register((*queue)(nil)) + state.Register((*slaveInodeOperations)(nil)) + state.Register((*slaveFileOperations)(nil)) + state.Register((*Terminal)(nil)) } |