gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/sentry/devices/nvproxy/save_restore_impl.go (about)

     1  // Copyright 2023 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  //go:build !false
    16  // +build !false
    17  
    18  package nvproxy
    19  
    20  import (
    21  	goContext "context"
    22  )
    23  
    24  func (nvp *nvproxy) beforeSaveImpl() {
    25  	nvp.objsLock()
    26  	defer nvp.objsUnlock()
    27  	if len(nvp.clients) != 0 {
    28  		panic("can't save with live nvproxy clients")
    29  	}
    30  }
    31  
    32  func (nvp *nvproxy) afterLoadImpl(goContext.Context) {
    33  	// no-op
    34  }
    35  
    36  func (fd *frontendFD) beforeSaveImpl() {
    37  	panic("nvproxy.frontendFD is not saveable")
    38  }
    39  
    40  func (fd *frontendFD) afterLoadImpl(goContext.Context) {
    41  	panic("nvproxy.frontendFD is not restorable")
    42  }
    43  
    44  func (fd *uvmFD) beforeSaveImpl() {
    45  	panic("nvproxy.uvmFD is not saveable")
    46  }
    47  
    48  func (fd *uvmFD) afterLoadImpl(goContext.Context) {
    49  	panic("nvproxy.uvmFD is not restorable")
    50  }