mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Allow construction of mount namespace from existing filesystem.
PiperOrigin-RevId: 503260418
This commit is contained in:
committed by
gVisor bot
parent
75ec332fee
commit
7d68beb261
@@ -207,13 +207,20 @@ func (vfs *VirtualFilesystem) NewMountNamespace(ctx context.Context, creds *auth
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return vfs.NewMountNamespaceFrom(ctx, creds, fs, root, opts), nil
|
||||
}
|
||||
|
||||
// NewMountNamespaceFrom constructs a new mount namespace from an existing
|
||||
// filesystem and its root dentry. This is similar to NewMountNamespace, but
|
||||
// uses an existing filesystem instead of constructing a new one.
|
||||
func (vfs *VirtualFilesystem) NewMountNamespaceFrom(ctx context.Context, creds *auth.Credentials, fs *Filesystem, root *Dentry, opts *MountOptions) *MountNamespace {
|
||||
mntns := &MountNamespace{
|
||||
Owner: creds.UserNamespace,
|
||||
mountpoints: make(map[*Dentry]uint32),
|
||||
}
|
||||
mntns.InitRefs()
|
||||
mntns.root = newMount(vfs, fs, root, mntns, opts)
|
||||
return mntns, nil
|
||||
return mntns
|
||||
}
|
||||
|
||||
// NewFilesystem creates a new filesystem object not yet associated with any
|
||||
|
||||
Reference in New Issue
Block a user