github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/pkg/tcpip/link/tun/tun_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package tun
     4  
     5  import (
     6  	"github.com/MerlinKodo/gvisor/pkg/state"
     7  )
     8  
     9  func (d *Device) StateTypeName() string {
    10  	return "pkg/tcpip/link/tun.Device"
    11  }
    12  
    13  func (d *Device) StateFields() []string {
    14  	return []string{
    15  		"Queue",
    16  		"endpoint",
    17  		"notifyHandle",
    18  		"flags",
    19  	}
    20  }
    21  
    22  // +checklocksignore
    23  func (d *Device) StateSave(stateSinkObject state.Sink) {
    24  	d.beforeSave()
    25  	stateSinkObject.Save(0, &d.Queue)
    26  	stateSinkObject.Save(1, &d.endpoint)
    27  	stateSinkObject.Save(2, &d.notifyHandle)
    28  	stateSinkObject.Save(3, &d.flags)
    29  }
    30  
    31  func (d *Device) afterLoad() {}
    32  
    33  // +checklocksignore
    34  func (d *Device) StateLoad(stateSourceObject state.Source) {
    35  	stateSourceObject.Load(0, &d.Queue)
    36  	stateSourceObject.Load(1, &d.endpoint)
    37  	stateSourceObject.Load(2, &d.notifyHandle)
    38  	stateSourceObject.Load(3, &d.flags)
    39  }
    40  
    41  func (r *tunEndpointRefs) StateTypeName() string {
    42  	return "pkg/tcpip/link/tun.tunEndpointRefs"
    43  }
    44  
    45  func (r *tunEndpointRefs) StateFields() []string {
    46  	return []string{
    47  		"refCount",
    48  	}
    49  }
    50  
    51  func (r *tunEndpointRefs) beforeSave() {}
    52  
    53  // +checklocksignore
    54  func (r *tunEndpointRefs) StateSave(stateSinkObject state.Sink) {
    55  	r.beforeSave()
    56  	stateSinkObject.Save(0, &r.refCount)
    57  }
    58  
    59  // +checklocksignore
    60  func (r *tunEndpointRefs) StateLoad(stateSourceObject state.Source) {
    61  	stateSourceObject.Load(0, &r.refCount)
    62  	stateSourceObject.AfterLoad(r.afterLoad)
    63  }
    64  
    65  func init() {
    66  	state.Register((*Device)(nil))
    67  	state.Register((*tunEndpointRefs)(nil))
    68  }