diff options
Diffstat (limited to 'pkg/sentry/devices/memdev')
-rw-r--r-- | pkg/sentry/devices/memdev/BUILD | 29 | ||||
-rw-r--r-- | pkg/sentry/devices/memdev/memdev_state_autogen.go | 225 |
2 files changed, 225 insertions, 29 deletions
diff --git a/pkg/sentry/devices/memdev/BUILD b/pkg/sentry/devices/memdev/BUILD deleted file mode 100644 index 4c8604d58..000000000 --- a/pkg/sentry/devices/memdev/BUILD +++ /dev/null @@ -1,29 +0,0 @@ -load("//tools:defs.bzl", "go_library") - -licenses(["notice"]) - -go_library( - name = "memdev", - srcs = [ - "full.go", - "memdev.go", - "null.go", - "random.go", - "zero.go", - ], - visibility = ["//pkg/sentry:internal"], - deps = [ - "//pkg/abi/linux", - "//pkg/context", - "//pkg/rand", - "//pkg/safemem", - "//pkg/sentry/fsimpl/devtmpfs", - "//pkg/sentry/fsimpl/tmpfs", - "//pkg/sentry/kernel", - "//pkg/sentry/kernel/auth", - "//pkg/sentry/memmap", - "//pkg/sentry/vfs", - "//pkg/syserror", - "//pkg/usermem", - ], -) diff --git a/pkg/sentry/devices/memdev/memdev_state_autogen.go b/pkg/sentry/devices/memdev/memdev_state_autogen.go new file mode 100644 index 000000000..127ea03ee --- /dev/null +++ b/pkg/sentry/devices/memdev/memdev_state_autogen.go @@ -0,0 +1,225 @@ +// automatically generated by stateify. + +package memdev + +import ( + "gvisor.dev/gvisor/pkg/state" +) + +func (x *fullDevice) StateTypeName() string { + return "pkg/sentry/devices/memdev.fullDevice" +} + +func (x *fullDevice) StateFields() []string { + return []string{} +} + +func (x *fullDevice) beforeSave() {} + +func (x *fullDevice) StateSave(m state.Sink) { + x.beforeSave() +} + +func (x *fullDevice) afterLoad() {} + +func (x *fullDevice) StateLoad(m state.Source) { +} + +func (x *fullFD) StateTypeName() string { + return "pkg/sentry/devices/memdev.fullFD" +} + +func (x *fullFD) StateFields() []string { + return []string{ + "vfsfd", + "FileDescriptionDefaultImpl", + "DentryMetadataFileDescriptionImpl", + "NoLockFD", + } +} + +func (x *fullFD) beforeSave() {} + +func (x *fullFD) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.vfsfd) + m.Save(1, &x.FileDescriptionDefaultImpl) + m.Save(2, &x.DentryMetadataFileDescriptionImpl) + m.Save(3, &x.NoLockFD) +} + +func (x *fullFD) afterLoad() {} + +func (x *fullFD) StateLoad(m state.Source) { + m.Load(0, &x.vfsfd) + m.Load(1, &x.FileDescriptionDefaultImpl) + m.Load(2, &x.DentryMetadataFileDescriptionImpl) + m.Load(3, &x.NoLockFD) +} + +func (x *nullDevice) StateTypeName() string { + return "pkg/sentry/devices/memdev.nullDevice" +} + +func (x *nullDevice) StateFields() []string { + return []string{} +} + +func (x *nullDevice) beforeSave() {} + +func (x *nullDevice) StateSave(m state.Sink) { + x.beforeSave() +} + +func (x *nullDevice) afterLoad() {} + +func (x *nullDevice) StateLoad(m state.Source) { +} + +func (x *nullFD) StateTypeName() string { + return "pkg/sentry/devices/memdev.nullFD" +} + +func (x *nullFD) StateFields() []string { + return []string{ + "vfsfd", + "FileDescriptionDefaultImpl", + "DentryMetadataFileDescriptionImpl", + "NoLockFD", + } +} + +func (x *nullFD) beforeSave() {} + +func (x *nullFD) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.vfsfd) + m.Save(1, &x.FileDescriptionDefaultImpl) + m.Save(2, &x.DentryMetadataFileDescriptionImpl) + m.Save(3, &x.NoLockFD) +} + +func (x *nullFD) afterLoad() {} + +func (x *nullFD) StateLoad(m state.Source) { + m.Load(0, &x.vfsfd) + m.Load(1, &x.FileDescriptionDefaultImpl) + m.Load(2, &x.DentryMetadataFileDescriptionImpl) + m.Load(3, &x.NoLockFD) +} + +func (x *randomDevice) StateTypeName() string { + return "pkg/sentry/devices/memdev.randomDevice" +} + +func (x *randomDevice) StateFields() []string { + return []string{} +} + +func (x *randomDevice) beforeSave() {} + +func (x *randomDevice) StateSave(m state.Sink) { + x.beforeSave() +} + +func (x *randomDevice) afterLoad() {} + +func (x *randomDevice) StateLoad(m state.Source) { +} + +func (x *randomFD) StateTypeName() string { + return "pkg/sentry/devices/memdev.randomFD" +} + +func (x *randomFD) StateFields() []string { + return []string{ + "vfsfd", + "FileDescriptionDefaultImpl", + "DentryMetadataFileDescriptionImpl", + "NoLockFD", + "off", + } +} + +func (x *randomFD) beforeSave() {} + +func (x *randomFD) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.vfsfd) + m.Save(1, &x.FileDescriptionDefaultImpl) + m.Save(2, &x.DentryMetadataFileDescriptionImpl) + m.Save(3, &x.NoLockFD) + m.Save(4, &x.off) +} + +func (x *randomFD) afterLoad() {} + +func (x *randomFD) StateLoad(m state.Source) { + m.Load(0, &x.vfsfd) + m.Load(1, &x.FileDescriptionDefaultImpl) + m.Load(2, &x.DentryMetadataFileDescriptionImpl) + m.Load(3, &x.NoLockFD) + m.Load(4, &x.off) +} + +func (x *zeroDevice) StateTypeName() string { + return "pkg/sentry/devices/memdev.zeroDevice" +} + +func (x *zeroDevice) StateFields() []string { + return []string{} +} + +func (x *zeroDevice) beforeSave() {} + +func (x *zeroDevice) StateSave(m state.Sink) { + x.beforeSave() +} + +func (x *zeroDevice) afterLoad() {} + +func (x *zeroDevice) StateLoad(m state.Source) { +} + +func (x *zeroFD) StateTypeName() string { + return "pkg/sentry/devices/memdev.zeroFD" +} + +func (x *zeroFD) StateFields() []string { + return []string{ + "vfsfd", + "FileDescriptionDefaultImpl", + "DentryMetadataFileDescriptionImpl", + "NoLockFD", + } +} + +func (x *zeroFD) beforeSave() {} + +func (x *zeroFD) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.vfsfd) + m.Save(1, &x.FileDescriptionDefaultImpl) + m.Save(2, &x.DentryMetadataFileDescriptionImpl) + m.Save(3, &x.NoLockFD) +} + +func (x *zeroFD) afterLoad() {} + +func (x *zeroFD) StateLoad(m state.Source) { + m.Load(0, &x.vfsfd) + m.Load(1, &x.FileDescriptionDefaultImpl) + m.Load(2, &x.DentryMetadataFileDescriptionImpl) + m.Load(3, &x.NoLockFD) +} + +func init() { + state.Register((*fullDevice)(nil)) + state.Register((*fullFD)(nil)) + state.Register((*nullDevice)(nil)) + state.Register((*nullFD)(nil)) + state.Register((*randomDevice)(nil)) + state.Register((*randomFD)(nil)) + state.Register((*zeroDevice)(nil)) + state.Register((*zeroFD)(nil)) +} |