File: shm_state_autogen.go

package info (click to toggle)
golang-gvisor-gvisor 0.0~20240729.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,276 kB
  • sloc: asm: 3,361; ansic: 1,197; cpp: 348; makefile: 92; python: 89; sh: 83
file content (130 lines) | stat: -rw-r--r-- 3,148 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// automatically generated by stateify.

package shm

import (
	"context"

	"gvisor.dev/gvisor/pkg/state"
)

func (r *Registry) StateTypeName() string {
	return "pkg/sentry/kernel/shm.Registry"
}

func (r *Registry) StateFields() []string {
	return []string{
		"userNS",
		"reg",
		"totalPages",
	}
}

func (r *Registry) beforeSave() {}

// +checklocksignore
func (r *Registry) StateSave(stateSinkObject state.Sink) {
	r.beforeSave()
	stateSinkObject.Save(0, &r.userNS)
	stateSinkObject.Save(1, &r.reg)
	stateSinkObject.Save(2, &r.totalPages)
}

func (r *Registry) afterLoad(context.Context) {}

// +checklocksignore
func (r *Registry) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &r.userNS)
	stateSourceObject.Load(1, &r.reg)
	stateSourceObject.Load(2, &r.totalPages)
}

func (s *Shm) StateTypeName() string {
	return "pkg/sentry/kernel/shm.Shm"
}

func (s *Shm) StateFields() []string {
	return []string{
		"ShmRefs",
		"registry",
		"devID",
		"size",
		"effectiveSize",
		"fr",
		"obj",
		"attachTime",
		"detachTime",
		"changeTime",
		"creatorPID",
		"lastAttachDetachPID",
		"pendingDestruction",
	}
}

func (s *Shm) beforeSave() {}

// +checklocksignore
func (s *Shm) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	stateSinkObject.Save(0, &s.ShmRefs)
	stateSinkObject.Save(1, &s.registry)
	stateSinkObject.Save(2, &s.devID)
	stateSinkObject.Save(3, &s.size)
	stateSinkObject.Save(4, &s.effectiveSize)
	stateSinkObject.Save(5, &s.fr)
	stateSinkObject.Save(6, &s.obj)
	stateSinkObject.Save(7, &s.attachTime)
	stateSinkObject.Save(8, &s.detachTime)
	stateSinkObject.Save(9, &s.changeTime)
	stateSinkObject.Save(10, &s.creatorPID)
	stateSinkObject.Save(11, &s.lastAttachDetachPID)
	stateSinkObject.Save(12, &s.pendingDestruction)
}

// +checklocksignore
func (s *Shm) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &s.ShmRefs)
	stateSourceObject.Load(1, &s.registry)
	stateSourceObject.Load(2, &s.devID)
	stateSourceObject.Load(3, &s.size)
	stateSourceObject.Load(4, &s.effectiveSize)
	stateSourceObject.Load(5, &s.fr)
	stateSourceObject.Load(6, &s.obj)
	stateSourceObject.Load(7, &s.attachTime)
	stateSourceObject.Load(8, &s.detachTime)
	stateSourceObject.Load(9, &s.changeTime)
	stateSourceObject.Load(10, &s.creatorPID)
	stateSourceObject.Load(11, &s.lastAttachDetachPID)
	stateSourceObject.Load(12, &s.pendingDestruction)
	stateSourceObject.AfterLoad(func() { s.afterLoad(ctx) })
}

func (r *ShmRefs) StateTypeName() string {
	return "pkg/sentry/kernel/shm.ShmRefs"
}

func (r *ShmRefs) StateFields() []string {
	return []string{
		"refCount",
	}
}

func (r *ShmRefs) beforeSave() {}

// +checklocksignore
func (r *ShmRefs) StateSave(stateSinkObject state.Sink) {
	r.beforeSave()
	stateSinkObject.Save(0, &r.refCount)
}

// +checklocksignore
func (r *ShmRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &r.refCount)
	stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) })
}

func init() {
	state.Register((*Registry)(nil))
	state.Register((*Shm)(nil))
	state.Register((*ShmRefs)(nil))
}