diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-09-24 17:19:53 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-24 17:19:53 +0000 |
commit | 61cc049caaa2317eda73e66f65f82b5099dd2bc2 (patch) | |
tree | 352bfc9c114c181e052a9656be9f3b2acd5f7b33 /pkg/sentry/fsimpl/devpts | |
parent | 3102024707dc370e025f1b46fa2be12eade2f9cb (diff) | |
parent | 0a7075f38a4870ded687e117a299ac4996c0673e (diff) |
Merge release-20200914.0-152-g0a7075f38 (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/devpts')
-rw-r--r-- | pkg/sentry/fsimpl/devpts/devpts.go | 8 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/devpts/devpts_state_autogen.go | 289 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/devpts/master.go | 3 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/devpts/replica.go | 3 |
4 files changed, 302 insertions, 1 deletions
diff --git a/pkg/sentry/fsimpl/devpts/devpts.go b/pkg/sentry/fsimpl/devpts/devpts.go index 77d1f493d..903135fae 100644 --- a/pkg/sentry/fsimpl/devpts/devpts.go +++ b/pkg/sentry/fsimpl/devpts/devpts.go @@ -35,6 +35,8 @@ import ( const Name = "devpts" // FilesystemType implements vfs.FilesystemType. +// +// +stateify savable type FilesystemType struct{} // Name implements vfs.FilesystemType.Name. @@ -58,6 +60,7 @@ func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.Virt return fs.Filesystem.VFSFilesystem(), root.VFSDentry(), nil } +// +stateify savable type filesystem struct { kernfs.Filesystem @@ -110,6 +113,8 @@ func (fs *filesystem) Release(ctx context.Context) { } // rootInode is the root directory inode for the devpts mounts. +// +// +stateify savable type rootInode struct { implStatFS kernfs.AlwaysValid @@ -131,7 +136,7 @@ type rootInode struct { root *rootInode // mu protects the fields below. - mu sync.Mutex + mu sync.Mutex `state:"nosave"` // replicas maps pty ids to replica inodes. replicas map[uint32]*replicaInode @@ -242,6 +247,7 @@ func (i *rootInode) DecRef(context.Context) { i.rootInodeRefs.DecRef(i.Destroy) } +// +stateify savable type implStatFS struct{} // StatFS implements kernfs.Inode.StatFS. diff --git a/pkg/sentry/fsimpl/devpts/devpts_state_autogen.go b/pkg/sentry/fsimpl/devpts/devpts_state_autogen.go index 5e9f200c8..61e4f6fdf 100644 --- a/pkg/sentry/fsimpl/devpts/devpts_state_autogen.go +++ b/pkg/sentry/fsimpl/devpts/devpts_state_autogen.go @@ -6,6 +6,129 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *FilesystemType) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.FilesystemType" +} + +func (x *FilesystemType) StateFields() []string { + return []string{} +} + +func (x *FilesystemType) beforeSave() {} + +func (x *FilesystemType) StateSave(m state.Sink) { + x.beforeSave() +} + +func (x *FilesystemType) afterLoad() {} + +func (x *FilesystemType) StateLoad(m state.Source) { +} + +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{ + "Filesystem", + "devMinor", + } +} + +func (x *filesystem) beforeSave() {} + +func (x *filesystem) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.Filesystem) + m.Save(1, &x.devMinor) +} + +func (x *filesystem) afterLoad() {} + +func (x *filesystem) StateLoad(m state.Source) { + m.Load(0, &x.Filesystem) + m.Load(1, &x.devMinor) +} + +func (x *rootInode) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.rootInode" +} + +func (x *rootInode) StateFields() []string { + return []string{ + "implStatFS", + "AlwaysValid", + "InodeAttrs", + "InodeDirectoryNoNewChildren", + "InodeNotSymlink", + "OrderedChildren", + "rootInodeRefs", + "locks", + "dentry", + "master", + "root", + "replicas", + "nextIdx", + } +} + +func (x *rootInode) beforeSave() {} + +func (x *rootInode) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.implStatFS) + m.Save(1, &x.AlwaysValid) + m.Save(2, &x.InodeAttrs) + m.Save(3, &x.InodeDirectoryNoNewChildren) + m.Save(4, &x.InodeNotSymlink) + m.Save(5, &x.OrderedChildren) + m.Save(6, &x.rootInodeRefs) + m.Save(7, &x.locks) + m.Save(8, &x.dentry) + m.Save(9, &x.master) + m.Save(10, &x.root) + m.Save(11, &x.replicas) + m.Save(12, &x.nextIdx) +} + +func (x *rootInode) afterLoad() {} + +func (x *rootInode) StateLoad(m state.Source) { + m.Load(0, &x.implStatFS) + m.Load(1, &x.AlwaysValid) + m.Load(2, &x.InodeAttrs) + m.Load(3, &x.InodeDirectoryNoNewChildren) + m.Load(4, &x.InodeNotSymlink) + m.Load(5, &x.OrderedChildren) + m.Load(6, &x.rootInodeRefs) + m.Load(7, &x.locks) + m.Load(8, &x.dentry) + m.Load(9, &x.master) + m.Load(10, &x.root) + m.Load(11, &x.replicas) + m.Load(12, &x.nextIdx) +} + +func (x *implStatFS) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.implStatFS" +} + +func (x *implStatFS) StateFields() []string { + return []string{} +} + +func (x *implStatFS) beforeSave() {} + +func (x *implStatFS) StateSave(m state.Sink) { + x.beforeSave() +} + +func (x *implStatFS) afterLoad() {} + +func (x *implStatFS) StateLoad(m state.Source) { +} + func (x *lineDiscipline) StateTypeName() string { return "pkg/sentry/fsimpl/devpts.lineDiscipline" } @@ -85,6 +208,85 @@ func (x *inputQueueTransformer) afterLoad() {} func (x *inputQueueTransformer) StateLoad(m state.Source) { } +func (x *masterInode) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.masterInode" +} + +func (x *masterInode) StateFields() []string { + return []string{ + "implStatFS", + "InodeAttrs", + "InodeNoopRefCount", + "InodeNotDirectory", + "InodeNotSymlink", + "locks", + "dentry", + "root", + } +} + +func (x *masterInode) beforeSave() {} + +func (x *masterInode) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.implStatFS) + m.Save(1, &x.InodeAttrs) + m.Save(2, &x.InodeNoopRefCount) + m.Save(3, &x.InodeNotDirectory) + m.Save(4, &x.InodeNotSymlink) + m.Save(5, &x.locks) + m.Save(6, &x.dentry) + m.Save(7, &x.root) +} + +func (x *masterInode) afterLoad() {} + +func (x *masterInode) StateLoad(m state.Source) { + m.Load(0, &x.implStatFS) + m.Load(1, &x.InodeAttrs) + m.Load(2, &x.InodeNoopRefCount) + m.Load(3, &x.InodeNotDirectory) + m.Load(4, &x.InodeNotSymlink) + m.Load(5, &x.locks) + m.Load(6, &x.dentry) + m.Load(7, &x.root) +} + +func (x *masterFileDescription) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.masterFileDescription" +} + +func (x *masterFileDescription) StateFields() []string { + return []string{ + "vfsfd", + "FileDescriptionDefaultImpl", + "LockFD", + "inode", + "t", + } +} + +func (x *masterFileDescription) beforeSave() {} + +func (x *masterFileDescription) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.vfsfd) + m.Save(1, &x.FileDescriptionDefaultImpl) + m.Save(2, &x.LockFD) + m.Save(3, &x.inode) + m.Save(4, &x.t) +} + +func (x *masterFileDescription) afterLoad() {} + +func (x *masterFileDescription) StateLoad(m state.Source) { + m.Load(0, &x.vfsfd) + m.Load(1, &x.FileDescriptionDefaultImpl) + m.Load(2, &x.LockFD) + m.Load(3, &x.inode) + m.Load(4, &x.t) +} + func (x *queue) StateTypeName() string { return "pkg/sentry/fsimpl/devpts.queue" } @@ -120,6 +322,85 @@ func (x *queue) StateLoad(m state.Source) { m.Load(4, &x.transformer) } +func (x *replicaInode) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.replicaInode" +} + +func (x *replicaInode) StateFields() []string { + return []string{ + "implStatFS", + "InodeAttrs", + "InodeNoopRefCount", + "InodeNotDirectory", + "InodeNotSymlink", + "locks", + "dentry", + "root", + "t", + } +} + +func (x *replicaInode) beforeSave() {} + +func (x *replicaInode) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.implStatFS) + m.Save(1, &x.InodeAttrs) + m.Save(2, &x.InodeNoopRefCount) + m.Save(3, &x.InodeNotDirectory) + m.Save(4, &x.InodeNotSymlink) + m.Save(5, &x.locks) + m.Save(6, &x.dentry) + m.Save(7, &x.root) + m.Save(8, &x.t) +} + +func (x *replicaInode) afterLoad() {} + +func (x *replicaInode) StateLoad(m state.Source) { + m.Load(0, &x.implStatFS) + m.Load(1, &x.InodeAttrs) + m.Load(2, &x.InodeNoopRefCount) + m.Load(3, &x.InodeNotDirectory) + m.Load(4, &x.InodeNotSymlink) + m.Load(5, &x.locks) + m.Load(6, &x.dentry) + m.Load(7, &x.root) + m.Load(8, &x.t) +} + +func (x *replicaFileDescription) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.replicaFileDescription" +} + +func (x *replicaFileDescription) StateFields() []string { + return []string{ + "vfsfd", + "FileDescriptionDefaultImpl", + "LockFD", + "inode", + } +} + +func (x *replicaFileDescription) beforeSave() {} + +func (x *replicaFileDescription) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.vfsfd) + m.Save(1, &x.FileDescriptionDefaultImpl) + m.Save(2, &x.LockFD) + m.Save(3, &x.inode) +} + +func (x *replicaFileDescription) afterLoad() {} + +func (x *replicaFileDescription) StateLoad(m state.Source) { + m.Load(0, &x.vfsfd) + m.Load(1, &x.FileDescriptionDefaultImpl) + m.Load(2, &x.LockFD) + m.Load(3, &x.inode) +} + func (x *rootInodeRefs) StateTypeName() string { return "pkg/sentry/fsimpl/devpts.rootInodeRefs" } @@ -176,10 +457,18 @@ func (x *Terminal) StateLoad(m state.Source) { } func init() { + state.Register((*FilesystemType)(nil)) + state.Register((*filesystem)(nil)) + state.Register((*rootInode)(nil)) + state.Register((*implStatFS)(nil)) state.Register((*lineDiscipline)(nil)) state.Register((*outputQueueTransformer)(nil)) state.Register((*inputQueueTransformer)(nil)) + state.Register((*masterInode)(nil)) + state.Register((*masterFileDescription)(nil)) state.Register((*queue)(nil)) + state.Register((*replicaInode)(nil)) + state.Register((*replicaFileDescription)(nil)) state.Register((*rootInodeRefs)(nil)) state.Register((*Terminal)(nil)) } diff --git a/pkg/sentry/fsimpl/devpts/master.go b/pkg/sentry/fsimpl/devpts/master.go index 98d4ffb22..bfcaf60bd 100644 --- a/pkg/sentry/fsimpl/devpts/master.go +++ b/pkg/sentry/fsimpl/devpts/master.go @@ -31,6 +31,8 @@ import ( ) // masterInode is the inode for the master end of the Terminal. +// +// +stateify savable type masterInode struct { implStatFS kernfs.InodeAttrs @@ -89,6 +91,7 @@ func (mi *masterInode) SetStat(ctx context.Context, vfsfs *vfs.Filesystem, creds return mi.InodeAttrs.SetStat(ctx, vfsfs, creds, opts) } +// +stateify savable type masterFileDescription struct { vfsfd vfs.FileDescription vfs.FileDescriptionDefaultImpl diff --git a/pkg/sentry/fsimpl/devpts/replica.go b/pkg/sentry/fsimpl/devpts/replica.go index 816bac80c..9638eb6c5 100644 --- a/pkg/sentry/fsimpl/devpts/replica.go +++ b/pkg/sentry/fsimpl/devpts/replica.go @@ -30,6 +30,8 @@ import ( ) // replicaInode is the inode for the replica end of the Terminal. +// +// +stateify savable type replicaInode struct { implStatFS kernfs.InodeAttrs @@ -95,6 +97,7 @@ func (si *replicaInode) SetStat(ctx context.Context, vfsfs *vfs.Filesystem, cred return si.InodeAttrs.SetStat(ctx, vfsfs, creds, opts) } +// +stateify savable type replicaFileDescription struct { vfsfd vfs.FileDescription vfs.FileDescriptionDefaultImpl |