func (fs *PseudoFS) Chmod(name string, mode os.FileMode) error {
	path := fs.path(name)
	if isDir(path) {
		return os.Chmod(path, mode)
	}
	path += metafileExt
	for _, of := range fs.files {
		if of.name == name {
			of.m.Mode = mode
			of.m.ModTime = time.Now()
			return nil
		}
	}
	m, err := renter.ReadMetaFile(path)
	if err != nil {
		return fmt.Errorf("chmod %v: %w", path, err)
	}
	m.Mode = mode
	m.ModTime = time.Now()
	if err := renter.WriteMetaFile(path, m); err != nil {
		return fmt.Errorf("chmod %v: %w", path, err)
	}
	return nil
}
Chmod changes the mode of the named file to mode.
package renterutil  
import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"strings"
	"sync"
	"time"
	"go.sia.tech/siad/crypto"
	"lukechampine.com/us/hostdb"
	"lukechampine.com/us/renter"
)
const metafileExt = ".usa"
var ErrInvalidFileDescriptor = errors.New("invalid file descriptor")
type pseudoFileInfo struct {
	name string
	m    renter.MetaIndex
}
func (i pseudoFileInfo) Name() string       { return i.name }
func (i pseudoFileInfo) Size() int64        { return i.m.Filesize }
func (i pseudoFileInfo) Mode() os.FileMode  { return i.m.Mode }
func (i pseudoFileInfo) ModTime() time.Time { return i.m.ModTime }
func (i pseudoFileInfo) IsDir() bool        { return false }
func (i pseudoFileInfo) Sys() interface{}   { return i.m }
type PseudoFS struct {
	root           string
	curFD          int
	files          map[int]*openMetaFile
	dirs           map[int]*os.File
	hosts          *HostSet
	sectors        map[hostdb.HostPublicKey]*renter.SectorBuilder
	lastCommitTime time.Time
	mu             sync.RWMutex
}
func (fs *PseudoFS) path(name string) string {
	return filepath.Join(fs.root, name)
}
func isDir(path string) bool {
	stat, err := os.Stat(path)
	return err == nil && stat.IsDir()
}
func exists(path string) bool {
	_, err := os.Stat(path)
	return !os.IsNotExist(err)
}