github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/fsimpl/host/host_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package host
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/metacubex/gvisor/pkg/state"
     9  )
    10  
    11  func (v *virtualOwner) StateTypeName() string {
    12  	return "pkg/sentry/fsimpl/host.virtualOwner"
    13  }
    14  
    15  func (v *virtualOwner) StateFields() []string {
    16  	return []string{
    17  		"enabled",
    18  		"uid",
    19  		"gid",
    20  		"mode",
    21  	}
    22  }
    23  
    24  func (v *virtualOwner) beforeSave() {}
    25  
    26  // +checklocksignore
    27  func (v *virtualOwner) StateSave(stateSinkObject state.Sink) {
    28  	v.beforeSave()
    29  	stateSinkObject.Save(0, &v.enabled)
    30  	stateSinkObject.Save(1, &v.uid)
    31  	stateSinkObject.Save(2, &v.gid)
    32  	stateSinkObject.Save(3, &v.mode)
    33  }
    34  
    35  func (v *virtualOwner) afterLoad(context.Context) {}
    36  
    37  // +checklocksignore
    38  func (v *virtualOwner) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    39  	stateSourceObject.Load(0, &v.enabled)
    40  	stateSourceObject.Load(1, &v.uid)
    41  	stateSourceObject.Load(2, &v.gid)
    42  	stateSourceObject.Load(3, &v.mode)
    43  }
    44  
    45  func (i *inode) StateTypeName() string {
    46  	return "pkg/sentry/fsimpl/host.inode"
    47  }
    48  
    49  func (i *inode) StateFields() []string {
    50  	return []string{
    51  		"CachedMappable",
    52  		"InodeNoStatFS",
    53  		"InodeAnonymous",
    54  		"InodeNotDirectory",
    55  		"InodeNotSymlink",
    56  		"InodeTemporary",
    57  		"InodeWatches",
    58  		"locks",
    59  		"inodeRefs",
    60  		"restoreKey",
    61  		"ino",
    62  		"ftype",
    63  		"epollable",
    64  		"seekable",
    65  		"isTTY",
    66  		"savable",
    67  		"readonly",
    68  		"queue",
    69  		"virtualOwner",
    70  		"haveBuf",
    71  		"buf",
    72  	}
    73  }
    74  
    75  // +checklocksignore
    76  func (i *inode) StateSave(stateSinkObject state.Sink) {
    77  	i.beforeSave()
    78  	stateSinkObject.Save(0, &i.CachedMappable)
    79  	stateSinkObject.Save(1, &i.InodeNoStatFS)
    80  	stateSinkObject.Save(2, &i.InodeAnonymous)
    81  	stateSinkObject.Save(3, &i.InodeNotDirectory)
    82  	stateSinkObject.Save(4, &i.InodeNotSymlink)
    83  	stateSinkObject.Save(5, &i.InodeTemporary)
    84  	stateSinkObject.Save(6, &i.InodeWatches)
    85  	stateSinkObject.Save(7, &i.locks)
    86  	stateSinkObject.Save(8, &i.inodeRefs)
    87  	stateSinkObject.Save(9, &i.restoreKey)
    88  	stateSinkObject.Save(10, &i.ino)
    89  	stateSinkObject.Save(11, &i.ftype)
    90  	stateSinkObject.Save(12, &i.epollable)
    91  	stateSinkObject.Save(13, &i.seekable)
    92  	stateSinkObject.Save(14, &i.isTTY)
    93  	stateSinkObject.Save(15, &i.savable)
    94  	stateSinkObject.Save(16, &i.readonly)
    95  	stateSinkObject.Save(17, &i.queue)
    96  	stateSinkObject.Save(18, &i.virtualOwner)
    97  	stateSinkObject.Save(19, &i.haveBuf)
    98  	stateSinkObject.Save(20, &i.buf)
    99  }
   100  
   101  // +checklocksignore
   102  func (i *inode) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   103  	stateSourceObject.Load(0, &i.CachedMappable)
   104  	stateSourceObject.Load(1, &i.InodeNoStatFS)
   105  	stateSourceObject.Load(2, &i.InodeAnonymous)
   106  	stateSourceObject.Load(3, &i.InodeNotDirectory)
   107  	stateSourceObject.Load(4, &i.InodeNotSymlink)
   108  	stateSourceObject.Load(5, &i.InodeTemporary)
   109  	stateSourceObject.Load(6, &i.InodeWatches)
   110  	stateSourceObject.Load(7, &i.locks)
   111  	stateSourceObject.Load(8, &i.inodeRefs)
   112  	stateSourceObject.Load(9, &i.restoreKey)
   113  	stateSourceObject.Load(10, &i.ino)
   114  	stateSourceObject.Load(11, &i.ftype)
   115  	stateSourceObject.Load(12, &i.epollable)
   116  	stateSourceObject.Load(13, &i.seekable)
   117  	stateSourceObject.Load(14, &i.isTTY)
   118  	stateSourceObject.Load(15, &i.savable)
   119  	stateSourceObject.Load(16, &i.readonly)
   120  	stateSourceObject.Load(17, &i.queue)
   121  	stateSourceObject.Load(18, &i.virtualOwner)
   122  	stateSourceObject.Load(19, &i.haveBuf)
   123  	stateSourceObject.Load(20, &i.buf)
   124  	stateSourceObject.AfterLoad(func() { i.afterLoad(ctx) })
   125  }
   126  
   127  func (f *filesystemType) StateTypeName() string {
   128  	return "pkg/sentry/fsimpl/host.filesystemType"
   129  }
   130  
   131  func (f *filesystemType) StateFields() []string {
   132  	return []string{}
   133  }
   134  
   135  func (f *filesystemType) beforeSave() {}
   136  
   137  // +checklocksignore
   138  func (f *filesystemType) StateSave(stateSinkObject state.Sink) {
   139  	f.beforeSave()
   140  }
   141  
   142  func (f *filesystemType) afterLoad(context.Context) {}
   143  
   144  // +checklocksignore
   145  func (f *filesystemType) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   146  }
   147  
   148  func (fs *filesystem) StateTypeName() string {
   149  	return "pkg/sentry/fsimpl/host.filesystem"
   150  }
   151  
   152  func (fs *filesystem) StateFields() []string {
   153  	return []string{
   154  		"Filesystem",
   155  		"devMinor",
   156  	}
   157  }
   158  
   159  func (fs *filesystem) beforeSave() {}
   160  
   161  // +checklocksignore
   162  func (fs *filesystem) StateSave(stateSinkObject state.Sink) {
   163  	fs.beforeSave()
   164  	stateSinkObject.Save(0, &fs.Filesystem)
   165  	stateSinkObject.Save(1, &fs.devMinor)
   166  }
   167  
   168  func (fs *filesystem) afterLoad(context.Context) {}
   169  
   170  // +checklocksignore
   171  func (fs *filesystem) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   172  	stateSourceObject.Load(0, &fs.Filesystem)
   173  	stateSourceObject.Load(1, &fs.devMinor)
   174  }
   175  
   176  func (f *fileDescription) StateTypeName() string {
   177  	return "pkg/sentry/fsimpl/host.fileDescription"
   178  }
   179  
   180  func (f *fileDescription) StateFields() []string {
   181  	return []string{
   182  		"vfsfd",
   183  		"FileDescriptionDefaultImpl",
   184  		"LockFD",
   185  		"inode",
   186  		"offset",
   187  	}
   188  }
   189  
   190  func (f *fileDescription) beforeSave() {}
   191  
   192  // +checklocksignore
   193  func (f *fileDescription) StateSave(stateSinkObject state.Sink) {
   194  	f.beforeSave()
   195  	stateSinkObject.Save(0, &f.vfsfd)
   196  	stateSinkObject.Save(1, &f.FileDescriptionDefaultImpl)
   197  	stateSinkObject.Save(2, &f.LockFD)
   198  	stateSinkObject.Save(3, &f.inode)
   199  	stateSinkObject.Save(4, &f.offset)
   200  }
   201  
   202  func (f *fileDescription) afterLoad(context.Context) {}
   203  
   204  // +checklocksignore
   205  func (f *fileDescription) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   206  	stateSourceObject.Load(0, &f.vfsfd)
   207  	stateSourceObject.Load(1, &f.FileDescriptionDefaultImpl)
   208  	stateSourceObject.Load(2, &f.LockFD)
   209  	stateSourceObject.Load(3, &f.inode)
   210  	stateSourceObject.Load(4, &f.offset)
   211  }
   212  
   213  func (r *inodeRefs) StateTypeName() string {
   214  	return "pkg/sentry/fsimpl/host.inodeRefs"
   215  }
   216  
   217  func (r *inodeRefs) StateFields() []string {
   218  	return []string{
   219  		"refCount",
   220  	}
   221  }
   222  
   223  func (r *inodeRefs) beforeSave() {}
   224  
   225  // +checklocksignore
   226  func (r *inodeRefs) StateSave(stateSinkObject state.Sink) {
   227  	r.beforeSave()
   228  	stateSinkObject.Save(0, &r.refCount)
   229  }
   230  
   231  // +checklocksignore
   232  func (r *inodeRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   233  	stateSourceObject.Load(0, &r.refCount)
   234  	stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) })
   235  }
   236  
   237  func (t *TTYFileDescription) StateTypeName() string {
   238  	return "pkg/sentry/fsimpl/host.TTYFileDescription"
   239  }
   240  
   241  func (t *TTYFileDescription) StateFields() []string {
   242  	return []string{
   243  		"fileDescription",
   244  		"session",
   245  		"fgProcessGroup",
   246  		"termios",
   247  	}
   248  }
   249  
   250  func (t *TTYFileDescription) beforeSave() {}
   251  
   252  // +checklocksignore
   253  func (t *TTYFileDescription) StateSave(stateSinkObject state.Sink) {
   254  	t.beforeSave()
   255  	stateSinkObject.Save(0, &t.fileDescription)
   256  	stateSinkObject.Save(1, &t.session)
   257  	stateSinkObject.Save(2, &t.fgProcessGroup)
   258  	stateSinkObject.Save(3, &t.termios)
   259  }
   260  
   261  func (t *TTYFileDescription) afterLoad(context.Context) {}
   262  
   263  // +checklocksignore
   264  func (t *TTYFileDescription) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   265  	stateSourceObject.Load(0, &t.fileDescription)
   266  	stateSourceObject.Load(1, &t.session)
   267  	stateSourceObject.Load(2, &t.fgProcessGroup)
   268  	stateSourceObject.Load(3, &t.termios)
   269  }
   270  
   271  func init() {
   272  	state.Register((*virtualOwner)(nil))
   273  	state.Register((*inode)(nil))
   274  	state.Register((*filesystemType)(nil))
   275  	state.Register((*filesystem)(nil))
   276  	state.Register((*fileDescription)(nil))
   277  	state.Register((*inodeRefs)(nil))
   278  	state.Register((*TTYFileDescription)(nil))
   279  }