File: tun_state_autogen.go

package info (click to toggle)
golang-gvisor-gvisor 0.0~20240729.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 21,300 kB
  • sloc: asm: 3,361; ansic: 1,197; cpp: 348; makefile: 92; python: 89; sh: 83
file content (102 lines) | stat: -rw-r--r-- 2,260 bytes parent folder | download | duplicates (2)
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
// automatically generated by stateify.

package tun

import (
	"context"

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

func (d *Device) StateTypeName() string {
	return "pkg/tcpip/link/tun.Device"
}

func (d *Device) StateFields() []string {
	return []string{
		"Queue",
		"endpoint",
		"notifyHandle",
		"flags",
	}
}

// +checklocksignore
func (d *Device) StateSave(stateSinkObject state.Sink) {
	d.beforeSave()
	stateSinkObject.Save(0, &d.Queue)
	stateSinkObject.Save(1, &d.endpoint)
	stateSinkObject.Save(2, &d.notifyHandle)
	stateSinkObject.Save(3, &d.flags)
}

func (d *Device) afterLoad(context.Context) {}

// +checklocksignore
func (d *Device) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &d.Queue)
	stateSourceObject.Load(1, &d.endpoint)
	stateSourceObject.Load(2, &d.notifyHandle)
	stateSourceObject.Load(3, &d.flags)
}

func (f *Flags) StateTypeName() string {
	return "pkg/tcpip/link/tun.Flags"
}

func (f *Flags) StateFields() []string {
	return []string{
		"TUN",
		"TAP",
		"NoPacketInfo",
	}
}

func (f *Flags) beforeSave() {}

// +checklocksignore
func (f *Flags) StateSave(stateSinkObject state.Sink) {
	f.beforeSave()
	stateSinkObject.Save(0, &f.TUN)
	stateSinkObject.Save(1, &f.TAP)
	stateSinkObject.Save(2, &f.NoPacketInfo)
}

func (f *Flags) afterLoad(context.Context) {}

// +checklocksignore
func (f *Flags) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &f.TUN)
	stateSourceObject.Load(1, &f.TAP)
	stateSourceObject.Load(2, &f.NoPacketInfo)
}

func (r *tunEndpointRefs) StateTypeName() string {
	return "pkg/tcpip/link/tun.tunEndpointRefs"
}

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

func (r *tunEndpointRefs) beforeSave() {}

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

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

func init() {
	state.Register((*Device)(nil))
	state.Register((*Flags)(nil))
	state.Register((*tunEndpointRefs)(nil))
}