summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/vfs/resolving_path.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2021-04-21 10:39:29 -0700
committergVisor bot <gvisor-bot@google.com>2021-04-21 10:41:28 -0700
commitc2955339d86437981ce53d2971ce83479ef94028 (patch)
treee68486bf1e193f23d6b3e9ba506c50c073a94a65 /pkg/sentry/vfs/resolving_path.go
parent07a78ecb2918905af030a8cf81ee86ddd1c622c5 (diff)
Automated rollback of changelist 369325957
PiperOrigin-RevId: 369686285
Diffstat (limited to 'pkg/sentry/vfs/resolving_path.go')
-rw-r--r--pkg/sentry/vfs/resolving_path.go27
1 files changed, 1 insertions, 26 deletions
diff --git a/pkg/sentry/vfs/resolving_path.go b/pkg/sentry/vfs/resolving_path.go
index 634c8b097..e4fd55012 100644
--- a/pkg/sentry/vfs/resolving_path.go
+++ b/pkg/sentry/vfs/resolving_path.go
@@ -120,8 +120,6 @@ var resolvingPathPool = sync.Pool{
},
}
-// getResolvingPath gets a new ResolvingPath from the pool. Caller must call
-// ResolvingPath.Release() when done.
func (vfs *VirtualFilesystem) getResolvingPath(creds *auth.Credentials, pop *PathOperation) *ResolvingPath {
rp := resolvingPathPool.Get().(*ResolvingPath)
rp.vfs = vfs
@@ -144,30 +142,7 @@ func (vfs *VirtualFilesystem) getResolvingPath(creds *auth.Credentials, pop *Pat
return rp
}
-// Copy creates another ResolvingPath with the same state as the original.
-// Copies are independent, using the copy does not change the original and
-// vice-versa.
-//
-// Caller must call Resease() when done.
-func (rp *ResolvingPath) Copy() *ResolvingPath {
- copy := resolvingPathPool.Get().(*ResolvingPath)
- *copy = *rp // All fields all shallow copiable.
-
- // Take extra reference for the copy if the original had them.
- if copy.flags&rpflagsHaveStartRef != 0 {
- copy.start.IncRef()
- }
- if copy.flags&rpflagsHaveMountRef != 0 {
- copy.mount.IncRef()
- }
- // Reset error state.
- copy.nextStart = nil
- copy.nextMount = nil
- return copy
-}
-
-// Release decrements references if needed and returns the object to the pool.
-func (rp *ResolvingPath) Release(ctx context.Context) {
+func (vfs *VirtualFilesystem) putResolvingPath(ctx context.Context, rp *ResolvingPath) {
rp.root = VirtualDentry{}
rp.decRefStartAndMount(ctx)
rp.mount = nil