summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/host
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fs/host')
-rw-r--r--pkg/sentry/fs/host/BUILD27
-rw-r--r--pkg/sentry/fs/host/descriptor.go2
-rw-r--r--pkg/sentry/fs/host/file.go2
-rw-r--r--pkg/sentry/fs/host/fs.go6
-rw-r--r--pkg/sentry/fs/host/inode.go4
-rw-r--r--pkg/sentry/fs/host/socket.go2
6 files changed, 16 insertions, 27 deletions
diff --git a/pkg/sentry/fs/host/BUILD b/pkg/sentry/fs/host/BUILD
index 23ec66f50..29c79284a 100644
--- a/pkg/sentry/fs/host/BUILD
+++ b/pkg/sentry/fs/host/BUILD
@@ -1,23 +1,6 @@
package(licenses = ["notice"]) # Apache 2.0
-load("//tools/go_stateify:defs.bzl", "go_library", "go_stateify", "go_test")
-
-go_stateify(
- name = "host_state",
- srcs = [
- "control.go",
- "descriptor.go",
- "descriptor_state.go",
- "file.go",
- "fs.go",
- "inode.go",
- "inode_state.go",
- "socket.go",
- "socket_state.go",
- ],
- out = "host_state.go",
- package = "host",
-)
+load("//tools/go_stateify:defs.bzl", "go_library", "go_test")
go_library(
name = "host",
@@ -28,7 +11,6 @@ go_library(
"device.go",
"file.go",
"fs.go",
- "host_state.go",
"inode.go",
"inode_state.go",
"ioctl_unsafe.go",
@@ -42,7 +24,6 @@ go_library(
visibility = ["//pkg/sentry:internal"],
deps = [
"//pkg/abi/linux",
- "//pkg/amutex",
"//pkg/fd",
"//pkg/log",
"//pkg/refs",
@@ -52,20 +33,14 @@ go_library(
"//pkg/sentry/device",
"//pkg/sentry/fs",
"//pkg/sentry/fs/fsutil",
- "//pkg/sentry/fs/lock",
"//pkg/sentry/kernel",
"//pkg/sentry/kernel/auth",
"//pkg/sentry/kernel/time",
"//pkg/sentry/memmap",
- "//pkg/sentry/platform",
"//pkg/sentry/safemem",
- "//pkg/sentry/socket",
"//pkg/sentry/socket/control",
"//pkg/sentry/socket/unix",
- "//pkg/sentry/uniqueid",
- "//pkg/sentry/usage",
"//pkg/sentry/usermem",
- "//pkg/state",
"//pkg/syserror",
"//pkg/tcpip",
"//pkg/tcpip/link/rawfile",
diff --git a/pkg/sentry/fs/host/descriptor.go b/pkg/sentry/fs/host/descriptor.go
index 613bd06e8..3aee4d11c 100644
--- a/pkg/sentry/fs/host/descriptor.go
+++ b/pkg/sentry/fs/host/descriptor.go
@@ -25,6 +25,8 @@ import (
)
// descriptor wraps a host fd.
+//
+// +stateify savable
type descriptor struct {
// donated is true if the host fd was donated by another process.
donated bool
diff --git a/pkg/sentry/fs/host/file.go b/pkg/sentry/fs/host/file.go
index bdf844337..f9bef6d93 100644
--- a/pkg/sentry/fs/host/file.go
+++ b/pkg/sentry/fs/host/file.go
@@ -37,6 +37,8 @@ import (
)
// fileOperations implements fs.FileOperations for a host file descriptor.
+//
+// +stateify savable
type fileOperations struct {
fsutil.NoopRelease `state:"nosave"`
diff --git a/pkg/sentry/fs/host/fs.go b/pkg/sentry/fs/host/fs.go
index 974700636..e46ae433c 100644
--- a/pkg/sentry/fs/host/fs.go
+++ b/pkg/sentry/fs/host/fs.go
@@ -51,6 +51,8 @@ const maxTraversals = 10
// to lock down the configurations. This filesystem should only be mounted at root.
//
// Think twice before exposing this to applications.
+//
+// +stateify savable
type Filesystem struct {
// whitelist is a set of host paths to whitelist.
paths []string
@@ -266,8 +268,10 @@ func newMountSource(ctx context.Context, root string, mounter fs.FileOwner, file
}
// superOperations implements fs.MountSourceOperations.
+//
+// +stateify savable
type superOperations struct {
- fs.SimpleMountSourceOperations `state:"nosave"`
+ fs.SimpleMountSourceOperations
// root is the path of the mount point. All inode mappings
// are relative to this root.
diff --git a/pkg/sentry/fs/host/inode.go b/pkg/sentry/fs/host/inode.go
index 226bc5164..761ccde33 100644
--- a/pkg/sentry/fs/host/inode.go
+++ b/pkg/sentry/fs/host/inode.go
@@ -34,6 +34,8 @@ import (
// inodeOperations implements fs.InodeOperations for an fs.Inodes backed
// by a host file descriptor.
+//
+// +stateify savable
type inodeOperations struct {
fsutil.InodeNotVirtual `state:"nosave"`
fsutil.InodeNoExtendedAttributes `state:"nosave"`
@@ -65,6 +67,8 @@ type inodeOperations struct {
// circular load dependency between it and inodeOperations). Even with
// lazy loading, this approach defines the dependencies between objects
// and the expected load behavior more concretely.
+//
+// +stateify savable
type inodeFileState struct {
// Common file system state.
mops *superOperations `state:"wait"`
diff --git a/pkg/sentry/fs/host/socket.go b/pkg/sentry/fs/host/socket.go
index f4689f51f..1d93eb1e3 100644
--- a/pkg/sentry/fs/host/socket.go
+++ b/pkg/sentry/fs/host/socket.go
@@ -34,6 +34,8 @@ import (
)
// endpoint encapsulates the state needed to represent a host Unix socket.
+//
+// +stateify savable
type endpoint struct {
queue waiter.Queue `state:"nosave"`