diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-10-24 00:53:27 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-24 00:53:27 +0000 |
commit | 70cbe923d390e91fc05b06dfa05c6810b0701037 (patch) | |
tree | fba2e949690078ba4ffef65d03a2bdfaa9b01b61 /pkg/sentry/devices/tundev | |
parent | b1dbae4ae486840d512fc3e0ba8606ae66580234 (diff) | |
parent | 9f87400f087df0492cf181c97f431b6d5ce3a987 (diff) |
Merge release-20201019.0-51-g9f87400f0 (automated)
Diffstat (limited to 'pkg/sentry/devices/tundev')
-rw-r--r-- | pkg/sentry/devices/tundev/tundev.go | 4 | ||||
-rw-r--r-- | pkg/sentry/devices/tundev/tundev_state_autogen.go | 63 |
2 files changed, 67 insertions, 0 deletions
diff --git a/pkg/sentry/devices/tundev/tundev.go b/pkg/sentry/devices/tundev/tundev.go index 655ea549b..ff5d49fbd 100644 --- a/pkg/sentry/devices/tundev/tundev.go +++ b/pkg/sentry/devices/tundev/tundev.go @@ -39,6 +39,8 @@ const ( ) // tunDevice implements vfs.Device for /dev/net/tun. +// +// +stateify savable type tunDevice struct{} // Open implements vfs.Device.Open. @@ -53,6 +55,8 @@ func (tunDevice) Open(ctx context.Context, mnt *vfs.Mount, vfsd *vfs.Dentry, opt } // tunFD implements vfs.FileDescriptionImpl for /dev/net/tun. +// +// +stateify savable type tunFD struct { vfsfd vfs.FileDescription vfs.FileDescriptionDefaultImpl diff --git a/pkg/sentry/devices/tundev/tundev_state_autogen.go b/pkg/sentry/devices/tundev/tundev_state_autogen.go index d0762ce23..343d5b8e7 100644 --- a/pkg/sentry/devices/tundev/tundev_state_autogen.go +++ b/pkg/sentry/devices/tundev/tundev_state_autogen.go @@ -1,3 +1,66 @@ // automatically generated by stateify. package tundev + +import ( + "gvisor.dev/gvisor/pkg/state" +) + +func (t *tunDevice) StateTypeName() string { + return "pkg/sentry/devices/tundev.tunDevice" +} + +func (t *tunDevice) StateFields() []string { + return []string{} +} + +func (t *tunDevice) beforeSave() {} + +func (t *tunDevice) StateSave(stateSinkObject state.Sink) { + t.beforeSave() +} + +func (t *tunDevice) afterLoad() {} + +func (t *tunDevice) StateLoad(stateSourceObject state.Source) { +} + +func (fd *tunFD) StateTypeName() string { + return "pkg/sentry/devices/tundev.tunFD" +} + +func (fd *tunFD) StateFields() []string { + return []string{ + "vfsfd", + "FileDescriptionDefaultImpl", + "DentryMetadataFileDescriptionImpl", + "NoLockFD", + "device", + } +} + +func (fd *tunFD) beforeSave() {} + +func (fd *tunFD) StateSave(stateSinkObject state.Sink) { + fd.beforeSave() + stateSinkObject.Save(0, &fd.vfsfd) + stateSinkObject.Save(1, &fd.FileDescriptionDefaultImpl) + stateSinkObject.Save(2, &fd.DentryMetadataFileDescriptionImpl) + stateSinkObject.Save(3, &fd.NoLockFD) + stateSinkObject.Save(4, &fd.device) +} + +func (fd *tunFD) afterLoad() {} + +func (fd *tunFD) StateLoad(stateSourceObject state.Source) { + stateSourceObject.Load(0, &fd.vfsfd) + stateSourceObject.Load(1, &fd.FileDescriptionDefaultImpl) + stateSourceObject.Load(2, &fd.DentryMetadataFileDescriptionImpl) + stateSourceObject.Load(3, &fd.NoLockFD) + stateSourceObject.Load(4, &fd.device) +} + +func init() { + state.Register((*tunDevice)(nil)) + state.Register((*tunFD)(nil)) +} |