stateify: convert all packages to use explicit mode.

PiperOrigin-RevId: 207007153
Change-Id: Ifedf1cc3758dc18be16647a4ece9c840c1c636c9
This commit is contained in:
Zhaozhong Ni
2018-08-01 15:43:24 -07:00
committed by Shentubot
parent 6b87378634
commit b9e1cf8404
239 changed files with 662 additions and 1108 deletions
+1 -12
View File
@@ -1,24 +1,13 @@
package(licenses = ["notice"]) # Apache 2.0
load("//tools/go_stateify:defs.bzl", "go_library", "go_stateify")
go_stateify(
name = "abi_state",
srcs = [
"abi.go",
],
out = "abi_state.go",
package = "abi",
)
load("//tools/go_stateify:defs.bzl", "go_library")
go_library(
name = "abi",
srcs = [
"abi.go",
"abi_state.go",
"flag.go",
],
importpath = "gvisor.googlesource.com/gvisor/pkg/abi",
visibility = ["//:sandbox"],
deps = ["//pkg/state"],
)
+1 -15
View File
@@ -4,19 +4,7 @@
package(licenses = ["notice"]) # Apache 2.0
load("//tools/go_stateify:defs.bzl", "go_library", "go_stateify")
go_stateify(
name = "linux_state",
srcs = [
"binder.go",
"bpf.go",
"time.go",
"tty.go",
],
out = "linux_state.go",
package = "linux",
)
load("//tools/go_stateify:defs.bzl", "go_library")
go_library(
name = "linux",
@@ -41,7 +29,6 @@ go_library(
"ipc.go",
"limits.go",
"linux.go",
"linux_state.go",
"mm.go",
"netdevice.go",
"netlink.go",
@@ -67,6 +54,5 @@ go_library(
"//pkg/abi",
"//pkg/binary",
"//pkg/bits",
"//pkg/state",
],
)
+2
View File
@@ -15,6 +15,8 @@
package linux
// BPFInstruction is a raw BPF virtual machine instruction.
//
// +stateify savable
type BPFInstruction struct {
// OpCode is the operation to execute.
OpCode uint16
+2
View File
@@ -38,6 +38,8 @@ type Termios struct {
// KernelTermios is struct ktermios/struct termios2, defined in
// uapi/asm-generic/termbits.h.
//
// +stateify savable
type KernelTermios struct {
InputFlags uint32
OutputFlags uint32
+2 -15
View File
@@ -1,21 +1,11 @@
package(licenses = ["notice"]) # Apache 2.0
load("//tools/go_stateify:defs.bzl", "go_library", "go_stateify", "go_test")
go_stateify(
name = "bpf_state",
srcs = [
"interpreter.go",
],
out = "bpf_state.go",
package = "bpf",
)
load("//tools/go_stateify:defs.bzl", "go_library", "go_test")
go_library(
name = "bpf",
srcs = [
"bpf.go",
"bpf_state.go",
"decoder.go",
"input_bytes.go",
"interpreter.go",
@@ -23,10 +13,7 @@ go_library(
],
importpath = "gvisor.googlesource.com/gvisor/pkg/bpf",
visibility = ["//visibility:public"],
deps = [
"//pkg/abi/linux",
"//pkg/state",
],
deps = ["//pkg/abi/linux"],
)
go_test(
+2
View File
@@ -88,6 +88,8 @@ func (e Error) Error() string {
}
// Program is a BPF program that has been validated for consistency.
//
// +stateify savable
type Program struct {
instructions []linux.BPFInstruction
}
+2 -13
View File
@@ -1,27 +1,16 @@
package(licenses = ["notice"]) # Apache 2.0
load("//tools/go_stateify:defs.bzl", "go_library", "go_stateify", "go_test")
go_stateify(
name = "cpuid_state",
srcs = ["cpuid.go"],
out = "cpuid_state.go",
package = "cpuid",
)
load("//tools/go_stateify:defs.bzl", "go_library", "go_test")
go_library(
name = "cpuid",
srcs = [
"cpu_amd64.s",
"cpuid.go",
"cpuid_state.go",
],
importpath = "gvisor.googlesource.com/gvisor/pkg/cpuid",
visibility = ["//:sandbox"],
deps = [
"//pkg/log",
"//pkg/state",
],
deps = ["//pkg/log"],
)
go_test(
+2
View File
@@ -409,6 +409,8 @@ func (f Feature) flagString(cpuinfoOnly bool) string {
}
// FeatureSet is a set of Features for a cpu.
//
// +stateify savable
type FeatureSet struct {
// Set is the set of features that are enabled in this FeatureSet.
Set map[Feature]bool
+1 -14
View File
@@ -1,28 +1,15 @@
package(licenses = ["notice"]) # Apache 2.0
load("//tools/go_generics:defs.bzl", "go_template", "go_template_instance")
load("//tools/go_stateify:defs.bzl", "go_library", "go_stateify", "go_test")
go_stateify(
name = "list_state",
srcs = [
"interface_list.go",
],
out = "interface_list_state.go",
package = "ilist",
)
load("//tools/go_stateify:defs.bzl", "go_library", "go_test")
go_library(
name = "ilist",
srcs = [
"interface_list.go",
"interface_list_state.go",
],
importpath = "gvisor.googlesource.com/gvisor/pkg/ilist",
visibility = ["//visibility:public"],
deps = [
"//pkg/state",
],
)
go_template_instance(
+4
View File
@@ -36,6 +36,8 @@ type Linker interface {
// for e := l.Front(); e != nil; e = e.Next() {
// // do something with e.
// }
//
// +stateify savable
type List struct {
head Linker
tail Linker
@@ -155,6 +157,8 @@ func (l *List) Remove(e Linker) {
// Entry is a default implementation of Linker. Users can add anonymous fields
// of this type to their structs to make them automatically implement the
// methods needed by List.
//
// +stateify savable
type Entry struct {
next Linker
prev Linker
+2
View File
@@ -18,6 +18,8 @@ package segment
type T uint64
// A Range represents a contiguous range of T.
//
// +stateify savable
type Range struct {
// Start is the inclusive start of the range.
Start T
+5
View File
@@ -88,6 +88,8 @@ const (
// A Set is a mapping of segments with non-overlapping Range keys. The zero
// value for a Set is an empty set. Set values are not safely movable nor
// copyable. Set is thread-compatible.
//
// +stateify savable
type Set struct {
root node `state:".(*SegmentDataSlices)"`
}
@@ -596,6 +598,7 @@ func (s *Set) ApplyContiguous(r Range, fn func(seg Iterator)) GapIterator {
}
}
// +stateify savable
type node struct {
// An internal binary tree node looks like:
//
@@ -1317,6 +1320,8 @@ func (n *node) writeDebugString(buf *bytes.Buffer, prefix string) {
// SegmentDataSlices represents segments from a set as slices of start, end, and
// values. SegmentDataSlices is primarily used as an intermediate representation
// for save/restore and the layout here is optimized for that.
//
// +stateify savable
type SegmentDataSlices struct {
Start []Key
End []Key
+1 -17
View File
@@ -1,21 +1,7 @@
package(licenses = ["notice"]) # Apache 2.0
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("//tools/go_stateify:defs.bzl", "go_library", "go_stateify")
go_stateify(
name = "arch_state",
srcs = [
"arch.go",
"arch_amd64.go",
"arch_state_x86.go",
"arch_x86.go",
"auxv.go",
"signal_amd64.go",
],
out = "arch_state.go",
package = "arch",
)
load("//tools/go_stateify:defs.bzl", "go_library")
go_library(
name = "arch",
@@ -24,7 +10,6 @@ go_library(
"arch.go",
"arch_amd64.go",
"arch_amd64.s",
"arch_state.go",
"arch_state_x86.go",
"arch_x86.go",
"auxv.go",
@@ -46,7 +31,6 @@ go_library(
"//pkg/sentry/context",
"//pkg/sentry/limits",
"//pkg/sentry/usermem",
"//pkg/state",
"//pkg/syserror",
],
)
+2
View File
@@ -254,6 +254,8 @@ const (
// MemoryManager.
//
// Note that "highest address" below is always exclusive.
//
// +stateify savable
type MmapLayout struct {
// MinAddr is the lowest mappable address.
MinAddr usermem.Addr
+2
View File
@@ -95,6 +95,8 @@ const (
)
// context64 represents an AMD64 context.
//
// +stateify savable
type context64 struct {
State
sigFPState []x86FPState // fpstate to be restored on sigreturn.
+1
View File
@@ -56,6 +56,7 @@ func (s *State) afterLoad() {
copy(s.x86FPState, old)
}
// +stateify savable
type syscallPtraceRegs struct {
R15 uint64
R14 uint64
+2
View File
@@ -153,6 +153,8 @@ func NewFloatingPointData() *FloatingPointData {
// State contains the common architecture bits for X86 (the build tag of this
// file ensures it's only built on x86).
//
// +stateify savable
type State struct {
// The system registers.
Regs syscall.PtraceRegs `state:".(syscallPtraceRegs)"`
+2
View File
@@ -19,6 +19,8 @@ import (
)
// An AuxEntry represents an entry in an ELF auxiliary vector.
//
// +stateify savable
type AuxEntry struct {
Key uint64
Value usermem.Addr
+6
View File
@@ -28,6 +28,8 @@ import (
// SignalAct represents the action that should be taken when a signal is
// delivered, and is equivalent to struct sigaction on 64-bit x86.
//
// +stateify savable
type SignalAct struct {
Handler uint64
Flags uint64
@@ -47,6 +49,8 @@ func (s *SignalAct) DeserializeTo(other *SignalAct) {
// SignalStack represents information about a user stack, and is equivalent to
// stack_t on 64-bit x86.
//
// +stateify savable
type SignalStack struct {
Addr uint64
Flags uint32
@@ -66,6 +70,8 @@ func (s *SignalStack) DeserializeTo(other *SignalStack) {
// SignalInfo represents information about a signal being delivered, and is
// equivalent to struct siginfo on 64-bit x86.
//
// +stateify savable
type SignalInfo struct {
Signo int32 // Signal number
Errno int32 // Errno value
+2 -15
View File
@@ -1,23 +1,11 @@
package(licenses = ["notice"]) # Apache 2.0
load("//tools/go_stateify:defs.bzl", "go_library", "go_stateify")
go_stateify(
name = "contexttest_state",
srcs = [
"contexttest.go",
],
out = "contexttest_state.go",
package = "contexttest",
)
load("//tools/go_stateify:defs.bzl", "go_library")
go_library(
name = "contexttest",
testonly = 1,
srcs = [
"contexttest.go",
"contexttest_state.go",
],
srcs = ["contexttest.go"],
importpath = "gvisor.googlesource.com/gvisor/pkg/sentry/context/contexttest",
visibility = ["//pkg/sentry:internal"],
deps = [
@@ -28,6 +16,5 @@ go_library(
"//pkg/sentry/platform",
"//pkg/sentry/platform/ptrace",
"//pkg/sentry/uniqueid",
"//pkg/state",
],
)

Some files were not shown because too many files have changed in this diff Show More