func (f *Filesystem) Mount(ctx context.Context, _ string, flags fs.MountSourceFlags, data string, _ interface{}) (*fs.Inode, error) {
	// Parse generic comma-separated key=value options.
	options := fs.GenericMountSourceOptions(data)

	// Grab the whitelist if one was specified.
	// TODO(edahlgren/mpratt/hzy): require another option "testonly" in order to allow
	// no whitelist.
	if wl, ok := options[whitelistKey]; ok {
		f.paths = strings.Split(wl, "|")
		delete(options, whitelistKey)
	}

	// If the rootPath was set, use it. Othewise default to the root of the
	// host fs.
	rootPath := "/"
	if rp, ok := options[rootPathKey]; ok {
		rootPath = rp
		delete(options, rootPathKey)

		// We must relativize the whitelisted paths to the new root.
		for i, p := range f.paths {
			rel, err := filepath.Rel(rootPath, p)
			if err != nil {
				return nil, fmt.Errorf("whitelist path %q must be a child of root path %q", p, rootPath)
			}
			f.paths[i] = path.Join("/", rel)
		}
	}
	fd, err := open(nil, rootPath)
	if err != nil {
		return nil, fmt.Errorf("failed to find root: %v", err)
	}

	var dontTranslateOwnership bool
	if v, ok := options[dontTranslateOwnershipKey]; ok {
		b, err := strconv.ParseBool(v)
		if err != nil {
			return nil, fmt.Errorf("invalid value for %q: %v", dontTranslateOwnershipKey, err)
		}
		dontTranslateOwnership = b
		delete(options, dontTranslateOwnershipKey)
	}

	// Fail if the caller passed us more options than we know about.
	if len(options) > 0 {
		return nil, fmt.Errorf("unsupported mount options: %v", options)
	}

	// The mounting EUID/EGID will be cached by this file system. This will
	// be used to assign ownership to files that we own.
	owner := fs.FileOwnerFromContext(ctx)

	// Construct the host file system mount and inode.
	msrc := newMountSource(ctx, rootPath, owner, f, flags, dontTranslateOwnership)
	return newInode(ctx, msrc, fd, false /* saveable */, false /* donated */)
}
// Mount returns an fs.Inode exposing the host file system.  It is intended to be locked
// down in PreExec below.
Mount returns an fs.Inode exposing the host file system.  It is intended to be locked
down in PreExec below.
// Mount returns an fs . Inode exposing the host file system . It is intended to be locked // down in PreExec below .
func (f *Filesystem) Mount(ctx context.Context, _ string, flags fs.MountSourceFlags, data string, _ interface{}) (*fs.Inode, error) {
	options := fs.GenericMountSourceOptions(data)
	if wl, ok := options[whitelistKey]; ok {
		f.paths = strings.Split(wl, "|")
		delete(options, whitelistKey)
	}
	rootPath := "/"
	if rp, ok := options[rootPathKey]; ok {
		rootPath = rp
		delete(options, rootPathKey)
		for i, p := range f.paths {
			rel, err := filepath.Rel(rootPath, p)
			if err != nil {
				return nil, fmt.Errorf("whitelist path %q must be a child of root path %q", p, rootPath)
			}
			f.paths[i] = path.Join("/", rel)
		}
	}
	fd, err := open(nil, rootPath)
	if err != nil {
		return nil, fmt.Errorf("failed to find root: %v", err)
	}
	var dontTranslateOwnership bool
	if v, ok := options[dontTranslateOwnershipKey]; ok {
		b, err := strconv.ParseBool(v)
		if err != nil {
			return nil, fmt.Errorf("invalid value for %q: %v", dontTranslateOwnershipKey, err)
		}
		dontTranslateOwnership = b
		delete(options, dontTranslateOwnershipKey)
	}
	if len(options) > 0 {
		return nil, fmt.Errorf("unsupported mount options: %v", options)
	}
	owner := fs.FileOwnerFromContext(ctx)
	msrc := newMountSource(ctx, rootPath, owner, f, flags, dontTranslateOwnership)
	return newInode(ctx, msrc, fd, false , false )
}
func ( f * Filesystem ) Mount ( ctx context . Context , _ string , flags fs . MountSourceFlags , data string , _ interface { } ) ( * fs . Inode , error ) { options := fs . GenericMountSourceOptions ( data ) if wl , ok := options [ whitelistKey ] ; ok { f . paths = strings . Split ( wl , " " ) delete ( options , whitelistKey ) } rootPath := " " if rp , ok := options [ rootPathKey ] ; ok { rootPath = rp delete ( options , rootPathKey ) for i , p := range f . paths { rel , err := filepath . Rel ( rootPath , p ) if err != nil { return nil , fmt . Errorf ( " " , p , rootPath ) } f . paths [ i ] = path . Join ( " " , rel ) } } fd , err := open ( nil , rootPath ) if err != nil { return nil , fmt . Errorf ( " " , err ) } var dontTranslateOwnership bool if v , ok := options [ dontTranslateOwnershipKey ] ; ok { b , err := strconv . ParseBool ( v ) if err != nil { return nil , fmt . Errorf ( " " , dontTranslateOwnershipKey , err ) } dontTranslateOwnership = b delete ( options , dontTranslateOwnershipKey ) } if len ( options ) > 0 { return nil , fmt . Errorf ( " " , options ) } owner := fs . FileOwnerFromContext ( ctx ) msrc := newMountSource ( ctx , rootPath , owner , f , flags , dontTranslateOwnership ) return newInode ( ctx , msrc , fd , false , false ) }
Mount returns an fs.Inode exposing the host file system.
Mount returns an fs . Inode exposing the host file system .
// Parse generic comma-separated key=value options. // Grab the whitelist if one was specified. // TODO(edahlgren/mpratt/hzy): require another option "testonly" in order to allow // no whitelist. // If the rootPath was set, use it. Othewise default to the root of the // host fs. // We must relativize the whitelisted paths to the new root. // Fail if the caller passed us more options than we know about. // The mounting EUID/EGID will be cached by this file system. This will // be used to assign ownership to files that we own. // Construct the host file system mount and inode. /* saveable */ /* donated */