diff options
Diffstat (limited to 'pkg/sentry/socket')
-rw-r--r-- | pkg/sentry/socket/control/control_state_autogen.go | 43 | ||||
-rw-r--r-- | pkg/sentry/socket/hostinet/hostinet_state_autogen.go | 47 | ||||
-rw-r--r-- | pkg/sentry/socket/netlink/netlink_state_autogen.go | 110 | ||||
-rw-r--r-- | pkg/sentry/socket/netlink/port/port_state_autogen.go | 22 | ||||
-rw-r--r-- | pkg/sentry/socket/netlink/route/route_state_autogen.go | 16 | ||||
-rw-r--r-- | pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go | 16 | ||||
-rw-r--r-- | pkg/sentry/socket/netstack/netstack_state_autogen.go | 124 | ||||
-rw-r--r-- | pkg/sentry/socket/socket_state_autogen.go | 27 | ||||
-rw-r--r-- | pkg/sentry/socket/unix/transport/transport_message_list.go | 6 | ||||
-rw-r--r-- | pkg/sentry/socket/unix/transport/transport_state_autogen.go | 367 | ||||
-rw-r--r-- | pkg/sentry/socket/unix/unix_state_autogen.go | 59 |
11 files changed, 593 insertions, 244 deletions
diff --git a/pkg/sentry/socket/control/control_state_autogen.go b/pkg/sentry/socket/control/control_state_autogen.go index 8a37b04c0..f3adf8927 100644 --- a/pkg/sentry/socket/control/control_state_autogen.go +++ b/pkg/sentry/socket/control/control_state_autogen.go @@ -3,34 +3,47 @@ package control import ( - "gvisor.dev/gvisor/pkg/sentry/fs" "gvisor.dev/gvisor/pkg/state" ) -func (x *RightsFiles) save(m state.Map) { - m.SaveValue("", ([]*fs.File)(*x)) +func (x *RightsFiles) StateTypeName() string { + return "pkg/sentry/socket/control.RightsFiles" } -func (x *RightsFiles) load(m state.Map) { - m.LoadValue("", new([]*fs.File), func(y interface{}) { *x = (RightsFiles)(y.([]*fs.File)) }) +func (x *RightsFiles) StateFields() []string { + return nil +} + +func (x *scmCredentials) StateTypeName() string { + return "pkg/sentry/socket/control.scmCredentials" +} + +func (x *scmCredentials) StateFields() []string { + return []string{ + "t", + "kuid", + "kgid", + } } func (x *scmCredentials) beforeSave() {} -func (x *scmCredentials) save(m state.Map) { + +func (x *scmCredentials) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) - m.Save("kuid", &x.kuid) - m.Save("kgid", &x.kgid) + m.Save(0, &x.t) + m.Save(1, &x.kuid) + m.Save(2, &x.kgid) } func (x *scmCredentials) afterLoad() {} -func (x *scmCredentials) load(m state.Map) { - m.Load("t", &x.t) - m.Load("kuid", &x.kuid) - m.Load("kgid", &x.kgid) + +func (x *scmCredentials) StateLoad(m state.Source) { + m.Load(0, &x.t) + m.Load(1, &x.kuid) + m.Load(2, &x.kgid) } func init() { - state.Register("pkg/sentry/socket/control.RightsFiles", (*RightsFiles)(nil), state.Fns{Save: (*RightsFiles).save, Load: (*RightsFiles).load}) - state.Register("pkg/sentry/socket/control.scmCredentials", (*scmCredentials)(nil), state.Fns{Save: (*scmCredentials).save, Load: (*scmCredentials).load}) + state.Register((*RightsFiles)(nil)) + state.Register((*scmCredentials)(nil)) } diff --git a/pkg/sentry/socket/hostinet/hostinet_state_autogen.go b/pkg/sentry/socket/hostinet/hostinet_state_autogen.go index 333811074..4ee4df33b 100644 --- a/pkg/sentry/socket/hostinet/hostinet_state_autogen.go +++ b/pkg/sentry/socket/hostinet/hostinet_state_autogen.go @@ -6,27 +6,44 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *socketOpsCommon) StateTypeName() string { + return "pkg/sentry/socket/hostinet.socketOpsCommon" +} + +func (x *socketOpsCommon) StateFields() []string { + return []string{ + "SendReceiveTimeout", + "family", + "stype", + "protocol", + "queue", + "fd", + } +} + func (x *socketOpsCommon) beforeSave() {} -func (x *socketOpsCommon) save(m state.Map) { + +func (x *socketOpsCommon) StateSave(m state.Sink) { x.beforeSave() - m.Save("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Save("family", &x.family) - m.Save("stype", &x.stype) - m.Save("protocol", &x.protocol) - m.Save("queue", &x.queue) - m.Save("fd", &x.fd) + m.Save(0, &x.SendReceiveTimeout) + m.Save(1, &x.family) + m.Save(2, &x.stype) + m.Save(3, &x.protocol) + m.Save(4, &x.queue) + m.Save(5, &x.fd) } func (x *socketOpsCommon) afterLoad() {} -func (x *socketOpsCommon) load(m state.Map) { - m.Load("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Load("family", &x.family) - m.Load("stype", &x.stype) - m.Load("protocol", &x.protocol) - m.Load("queue", &x.queue) - m.Load("fd", &x.fd) + +func (x *socketOpsCommon) StateLoad(m state.Source) { + m.Load(0, &x.SendReceiveTimeout) + m.Load(1, &x.family) + m.Load(2, &x.stype) + m.Load(3, &x.protocol) + m.Load(4, &x.queue) + m.Load(5, &x.fd) } func init() { - state.Register("pkg/sentry/socket/hostinet.socketOpsCommon", (*socketOpsCommon)(nil), state.Fns{Save: (*socketOpsCommon).save, Load: (*socketOpsCommon).load}) + state.Register((*socketOpsCommon)(nil)) } diff --git a/pkg/sentry/socket/netlink/netlink_state_autogen.go b/pkg/sentry/socket/netlink/netlink_state_autogen.go index fa6a7ce74..5a7a09b6d 100644 --- a/pkg/sentry/socket/netlink/netlink_state_autogen.go +++ b/pkg/sentry/socket/netlink/netlink_state_autogen.go @@ -6,59 +6,103 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Socket) StateTypeName() string { + return "pkg/sentry/socket/netlink.Socket" +} + +func (x *Socket) StateFields() []string { + return []string{ + "socketOpsCommon", + } +} + func (x *Socket) beforeSave() {} -func (x *Socket) save(m state.Map) { + +func (x *Socket) StateSave(m state.Sink) { x.beforeSave() - m.Save("socketOpsCommon", &x.socketOpsCommon) + m.Save(0, &x.socketOpsCommon) } func (x *Socket) afterLoad() {} -func (x *Socket) load(m state.Map) { - m.Load("socketOpsCommon", &x.socketOpsCommon) + +func (x *Socket) StateLoad(m state.Source) { + m.Load(0, &x.socketOpsCommon) +} + +func (x *socketOpsCommon) StateTypeName() string { + return "pkg/sentry/socket/netlink.socketOpsCommon" +} + +func (x *socketOpsCommon) StateFields() []string { + return []string{ + "SendReceiveTimeout", + "ports", + "protocol", + "skType", + "ep", + "connection", + "bound", + "portID", + "sendBufferSize", + "passcred", + "filter", + } } func (x *socketOpsCommon) beforeSave() {} -func (x *socketOpsCommon) save(m state.Map) { + +func (x *socketOpsCommon) StateSave(m state.Sink) { x.beforeSave() - m.Save("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Save("ports", &x.ports) - m.Save("protocol", &x.protocol) - m.Save("skType", &x.skType) - m.Save("ep", &x.ep) - m.Save("connection", &x.connection) - m.Save("bound", &x.bound) - m.Save("portID", &x.portID) - m.Save("sendBufferSize", &x.sendBufferSize) - m.Save("passcred", &x.passcred) - m.Save("filter", &x.filter) + m.Save(0, &x.SendReceiveTimeout) + m.Save(1, &x.ports) + m.Save(2, &x.protocol) + m.Save(3, &x.skType) + m.Save(4, &x.ep) + m.Save(5, &x.connection) + m.Save(6, &x.bound) + m.Save(7, &x.portID) + m.Save(8, &x.sendBufferSize) + m.Save(9, &x.passcred) + m.Save(10, &x.filter) } func (x *socketOpsCommon) afterLoad() {} -func (x *socketOpsCommon) load(m state.Map) { - m.Load("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Load("ports", &x.ports) - m.Load("protocol", &x.protocol) - m.Load("skType", &x.skType) - m.Load("ep", &x.ep) - m.Load("connection", &x.connection) - m.Load("bound", &x.bound) - m.Load("portID", &x.portID) - m.Load("sendBufferSize", &x.sendBufferSize) - m.Load("passcred", &x.passcred) - m.Load("filter", &x.filter) + +func (x *socketOpsCommon) StateLoad(m state.Source) { + m.Load(0, &x.SendReceiveTimeout) + m.Load(1, &x.ports) + m.Load(2, &x.protocol) + m.Load(3, &x.skType) + m.Load(4, &x.ep) + m.Load(5, &x.connection) + m.Load(6, &x.bound) + m.Load(7, &x.portID) + m.Load(8, &x.sendBufferSize) + m.Load(9, &x.passcred) + m.Load(10, &x.filter) +} + +func (x *kernelSCM) StateTypeName() string { + return "pkg/sentry/socket/netlink.kernelSCM" +} + +func (x *kernelSCM) StateFields() []string { + return []string{} } func (x *kernelSCM) beforeSave() {} -func (x *kernelSCM) save(m state.Map) { + +func (x *kernelSCM) StateSave(m state.Sink) { x.beforeSave() } func (x *kernelSCM) afterLoad() {} -func (x *kernelSCM) load(m state.Map) { + +func (x *kernelSCM) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/socket/netlink.Socket", (*Socket)(nil), state.Fns{Save: (*Socket).save, Load: (*Socket).load}) - state.Register("pkg/sentry/socket/netlink.socketOpsCommon", (*socketOpsCommon)(nil), state.Fns{Save: (*socketOpsCommon).save, Load: (*socketOpsCommon).load}) - state.Register("pkg/sentry/socket/netlink.kernelSCM", (*kernelSCM)(nil), state.Fns{Save: (*kernelSCM).save, Load: (*kernelSCM).load}) + state.Register((*Socket)(nil)) + state.Register((*socketOpsCommon)(nil)) + state.Register((*kernelSCM)(nil)) } diff --git a/pkg/sentry/socket/netlink/port/port_state_autogen.go b/pkg/sentry/socket/netlink/port/port_state_autogen.go index c509cc7d5..16c59e616 100644 --- a/pkg/sentry/socket/netlink/port/port_state_autogen.go +++ b/pkg/sentry/socket/netlink/port/port_state_autogen.go @@ -6,17 +6,29 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Manager) StateTypeName() string { + return "pkg/sentry/socket/netlink/port.Manager" +} + +func (x *Manager) StateFields() []string { + return []string{ + "ports", + } +} + func (x *Manager) beforeSave() {} -func (x *Manager) save(m state.Map) { + +func (x *Manager) StateSave(m state.Sink) { x.beforeSave() - m.Save("ports", &x.ports) + m.Save(0, &x.ports) } func (x *Manager) afterLoad() {} -func (x *Manager) load(m state.Map) { - m.Load("ports", &x.ports) + +func (x *Manager) StateLoad(m state.Source) { + m.Load(0, &x.ports) } func init() { - state.Register("pkg/sentry/socket/netlink/port.Manager", (*Manager)(nil), state.Fns{Save: (*Manager).save, Load: (*Manager).load}) + state.Register((*Manager)(nil)) } diff --git a/pkg/sentry/socket/netlink/route/route_state_autogen.go b/pkg/sentry/socket/netlink/route/route_state_autogen.go index bd10fe189..bc0111017 100644 --- a/pkg/sentry/socket/netlink/route/route_state_autogen.go +++ b/pkg/sentry/socket/netlink/route/route_state_autogen.go @@ -6,15 +6,25 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Protocol) StateTypeName() string { + return "pkg/sentry/socket/netlink/route.Protocol" +} + +func (x *Protocol) StateFields() []string { + return []string{} +} + func (x *Protocol) beforeSave() {} -func (x *Protocol) save(m state.Map) { + +func (x *Protocol) StateSave(m state.Sink) { x.beforeSave() } func (x *Protocol) afterLoad() {} -func (x *Protocol) load(m state.Map) { + +func (x *Protocol) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/socket/netlink/route.Protocol", (*Protocol)(nil), state.Fns{Save: (*Protocol).save, Load: (*Protocol).load}) + state.Register((*Protocol)(nil)) } diff --git a/pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go b/pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go index b82dddf32..4f2211ec2 100644 --- a/pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go +++ b/pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go @@ -6,15 +6,25 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Protocol) StateTypeName() string { + return "pkg/sentry/socket/netlink/uevent.Protocol" +} + +func (x *Protocol) StateFields() []string { + return []string{} +} + func (x *Protocol) beforeSave() {} -func (x *Protocol) save(m state.Map) { + +func (x *Protocol) StateSave(m state.Sink) { x.beforeSave() } func (x *Protocol) afterLoad() {} -func (x *Protocol) load(m state.Map) { + +func (x *Protocol) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/socket/netlink/uevent.Protocol", (*Protocol)(nil), state.Fns{Save: (*Protocol).save, Load: (*Protocol).load}) + state.Register((*Protocol)(nil)) } diff --git a/pkg/sentry/socket/netstack/netstack_state_autogen.go b/pkg/sentry/socket/netstack/netstack_state_autogen.go index a1f61607f..b7cf0b290 100644 --- a/pkg/sentry/socket/netstack/netstack_state_autogen.go +++ b/pkg/sentry/socket/netstack/netstack_state_autogen.go @@ -6,65 +6,111 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SocketOperations) StateTypeName() string { + return "pkg/sentry/socket/netstack.SocketOperations" +} + +func (x *SocketOperations) StateFields() []string { + return []string{ + "socketOpsCommon", + } +} + func (x *SocketOperations) beforeSave() {} -func (x *SocketOperations) save(m state.Map) { + +func (x *SocketOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("socketOpsCommon", &x.socketOpsCommon) + m.Save(0, &x.socketOpsCommon) } func (x *SocketOperations) afterLoad() {} -func (x *SocketOperations) load(m state.Map) { - m.Load("socketOpsCommon", &x.socketOpsCommon) + +func (x *SocketOperations) StateLoad(m state.Source) { + m.Load(0, &x.socketOpsCommon) +} + +func (x *socketOpsCommon) StateTypeName() string { + return "pkg/sentry/socket/netstack.socketOpsCommon" +} + +func (x *socketOpsCommon) StateFields() []string { + return []string{ + "SendReceiveTimeout", + "Queue", + "family", + "Endpoint", + "skType", + "protocol", + "readViewHasData", + "readView", + "readCM", + "sender", + "sockOptTimestamp", + "timestampValid", + "timestampNS", + "sockOptInq", + } } func (x *socketOpsCommon) beforeSave() {} -func (x *socketOpsCommon) save(m state.Map) { + +func (x *socketOpsCommon) StateSave(m state.Sink) { x.beforeSave() - m.Save("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Save("Queue", &x.Queue) - m.Save("family", &x.family) - m.Save("Endpoint", &x.Endpoint) - m.Save("skType", &x.skType) - m.Save("protocol", &x.protocol) - m.Save("readViewHasData", &x.readViewHasData) - m.Save("readView", &x.readView) - m.Save("readCM", &x.readCM) - m.Save("sender", &x.sender) - m.Save("sockOptTimestamp", &x.sockOptTimestamp) - m.Save("timestampValid", &x.timestampValid) - m.Save("timestampNS", &x.timestampNS) - m.Save("sockOptInq", &x.sockOptInq) + m.Save(0, &x.SendReceiveTimeout) + m.Save(1, &x.Queue) + m.Save(2, &x.family) + m.Save(3, &x.Endpoint) + m.Save(4, &x.skType) + m.Save(5, &x.protocol) + m.Save(6, &x.readViewHasData) + m.Save(7, &x.readView) + m.Save(8, &x.readCM) + m.Save(9, &x.sender) + m.Save(10, &x.sockOptTimestamp) + m.Save(11, &x.timestampValid) + m.Save(12, &x.timestampNS) + m.Save(13, &x.sockOptInq) } func (x *socketOpsCommon) afterLoad() {} -func (x *socketOpsCommon) load(m state.Map) { - m.Load("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Load("Queue", &x.Queue) - m.Load("family", &x.family) - m.Load("Endpoint", &x.Endpoint) - m.Load("skType", &x.skType) - m.Load("protocol", &x.protocol) - m.Load("readViewHasData", &x.readViewHasData) - m.Load("readView", &x.readView) - m.Load("readCM", &x.readCM) - m.Load("sender", &x.sender) - m.Load("sockOptTimestamp", &x.sockOptTimestamp) - m.Load("timestampValid", &x.timestampValid) - m.Load("timestampNS", &x.timestampNS) - m.Load("sockOptInq", &x.sockOptInq) + +func (x *socketOpsCommon) StateLoad(m state.Source) { + m.Load(0, &x.SendReceiveTimeout) + m.Load(1, &x.Queue) + m.Load(2, &x.family) + m.Load(3, &x.Endpoint) + m.Load(4, &x.skType) + m.Load(5, &x.protocol) + m.Load(6, &x.readViewHasData) + m.Load(7, &x.readView) + m.Load(8, &x.readCM) + m.Load(9, &x.sender) + m.Load(10, &x.sockOptTimestamp) + m.Load(11, &x.timestampValid) + m.Load(12, &x.timestampNS) + m.Load(13, &x.sockOptInq) +} + +func (x *Stack) StateTypeName() string { + return "pkg/sentry/socket/netstack.Stack" +} + +func (x *Stack) StateFields() []string { + return []string{} } func (x *Stack) beforeSave() {} -func (x *Stack) save(m state.Map) { + +func (x *Stack) StateSave(m state.Sink) { x.beforeSave() } -func (x *Stack) load(m state.Map) { +func (x *Stack) StateLoad(m state.Source) { m.AfterLoad(x.afterLoad) } func init() { - state.Register("pkg/sentry/socket/netstack.SocketOperations", (*SocketOperations)(nil), state.Fns{Save: (*SocketOperations).save, Load: (*SocketOperations).load}) - state.Register("pkg/sentry/socket/netstack.socketOpsCommon", (*socketOpsCommon)(nil), state.Fns{Save: (*socketOpsCommon).save, Load: (*socketOpsCommon).load}) - state.Register("pkg/sentry/socket/netstack.Stack", (*Stack)(nil), state.Fns{Save: (*Stack).save, Load: (*Stack).load}) + state.Register((*SocketOperations)(nil)) + state.Register((*socketOpsCommon)(nil)) + state.Register((*Stack)(nil)) } diff --git a/pkg/sentry/socket/socket_state_autogen.go b/pkg/sentry/socket/socket_state_autogen.go index 900c217c7..2865933e9 100644 --- a/pkg/sentry/socket/socket_state_autogen.go +++ b/pkg/sentry/socket/socket_state_autogen.go @@ -6,19 +6,32 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SendReceiveTimeout) StateTypeName() string { + return "pkg/sentry/socket.SendReceiveTimeout" +} + +func (x *SendReceiveTimeout) StateFields() []string { + return []string{ + "send", + "recv", + } +} + func (x *SendReceiveTimeout) beforeSave() {} -func (x *SendReceiveTimeout) save(m state.Map) { + +func (x *SendReceiveTimeout) StateSave(m state.Sink) { x.beforeSave() - m.Save("send", &x.send) - m.Save("recv", &x.recv) + m.Save(0, &x.send) + m.Save(1, &x.recv) } func (x *SendReceiveTimeout) afterLoad() {} -func (x *SendReceiveTimeout) load(m state.Map) { - m.Load("send", &x.send) - m.Load("recv", &x.recv) + +func (x *SendReceiveTimeout) StateLoad(m state.Source) { + m.Load(0, &x.send) + m.Load(1, &x.recv) } func init() { - state.Register("pkg/sentry/socket.SendReceiveTimeout", (*SendReceiveTimeout)(nil), state.Fns{Save: (*SendReceiveTimeout).save, Load: (*SendReceiveTimeout).load}) + state.Register((*SendReceiveTimeout)(nil)) } diff --git a/pkg/sentry/socket/unix/transport/transport_message_list.go b/pkg/sentry/socket/unix/transport/transport_message_list.go index 568cd5871..dda579c27 100644 --- a/pkg/sentry/socket/unix/transport/transport_message_list.go +++ b/pkg/sentry/socket/unix/transport/transport_message_list.go @@ -56,7 +56,7 @@ func (l *messageList) Back() *message { // // NOTE: This is an O(n) operation. func (l *messageList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (messageElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *messageList) Remove(e *message) { if prev != nil { messageElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { messageElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/socket/unix/transport/transport_state_autogen.go b/pkg/sentry/socket/unix/transport/transport_state_autogen.go index b47951498..4b88ea3ae 100644 --- a/pkg/sentry/socket/unix/transport/transport_state_autogen.go +++ b/pkg/sentry/socket/unix/transport/transport_state_autogen.go @@ -6,188 +6,345 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *connectionedEndpoint) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.connectionedEndpoint" +} + +func (x *connectionedEndpoint) StateFields() []string { + return []string{ + "baseEndpoint", + "id", + "idGenerator", + "stype", + "acceptedChan", + } +} + func (x *connectionedEndpoint) beforeSave() {} -func (x *connectionedEndpoint) save(m state.Map) { + +func (x *connectionedEndpoint) StateSave(m state.Sink) { x.beforeSave() var acceptedChan []*connectionedEndpoint = x.saveAcceptedChan() - m.SaveValue("acceptedChan", acceptedChan) - m.Save("baseEndpoint", &x.baseEndpoint) - m.Save("id", &x.id) - m.Save("idGenerator", &x.idGenerator) - m.Save("stype", &x.stype) + m.SaveValue(4, acceptedChan) + m.Save(0, &x.baseEndpoint) + m.Save(1, &x.id) + m.Save(2, &x.idGenerator) + m.Save(3, &x.stype) } func (x *connectionedEndpoint) afterLoad() {} -func (x *connectionedEndpoint) load(m state.Map) { - m.Load("baseEndpoint", &x.baseEndpoint) - m.Load("id", &x.id) - m.Load("idGenerator", &x.idGenerator) - m.Load("stype", &x.stype) - m.LoadValue("acceptedChan", new([]*connectionedEndpoint), func(y interface{}) { x.loadAcceptedChan(y.([]*connectionedEndpoint)) }) + +func (x *connectionedEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.baseEndpoint) + m.Load(1, &x.id) + m.Load(2, &x.idGenerator) + m.Load(3, &x.stype) + m.LoadValue(4, new([]*connectionedEndpoint), func(y interface{}) { x.loadAcceptedChan(y.([]*connectionedEndpoint)) }) +} + +func (x *connectionlessEndpoint) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.connectionlessEndpoint" +} + +func (x *connectionlessEndpoint) StateFields() []string { + return []string{ + "baseEndpoint", + } } func (x *connectionlessEndpoint) beforeSave() {} -func (x *connectionlessEndpoint) save(m state.Map) { + +func (x *connectionlessEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("baseEndpoint", &x.baseEndpoint) + m.Save(0, &x.baseEndpoint) } func (x *connectionlessEndpoint) afterLoad() {} -func (x *connectionlessEndpoint) load(m state.Map) { - m.Load("baseEndpoint", &x.baseEndpoint) + +func (x *connectionlessEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.baseEndpoint) +} + +func (x *queue) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.queue" +} + +func (x *queue) StateFields() []string { + return []string{ + "AtomicRefCount", + "ReaderQueue", + "WriterQueue", + "closed", + "unread", + "used", + "limit", + "dataList", + } } func (x *queue) beforeSave() {} -func (x *queue) save(m state.Map) { + +func (x *queue) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("ReaderQueue", &x.ReaderQueue) - m.Save("WriterQueue", &x.WriterQueue) - m.Save("closed", &x.closed) - m.Save("unread", &x.unread) - m.Save("used", &x.used) - m.Save("limit", &x.limit) - m.Save("dataList", &x.dataList) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.ReaderQueue) + m.Save(2, &x.WriterQueue) + m.Save(3, &x.closed) + m.Save(4, &x.unread) + m.Save(5, &x.used) + m.Save(6, &x.limit) + m.Save(7, &x.dataList) } func (x *queue) afterLoad() {} -func (x *queue) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("ReaderQueue", &x.ReaderQueue) - m.Load("WriterQueue", &x.WriterQueue) - m.Load("closed", &x.closed) - m.Load("unread", &x.unread) - m.Load("used", &x.used) - m.Load("limit", &x.limit) - m.Load("dataList", &x.dataList) + +func (x *queue) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.ReaderQueue) + m.Load(2, &x.WriterQueue) + m.Load(3, &x.closed) + m.Load(4, &x.unread) + m.Load(5, &x.used) + m.Load(6, &x.limit) + m.Load(7, &x.dataList) +} + +func (x *messageList) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.messageList" +} + +func (x *messageList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *messageList) beforeSave() {} -func (x *messageList) save(m state.Map) { + +func (x *messageList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *messageList) afterLoad() {} -func (x *messageList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *messageList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *messageEntry) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.messageEntry" +} + +func (x *messageEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *messageEntry) beforeSave() {} -func (x *messageEntry) save(m state.Map) { + +func (x *messageEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *messageEntry) afterLoad() {} -func (x *messageEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *messageEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *ControlMessages) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.ControlMessages" +} + +func (x *ControlMessages) StateFields() []string { + return []string{ + "Rights", + "Credentials", + } } func (x *ControlMessages) beforeSave() {} -func (x *ControlMessages) save(m state.Map) { + +func (x *ControlMessages) StateSave(m state.Sink) { x.beforeSave() - m.Save("Rights", &x.Rights) - m.Save("Credentials", &x.Credentials) + m.Save(0, &x.Rights) + m.Save(1, &x.Credentials) } func (x *ControlMessages) afterLoad() {} -func (x *ControlMessages) load(m state.Map) { - m.Load("Rights", &x.Rights) - m.Load("Credentials", &x.Credentials) + +func (x *ControlMessages) StateLoad(m state.Source) { + m.Load(0, &x.Rights) + m.Load(1, &x.Credentials) +} + +func (x *message) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.message" +} + +func (x *message) StateFields() []string { + return []string{ + "messageEntry", + "Data", + "Control", + "Address", + } } func (x *message) beforeSave() {} -func (x *message) save(m state.Map) { + +func (x *message) StateSave(m state.Sink) { x.beforeSave() - m.Save("messageEntry", &x.messageEntry) - m.Save("Data", &x.Data) - m.Save("Control", &x.Control) - m.Save("Address", &x.Address) + m.Save(0, &x.messageEntry) + m.Save(1, &x.Data) + m.Save(2, &x.Control) + m.Save(3, &x.Address) } func (x *message) afterLoad() {} -func (x *message) load(m state.Map) { - m.Load("messageEntry", &x.messageEntry) - m.Load("Data", &x.Data) - m.Load("Control", &x.Control) - m.Load("Address", &x.Address) + +func (x *message) StateLoad(m state.Source) { + m.Load(0, &x.messageEntry) + m.Load(1, &x.Data) + m.Load(2, &x.Control) + m.Load(3, &x.Address) +} + +func (x *queueReceiver) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.queueReceiver" +} + +func (x *queueReceiver) StateFields() []string { + return []string{ + "readQueue", + } } func (x *queueReceiver) beforeSave() {} -func (x *queueReceiver) save(m state.Map) { + +func (x *queueReceiver) StateSave(m state.Sink) { x.beforeSave() - m.Save("readQueue", &x.readQueue) + m.Save(0, &x.readQueue) } func (x *queueReceiver) afterLoad() {} -func (x *queueReceiver) load(m state.Map) { - m.Load("readQueue", &x.readQueue) + +func (x *queueReceiver) StateLoad(m state.Source) { + m.Load(0, &x.readQueue) +} + +func (x *streamQueueReceiver) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.streamQueueReceiver" +} + +func (x *streamQueueReceiver) StateFields() []string { + return []string{ + "queueReceiver", + "buffer", + "control", + "addr", + } } func (x *streamQueueReceiver) beforeSave() {} -func (x *streamQueueReceiver) save(m state.Map) { + +func (x *streamQueueReceiver) StateSave(m state.Sink) { x.beforeSave() - m.Save("queueReceiver", &x.queueReceiver) - m.Save("buffer", &x.buffer) - m.Save("control", &x.control) - m.Save("addr", &x.addr) + m.Save(0, &x.queueReceiver) + m.Save(1, &x.buffer) + m.Save(2, &x.control) + m.Save(3, &x.addr) } func (x *streamQueueReceiver) afterLoad() {} -func (x *streamQueueReceiver) load(m state.Map) { - m.Load("queueReceiver", &x.queueReceiver) - m.Load("buffer", &x.buffer) - m.Load("control", &x.control) - m.Load("addr", &x.addr) + +func (x *streamQueueReceiver) StateLoad(m state.Source) { + m.Load(0, &x.queueReceiver) + m.Load(1, &x.buffer) + m.Load(2, &x.control) + m.Load(3, &x.addr) +} + +func (x *connectedEndpoint) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.connectedEndpoint" +} + +func (x *connectedEndpoint) StateFields() []string { + return []string{ + "endpoint", + "writeQueue", + } } func (x *connectedEndpoint) beforeSave() {} -func (x *connectedEndpoint) save(m state.Map) { + +func (x *connectedEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("endpoint", &x.endpoint) - m.Save("writeQueue", &x.writeQueue) + m.Save(0, &x.endpoint) + m.Save(1, &x.writeQueue) } func (x *connectedEndpoint) afterLoad() {} -func (x *connectedEndpoint) load(m state.Map) { - m.Load("endpoint", &x.endpoint) - m.Load("writeQueue", &x.writeQueue) + +func (x *connectedEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.endpoint) + m.Load(1, &x.writeQueue) +} + +func (x *baseEndpoint) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.baseEndpoint" +} + +func (x *baseEndpoint) StateFields() []string { + return []string{ + "Queue", + "passcred", + "receiver", + "connected", + "path", + } } func (x *baseEndpoint) beforeSave() {} -func (x *baseEndpoint) save(m state.Map) { + +func (x *baseEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("Queue", &x.Queue) - m.Save("passcred", &x.passcred) - m.Save("receiver", &x.receiver) - m.Save("connected", &x.connected) - m.Save("path", &x.path) + m.Save(0, &x.Queue) + m.Save(1, &x.passcred) + m.Save(2, &x.receiver) + m.Save(3, &x.connected) + m.Save(4, &x.path) } func (x *baseEndpoint) afterLoad() {} -func (x *baseEndpoint) load(m state.Map) { - m.Load("Queue", &x.Queue) - m.Load("passcred", &x.passcred) - m.Load("receiver", &x.receiver) - m.Load("connected", &x.connected) - m.Load("path", &x.path) + +func (x *baseEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.Queue) + m.Load(1, &x.passcred) + m.Load(2, &x.receiver) + m.Load(3, &x.connected) + m.Load(4, &x.path) } func init() { - state.Register("pkg/sentry/socket/unix/transport.connectionedEndpoint", (*connectionedEndpoint)(nil), state.Fns{Save: (*connectionedEndpoint).save, Load: (*connectionedEndpoint).load}) - state.Register("pkg/sentry/socket/unix/transport.connectionlessEndpoint", (*connectionlessEndpoint)(nil), state.Fns{Save: (*connectionlessEndpoint).save, Load: (*connectionlessEndpoint).load}) - state.Register("pkg/sentry/socket/unix/transport.queue", (*queue)(nil), state.Fns{Save: (*queue).save, Load: (*queue).load}) - state.Register("pkg/sentry/socket/unix/transport.messageList", (*messageList)(nil), state.Fns{Save: (*messageList).save, Load: (*messageList).load}) - state.Register("pkg/sentry/socket/unix/transport.messageEntry", (*messageEntry)(nil), state.Fns{Save: (*messageEntry).save, Load: (*messageEntry).load}) - state.Register("pkg/sentry/socket/unix/transport.ControlMessages", (*ControlMessages)(nil), state.Fns{Save: (*ControlMessages).save, Load: (*ControlMessages).load}) - state.Register("pkg/sentry/socket/unix/transport.message", (*message)(nil), state.Fns{Save: (*message).save, Load: (*message).load}) - state.Register("pkg/sentry/socket/unix/transport.queueReceiver", (*queueReceiver)(nil), state.Fns{Save: (*queueReceiver).save, Load: (*queueReceiver).load}) - state.Register("pkg/sentry/socket/unix/transport.streamQueueReceiver", (*streamQueueReceiver)(nil), state.Fns{Save: (*streamQueueReceiver).save, Load: (*streamQueueReceiver).load}) - state.Register("pkg/sentry/socket/unix/transport.connectedEndpoint", (*connectedEndpoint)(nil), state.Fns{Save: (*connectedEndpoint).save, Load: (*connectedEndpoint).load}) - state.Register("pkg/sentry/socket/unix/transport.baseEndpoint", (*baseEndpoint)(nil), state.Fns{Save: (*baseEndpoint).save, Load: (*baseEndpoint).load}) + state.Register((*connectionedEndpoint)(nil)) + state.Register((*connectionlessEndpoint)(nil)) + state.Register((*queue)(nil)) + state.Register((*messageList)(nil)) + state.Register((*messageEntry)(nil)) + state.Register((*ControlMessages)(nil)) + state.Register((*message)(nil)) + state.Register((*queueReceiver)(nil)) + state.Register((*streamQueueReceiver)(nil)) + state.Register((*connectedEndpoint)(nil)) + state.Register((*baseEndpoint)(nil)) } diff --git a/pkg/sentry/socket/unix/unix_state_autogen.go b/pkg/sentry/socket/unix/unix_state_autogen.go index aa05e7b99..4a3bbc11b 100644 --- a/pkg/sentry/socket/unix/unix_state_autogen.go +++ b/pkg/sentry/socket/unix/unix_state_autogen.go @@ -6,35 +6,62 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SocketOperations) StateTypeName() string { + return "pkg/sentry/socket/unix.SocketOperations" +} + +func (x *SocketOperations) StateFields() []string { + return []string{ + "socketOpsCommon", + } +} + func (x *SocketOperations) beforeSave() {} -func (x *SocketOperations) save(m state.Map) { + +func (x *SocketOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("socketOpsCommon", &x.socketOpsCommon) + m.Save(0, &x.socketOpsCommon) } func (x *SocketOperations) afterLoad() {} -func (x *SocketOperations) load(m state.Map) { - m.Load("socketOpsCommon", &x.socketOpsCommon) + +func (x *SocketOperations) StateLoad(m state.Source) { + m.Load(0, &x.socketOpsCommon) +} + +func (x *socketOpsCommon) StateTypeName() string { + return "pkg/sentry/socket/unix.socketOpsCommon" +} + +func (x *socketOpsCommon) StateFields() []string { + return []string{ + "AtomicRefCount", + "SendReceiveTimeout", + "ep", + "stype", + } } func (x *socketOpsCommon) beforeSave() {} -func (x *socketOpsCommon) save(m state.Map) { + +func (x *socketOpsCommon) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Save("ep", &x.ep) - m.Save("stype", &x.stype) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.SendReceiveTimeout) + m.Save(2, &x.ep) + m.Save(3, &x.stype) } func (x *socketOpsCommon) afterLoad() {} -func (x *socketOpsCommon) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Load("ep", &x.ep) - m.Load("stype", &x.stype) + +func (x *socketOpsCommon) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.SendReceiveTimeout) + m.Load(2, &x.ep) + m.Load(3, &x.stype) } func init() { - state.Register("pkg/sentry/socket/unix.SocketOperations", (*SocketOperations)(nil), state.Fns{Save: (*SocketOperations).save, Load: (*SocketOperations).load}) - state.Register("pkg/sentry/socket/unix.socketOpsCommon", (*socketOpsCommon)(nil), state.Fns{Save: (*socketOpsCommon).save, Load: (*socketOpsCommon).load}) + state.Register((*SocketOperations)(nil)) + state.Register((*socketOpsCommon)(nil)) } |