// Caller must hold Session.endpoint lock.
Caller must hold Session.endpoint lock.
// Caller must hold Session . endpoint lock .
func (i *inodeOperations) createEndpointFile(ctx context.Context, dir *fs.Inode, name string, perm fs.FilePermissions, fileType p9.FileMode) (fs.StableAttr, *inodeOperations, error) {
	_, dirClone, err := i.fileState.file.walk(ctx, nil)
	if err != nil {
		return fs.StableAttr{}, nil, err
	}
	defer dirClone.close(ctx)
	owner := fs.FileOwnerFromContext(ctx)
	hostFile, err := dirClone.create(ctx, name, p9.ReadWrite, p9.FileMode(perm.LinuxMode()), p9.UID(owner.UID), p9.GID(owner.GID))
	if err != nil {
		return fs.StableAttr{}, nil, err
	}
	hostFile.Close()
	i.touchModificationAndStatusChangeTime(ctx, dir)
	qid, mask, attr, err := getattr(ctx, dirClone)
	if err != nil {
		return fs.StableAttr{}, nil, err
	}
	_, unopened, err := i.fileState.file.walk(ctx, []string{name})
	if err != nil {
		return fs.StableAttr{}, nil, err
	}
	attr.Mode = changeType(attr.Mode, fileType)
	sattr, iops := newInodeOperations(ctx, i.fileState.s, unopened, qid, mask, attr)
	return sattr, iops, nil
}
func ( i * inodeOperations ) createEndpointFile ( ctx context . Context , dir * fs . Inode , name string , perm fs . FilePermissions , fileType p9 . FileMode ) ( fs . StableAttr , * inodeOperations , error ) { _ , dirClone , err := i . fileState . file . walk ( ctx , nil ) if err != nil { return fs . StableAttr { } , nil , err } defer dirClone . close ( ctx ) owner := fs . FileOwnerFromContext ( ctx ) hostFile , err := dirClone . create ( ctx , name , p9 . ReadWrite , p9 . FileMode ( perm . LinuxMode ( ) ) , p9 . UID ( owner . UID ) , p9 . GID ( owner . GID ) ) if err != nil { return fs . StableAttr { } , nil , err } hostFile . Close ( ) i . touchModificationAndStatusChangeTime ( ctx , dir ) qid , mask , attr , err := getattr ( ctx , dirClone ) if err != nil { return fs . StableAttr { } , nil , err } _ , unopened , err := i . fileState . file . walk ( ctx , [ ] string { name } ) if err != nil { return fs . StableAttr { } , nil , err } attr . Mode = changeType ( attr . Mode , fileType ) sattr , iops := newInodeOperations ( ctx , i . fileState . s , unopened , qid , mask , attr ) return sattr , iops , nil }
Caller must hold Session.endpoint lock.
Caller must hold Session . endpoint lock .
// We're not going to use dirClone after return. // Create a regular file in the gofer and then mark it as a socket by // adding this inode key in the 'overrides' map. // We're not going to use this file. // Get the attributes of the file to create inode key. // Get an unopened p9.File for the file we created so that it can be // cloned and re-opened multiple times after creation. // Construct new inode with file type overridden.