summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/tty
diff options
context:
space:
mode:
authorZhaozhong Ni <nzz@google.com>2018-08-01 15:42:07 -0700
committerShentubot <shentubot@google.com>2018-08-01 15:43:24 -0700
commitb9e1cf8404ce1263176643dee1a1cc835c9d1448 (patch)
tree5382c24abb8c19a50fe714af8bb83e1fff6eaa31 /pkg/sentry/fs/tty
parent6b87378634e1575cf590b7558f19b40b012849c2 (diff)
stateify: convert all packages to use explicit mode.
PiperOrigin-RevId: 207007153 Change-Id: Ifedf1cc3758dc18be16647a4ece9c840c1c636c9
Diffstat (limited to 'pkg/sentry/fs/tty')
-rw-r--r--pkg/sentry/fs/tty/BUILD20
-rw-r--r--pkg/sentry/fs/tty/dir.go18
-rw-r--r--pkg/sentry/fs/tty/fs.go4
-rw-r--r--pkg/sentry/fs/tty/inode.go2
-rw-r--r--pkg/sentry/fs/tty/line_discipline.go6
-rw-r--r--pkg/sentry/fs/tty/master.go4
-rw-r--r--pkg/sentry/fs/tty/queue.go4
-rw-r--r--pkg/sentry/fs/tty/slave.go4
-rw-r--r--pkg/sentry/fs/tty/terminal.go2
9 files changed, 37 insertions, 27 deletions
diff --git a/pkg/sentry/fs/tty/BUILD b/pkg/sentry/fs/tty/BUILD
index 363897b2c..3c446eef4 100644
--- a/pkg/sentry/fs/tty/BUILD
+++ b/pkg/sentry/fs/tty/BUILD
@@ -1,22 +1,6 @@
package(licenses = ["notice"]) # Apache 2.0
-load("//tools/go_stateify:defs.bzl", "go_library", "go_stateify", "go_test")
-
-go_stateify(
- name = "tty_state",
- srcs = [
- "dir.go",
- "fs.go",
- "inode.go",
- "line_discipline.go",
- "master.go",
- "queue.go",
- "slave.go",
- "terminal.go",
- ],
- out = "tty_state.go",
- package = "tty",
-)
+load("//tools/go_stateify:defs.bzl", "go_library", "go_test")
go_library(
name = "tty",
@@ -29,7 +13,6 @@ go_library(
"queue.go",
"slave.go",
"terminal.go",
- "tty_state.go",
],
importpath = "gvisor.googlesource.com/gvisor/pkg/sentry/fs/tty",
visibility = ["//pkg/sentry:internal"],
@@ -44,7 +27,6 @@ go_library(
"//pkg/sentry/kernel/auth",
"//pkg/sentry/kernel/time",
"//pkg/sentry/usermem",
- "//pkg/state",
"//pkg/syserror",
"//pkg/tcpip/transport/unix",
"//pkg/waiter",
diff --git a/pkg/sentry/fs/tty/dir.go b/pkg/sentry/fs/tty/dir.go
index 2c5b2aed6..c91091db4 100644
--- a/pkg/sentry/fs/tty/dir.go
+++ b/pkg/sentry/fs/tty/dir.go
@@ -49,14 +49,16 @@ import (
// corresponding Dirents hold on their parent (this directory).
//
// dirInodeOperations implements fs.InodeOperations.
+//
+// +stateify savable
type dirInodeOperations struct {
- fsutil.DeprecatedFileOperations
- fsutil.InodeNotSocket
- fsutil.InodeNotRenameable
- fsutil.InodeNotSymlink
- fsutil.InodeNoExtendedAttributes
- fsutil.NoMappable
- fsutil.NoopWriteOut
+ fsutil.DeprecatedFileOperations `state:"nosave"`
+ fsutil.InodeNotSocket `state:"nosave"`
+ fsutil.InodeNotRenameable `state:"nosave"`
+ fsutil.InodeNotSymlink `state:"nosave"`
+ fsutil.InodeNoExtendedAttributes `state:"nosave"`
+ fsutil.NoMappable `state:"nosave"`
+ fsutil.NoopWriteOut `state:"nosave"`
// msrc is the super block this directory is on.
//
@@ -348,6 +350,8 @@ func (d *dirInodeOperations) masterClose(t *Terminal) {
//
// This is nearly identical to fsutil.DirFileOperations, except that it takes
// df.di.mu in IterateDir.
+//
+// +stateify savable
type dirFileOperations struct {
waiter.AlwaysReady `state:"nosave"`
fsutil.NoopRelease `state:"nosave"`
diff --git a/pkg/sentry/fs/tty/fs.go b/pkg/sentry/fs/tty/fs.go
index dbaffe95e..e28635607 100644
--- a/pkg/sentry/fs/tty/fs.go
+++ b/pkg/sentry/fs/tty/fs.go
@@ -28,6 +28,8 @@ var ptsDevice = device.NewAnonDevice()
//
// This devpts is always in the new "multi-instance" mode. i.e., it contains a
// ptmx device tied to this mount.
+//
+// +stateify savable
type filesystem struct{}
func init() {
@@ -69,6 +71,8 @@ func (f *filesystem) Mount(ctx context.Context, device string, flags fs.MountSou
}
// superOperations implements fs.MountSourceOperations, preventing caching.
+//
+// +stateify savable
type superOperations struct{}
// Revalidate implements fs.DirentOperations.Revalidate.
diff --git a/pkg/sentry/fs/tty/inode.go b/pkg/sentry/fs/tty/inode.go
index 04b9a7727..c0fa2b407 100644
--- a/pkg/sentry/fs/tty/inode.go
+++ b/pkg/sentry/fs/tty/inode.go
@@ -31,6 +31,8 @@ import (
//
// * fs.InodeOperations.Release
// * fs.InodeOperations.GetFile
+//
+// +stateify savable
type inodeOperations struct {
fsutil.DeprecatedFileOperations `state:"nosave"`
fsutil.InodeNoExtendedAttributes `state:"nosave"`
diff --git a/pkg/sentry/fs/tty/line_discipline.go b/pkg/sentry/fs/tty/line_discipline.go
index f094635f5..d243ee40e 100644
--- a/pkg/sentry/fs/tty/line_discipline.go
+++ b/pkg/sentry/fs/tty/line_discipline.go
@@ -72,6 +72,8 @@ const (
// termiosMu
// inQueue.mu
// outQueue.mu
+//
+// +stateify savable
type lineDiscipline struct {
// inQueue is the input queue of the terminal.
inQueue queue
@@ -183,6 +185,8 @@ type transformer interface {
// outputQueueTransformer implements transformer. It performs line discipline
// transformations on the output queue.
+//
+// +stateify savable
type outputQueueTransformer struct{}
// transform does output processing for one end of the pty. See
@@ -254,6 +258,8 @@ func (*outputQueueTransformer) transform(l *lineDiscipline, q *queue, buf []byte
// inputQueueTransformer implements transformer. It performs line discipline
// transformations on the input queue.
+//
+// +stateify savable
type inputQueueTransformer struct{}
// transform does input processing for one end of the pty. Characters read are
diff --git a/pkg/sentry/fs/tty/master.go b/pkg/sentry/fs/tty/master.go
index 74cdbe874..c7198e218 100644
--- a/pkg/sentry/fs/tty/master.go
+++ b/pkg/sentry/fs/tty/master.go
@@ -27,6 +27,8 @@ import (
// masterInodeOperations are the fs.InodeOperations for the master end of the
// Terminal (ptmx file).
+//
+// +stateify savable
type masterInodeOperations struct {
inodeOperations
@@ -96,6 +98,8 @@ func (mi *masterInodeOperations) GetFile(ctx context.Context, d *fs.Dirent, flag
}
// masterFileOperations are the fs.FileOperations for the master end of a terminal.
+//
+// +stateify savable
type masterFileOperations struct {
fsutil.PipeSeek `state:"nosave"`
fsutil.NotDirReaddir `state:"nosave"`
diff --git a/pkg/sentry/fs/tty/queue.go b/pkg/sentry/fs/tty/queue.go
index 026d5e077..42c105abc 100644
--- a/pkg/sentry/fs/tty/queue.go
+++ b/pkg/sentry/fs/tty/queue.go
@@ -32,11 +32,13 @@ import (
// processed (i.e. undergo termios transformations) as they are added to the
// read buffer. The read buffer is readable when its length is nonzero and
// readable is true.
+//
+// +stateify savable
type queue struct {
// mu protects everything in queue.
mu sync.Mutex `state:"nosave"`
- waiter.Queue `state:"nosave"`
+ waiter.Queue `state:"zerovalue"`
// readBuf is buffer of data ready to be read when readable is true.
// This data has been processed.
diff --git a/pkg/sentry/fs/tty/slave.go b/pkg/sentry/fs/tty/slave.go
index f5eec726e..1c562b172 100644
--- a/pkg/sentry/fs/tty/slave.go
+++ b/pkg/sentry/fs/tty/slave.go
@@ -27,6 +27,8 @@ import (
// slaveInodeOperations are the fs.InodeOperations for the slave end of the
// Terminal (pts file).
+//
+// +stateify savable
type slaveInodeOperations struct {
inodeOperations
@@ -86,6 +88,8 @@ func (si *slaveInodeOperations) GetFile(ctx context.Context, d *fs.Dirent, flags
}
// slaveFileOperations are the fs.FileOperations for the slave end of a terminal.
+//
+// +stateify savable
type slaveFileOperations struct {
fsutil.PipeSeek `state:"nosave"`
fsutil.NotDirReaddir `state:"nosave"`
diff --git a/pkg/sentry/fs/tty/terminal.go b/pkg/sentry/fs/tty/terminal.go
index fa5b00409..3cb135124 100644
--- a/pkg/sentry/fs/tty/terminal.go
+++ b/pkg/sentry/fs/tty/terminal.go
@@ -21,6 +21,8 @@ import (
)
// Terminal is a pseudoterminal.
+//
+// +stateify savable
type Terminal struct {
refs.AtomicRefCount