Files
visor/pkg/sentry/mm/aio_context_state.go
Ayush RanjanandgVisor bot f3a6c7491e Delete pgalloc.MemoryFileProvider.
The work done in a9af2d309b ("Plumb restore context to afterLoad()") makes
pgalloc.MemoryFileProvider redundant as structs can now easily restore
pgalloc.MemoryFile in stateify's afterLoad() method. This allows structs to
have a pgalloc.MemoryFile field and use that directly, instead of going through
the provided interface.

This cleans up a lot of code and also should be more performant (avoids an
interface method call on many hot paths).

PiperOrigin-RevId: 615258927
2024-03-12 20:06:58 -07:00

32 lines
945 B
Go

// Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package mm
import (
"context"
"gvisor.dev/gvisor/pkg/sentry/pgalloc"
)
// afterLoad is invoked by stateify.
func (aio *AIOContext) afterLoad(context.Context) {
aio.requestReady = make(chan struct{}, 1)
}
// afterLoad is invoked by stateify.
func (m *aioMappable) afterLoad(ctx context.Context) {
m.mf = pgalloc.MemoryFileFromContext(ctx)
}