| 1 |
|
| 2 |
|
| 3 |
package hostarch |
| 4 |
|
| 5 |
import ( |
| 6 |
"inet.af/netstack/state" |
| 7 |
) |
| 8 |
|
| 9 |
func (a *AccessType) StateTypeName() string { |
| 10 |
return "pkg/hostarch.AccessType" |
| 11 |
} |
| 12 |
|
| 13 |
func (a *AccessType) StateFields() []string { |
| 14 |
return []string{ |
| 15 |
"Read", |
| 16 |
"Write", |
| 17 |
"Execute", |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
func (a *AccessType) beforeSave() {} |
| 22 |
|
| 23 |
|
| 24 |
func (a *AccessType) StateSave(stateSinkObject state.Sink) { |
| 25 |
a.beforeSave() |
| 26 |
stateSinkObject.Save(0, &a.Read) |
| 27 |
stateSinkObject.Save(1, &a.Write) |
| 28 |
stateSinkObject.Save(2, &a.Execute) |
| 29 |
} |
| 30 |
|
| 31 |
func (a *AccessType) afterLoad() {} |
| 32 |
|
| 33 |
|
| 34 |
func (a *AccessType) StateLoad(stateSourceObject state.Source) { |
| 35 |
stateSourceObject.Load(0, &a.Read) |
| 36 |
stateSourceObject.Load(1, &a.Write) |
| 37 |
stateSourceObject.Load(2, &a.Execute) |
| 38 |
} |
| 39 |
|
| 40 |
func (v *Addr) StateTypeName() string { |
| 41 |
return "pkg/hostarch.Addr" |
| 42 |
} |
| 43 |
|
| 44 |
func (v *Addr) StateFields() []string { |
| 45 |
return nil |
| 46 |
} |
| 47 |
|
| 48 |
func (r *AddrRange) StateTypeName() string { |
| 49 |
return "pkg/hostarch.AddrRange" |
| 50 |
} |
| 51 |
|
| 52 |
func (r *AddrRange) StateFields() []string { |
| 53 |
return []string{ |
| 54 |
"Start", |
| 55 |
"End", |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
func (r *AddrRange) beforeSave() {} |
| 60 |
|
| 61 |
|
| 62 |
func (r *AddrRange) StateSave(stateSinkObject state.Sink) { |
| 63 |
r.beforeSave() |
| 64 |
stateSinkObject.Save(0, &r.Start) |
| 65 |
stateSinkObject.Save(1, &r.End) |
| 66 |
} |
| 67 |
|
| 68 |
func (r *AddrRange) afterLoad() {} |
| 69 |
|
| 70 |
|
| 71 |
func (r *AddrRange) StateLoad(stateSourceObject state.Source) { |
| 72 |
stateSourceObject.Load(0, &r.Start) |
| 73 |
stateSourceObject.Load(1, &r.End) |
| 74 |
} |
| 75 |
|
| 76 |
func init() { |
| 77 |
state.Register((*AccessType)(nil)) |
| 78 |
state.Register((*Addr)(nil)) |
| 79 |
state.Register((*AddrRange)(nil)) |
| 80 |
} |