Documentation ¶
Overview ¶
Package fsutil provides utilities for implementing fs.InodeOperations and fs.FileOperations:
- For embeddable utilities, see inode.go and file.go.
- For fs.Inodes that require a page cache to be memory mapped, see inode_cache.go.
- For fs.Files that implement fs.HandleOps, see handle.go.
- For anon fs.Inodes, see anon.go.
Index ¶
- func GenericConfigureMMap(file *fs.File, m memmap.Mappable, opts *memmap.MMapOpts) error
- func NewHandle(ctx context.Context, dirent *fs.Dirent, flags fs.FileFlags, ...) *fs.File
- func NewSimpleInodeOperations(i InodeSimpleAttributes) fs.InodeOperations
- func SeekWithDirCursor(ctx context.Context, file *fs.File, whence fs.SeekWhence, offset int64, ...) (int64, error)
- func SyncDirty(ctx context.Context, mr memmap.MappableRange, cache *FileRangeSet, ...) error
- func SyncDirtyAll(ctx context.Context, cache *FileRangeSet, dirty *DirtySet, max uint64, ...) error
- type CachedFileObject
- type CachingInodeOperations
- func (c *CachingInodeOperations) AddMapping(ctx context.Context, ms memmap.MappingSpace, ar usermem.AddrRange, ...) error
- func (c *CachingInodeOperations) CopyMapping(ctx context.Context, ms memmap.MappingSpace, srcAR, dstAR usermem.AddrRange, ...) error
- func (c *CachingInodeOperations) DecLinks(ctx context.Context)
- func (c *CachingInodeOperations) DecRef(fr platform.FileRange)
- func (c *CachingInodeOperations) IncLinks(ctx context.Context)
- func (c *CachingInodeOperations) IncRef(fr platform.FileRange)
- func (c *CachingInodeOperations) InvalidateUnsavable(ctx context.Context) error
- func (c *CachingInodeOperations) MapInternal(fr platform.FileRange, at usermem.AccessType) (safemem.BlockSeq, error)
- func (c *CachingInodeOperations) MapInto(as platform.AddressSpace, addr usermem.Addr, fr platform.FileRange, ...) error
- func (c *CachingInodeOperations) Read(ctx context.Context, file *fs.File, dst usermem.IOSequence, offset int64) (int64, error)
- func (c *CachingInodeOperations) Release()
- func (c *CachingInodeOperations) RemoveMapping(ctx context.Context, ms memmap.MappingSpace, ar usermem.AddrRange, ...)
- func (c *CachingInodeOperations) SetOwner(ctx context.Context, inode *fs.Inode, owner fs.FileOwner) error
- func (c *CachingInodeOperations) SetPermissions(ctx context.Context, inode *fs.Inode, perms fs.FilePermissions) bool
- func (c *CachingInodeOperations) SetTimestamps(ctx context.Context, inode *fs.Inode, ts fs.TimeSpec) error
- func (c *CachingInodeOperations) TouchAccessTime(ctx context.Context, inode *fs.Inode)
- func (c *CachingInodeOperations) TouchModificationTime(ctx context.Context)
- func (c *CachingInodeOperations) Translate(ctx context.Context, required, optional memmap.MappableRange, ...) ([]memmap.Translation, error)
- func (c *CachingInodeOperations) Truncate(ctx context.Context, inode *fs.Inode, size int64) error
- func (c *CachingInodeOperations) UnstableAttr(ctx context.Context, inode *fs.Inode) (fs.UnstableAttr, error)
- func (c *CachingInodeOperations) Write(ctx context.Context, src usermem.IOSequence, offset int64) (int64, error)
- func (c *CachingInodeOperations) WriteOut(ctx context.Context, inode *fs.Inode) error
- type DeprecatedFileOperations
- func (DeprecatedFileOperations) DeprecatedFlush() error
- func (DeprecatedFileOperations) DeprecatedFsync() error
- func (DeprecatedFileOperations) DeprecatedMappable(context.Context, *fs.Inode) (memmap.Mappable, bool)
- func (DeprecatedFileOperations) DeprecatedPreadv(context.Context, usermem.IOSequence, int64) (int64, error)
- func (DeprecatedFileOperations) DeprecatedPwritev(context.Context, usermem.IOSequence, int64) (int64, error)
- func (DeprecatedFileOperations) DeprecatedReaddir(context.Context, *fs.DirCtx, int) (int, error)
- func (DeprecatedFileOperations) EventRegister(*waiter.Entry, waiter.EventMask)
- func (DeprecatedFileOperations) EventUnregister(*waiter.Entry)
- func (DeprecatedFileOperations) Readiness(waiter.EventMask) waiter.EventMask
- type DirFileOperations
- func (dfo *DirFileOperations) IterateDir(ctx context.Context, dirCtx *fs.DirCtx, offset int) (int, error)
- func (*DirFileOperations) Read(context.Context, *fs.File, usermem.IOSequence, int64) (int64, error)
- func (dfo *DirFileOperations) Readdir(ctx context.Context, file *fs.File, serializer fs.DentrySerializer) (int64, error)
- func (*DirFileOperations) Write(context.Context, *fs.File, usermem.IOSequence, int64) (int64, error)
- type DirtyInfo
- type GenericSeek
- type Handle
- func (h *Handle) ConfigureMMap(ctx context.Context, file *fs.File, opts *memmap.MMapOpts) error
- func (h *Handle) EventRegister(e *waiter.Entry, mask waiter.EventMask)
- func (h *Handle) EventUnregister(e *waiter.Entry)
- func (h *Handle) Flush(context.Context, *fs.File) error
- func (h *Handle) Fsync(ctx context.Context, file *fs.File, start int64, end int64, ...) error
- func (h *Handle) IterateDir(ctx context.Context, dirCtx *fs.DirCtx, offset int) (int, error)
- func (h *Handle) Read(ctx context.Context, file *fs.File, dst usermem.IOSequence, offset int64) (int64, error)
- func (h *Handle) Readdir(ctx context.Context, file *fs.File, serializer fs.DentrySerializer) (int64, error)
- func (h *Handle) Readiness(mask waiter.EventMask) waiter.EventMask
- func (h *Handle) Seek(ctx context.Context, file *fs.File, whence fs.SeekWhence, offset int64) (int64, error)
- func (h *Handle) Write(ctx context.Context, file *fs.File, src usermem.IOSequence, offset int64) (int64, error)
- type HostFileMapper
- type InMemoryAttributes
- func (i *InMemoryAttributes) Getxattr(name string) ([]byte, error)
- func (i *InMemoryAttributes) Listxattr() (map[string]struct{}, error)
- func (i *InMemoryAttributes) SetOwner(ctx context.Context, owner fs.FileOwner) error
- func (i *InMemoryAttributes) SetPermissions(ctx context.Context, p fs.FilePermissions) bool
- func (i *InMemoryAttributes) SetTimestamps(ctx context.Context, ts fs.TimeSpec) error
- func (i *InMemoryAttributes) Setxattr(name string, value []byte) error
- func (i *InMemoryAttributes) TouchAccessTime(ctx context.Context)
- func (i *InMemoryAttributes) TouchModificationTime(ctx context.Context)
- func (i *InMemoryAttributes) TouchStatusChangeTime(ctx context.Context)
- type InodeNoExtendedAttributes
- type InodeNotDirectory
- func (InodeNotDirectory) Bind(context.Context, *fs.Inode, string, unix.BoundEndpoint, fs.FilePermissions) error
- func (InodeNotDirectory) Create(context.Context, *fs.Inode, string, fs.FileFlags, fs.FilePermissions) (*fs.File, error)
- func (InodeNotDirectory) CreateDirectory(context.Context, *fs.Inode, string, fs.FilePermissions) error
- func (InodeNotDirectory) CreateFifo(context.Context, *fs.Inode, string, fs.FilePermissions) error
- func (InodeNotDirectory) CreateHardLink(context.Context, *fs.Inode, *fs.Inode, string) error
- func (InodeNotDirectory) CreateLink(context.Context, *fs.Inode, string, string) error
- func (InodeNotDirectory) Lookup(context.Context, *fs.Inode, string) (*fs.Dirent, error)
- func (InodeNotDirectory) Remove(context.Context, *fs.Inode, string) error
- func (InodeNotDirectory) RemoveDirectory(context.Context, *fs.Inode, string) error
- type InodeNotOpenable
- type InodeNotRenameable
- type InodeNotSocket
- type InodeNotSymlink
- type InodeNotVirtual
- type InodeSimpleAttributes
- func (*InodeSimpleAttributes) AddLink()
- func (i *InodeSimpleAttributes) Check(ctx context.Context, inode *fs.Inode, p fs.PermMask) bool
- func (*InodeSimpleAttributes) DropLink()
- func (i *InodeSimpleAttributes) NotifyStatusChange(ctx context.Context)
- func (i *InodeSimpleAttributes) Release(context.Context)
- func (*InodeSimpleAttributes) SetOwner(context.Context, *fs.Inode, fs.FileOwner) error
- func (*InodeSimpleAttributes) SetPermissions(context.Context, *fs.Inode, fs.FilePermissions) bool
- func (*InodeSimpleAttributes) SetTimestamps(context.Context, *fs.Inode, fs.TimeSpec) error
- func (i *InodeSimpleAttributes) StatFS(context.Context) (fs.Info, error)
- func (*InodeSimpleAttributes) Truncate(context.Context, *fs.Inode, int64) error
- func (i *InodeSimpleAttributes) UnstableAttr(context.Context, *fs.Inode) (fs.UnstableAttr, error)
- type NoFsync
- type NoIoctl
- type NoMMap
- type NoMappable
- type NoopFlush
- type NoopFsync
- type NoopRelease
- type NoopWriteOut
- type NotDirReaddir
- type PipeSeek
- type ZeroSeek
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenericConfigureMMap ¶
GenericConfigureMMap implements fs.FileOperations.ConfigureMMap for most filesystems that support memory mapping.
func NewHandle ¶
func NewHandle(ctx context.Context, dirent *fs.Dirent, flags fs.FileFlags, hops fs.HandleOperations) *fs.File
NewHandle returns a File backed by the Dirent and FileFlags.
func NewSimpleInodeOperations ¶
func NewSimpleInodeOperations(i InodeSimpleAttributes) fs.InodeOperations
NewSimpleInodeOperations constructs fs.InodeOperations from InodeSimpleAttributes.
func SeekWithDirCursor ¶
func SeekWithDirCursor(ctx context.Context, file *fs.File, whence fs.SeekWhence, offset int64, dirCursor *string) (int64, error)
SeekWithDirCursor is used to implement fs.FileOperations.Seek. If dirCursor is not nil and the seek was on a directory, the cursor will be updated.
Currenly only seeking to 0 on a directory is supported.
FIXME: Lift directory seeking limitations.
func SyncDirty ¶
func SyncDirty(ctx context.Context, mr memmap.MappableRange, cache *FileRangeSet, dirty *DirtySet, max uint64, mem platform.File, writeAt func(ctx context.Context, srcs safemem.BlockSeq, offset uint64) (uint64, error)) error
SyncDirty passes pages in the range mr that are stored in cache and identified as dirty to writeAt, updating dirty to reflect successful writes. If writeAt returns a successful partial write, SyncDirty will call it repeatedly until all bytes have been written. max is the true size of the cached object; offsets beyond max will not be passed to writeAt, even if they are marked dirty.
func SyncDirtyAll ¶
func SyncDirtyAll(ctx context.Context, cache *FileRangeSet, dirty *DirtySet, max uint64, mem platform.File, writeAt func(ctx context.Context, srcs safemem.BlockSeq, offset uint64) (uint64, error)) error
SyncDirtyAll passes all pages stored in cache identified as dirty to writeAt, updating dirty to reflect successful writes. If writeAt returns a successful partial write, SyncDirtyAll will call it repeatedly until all bytes have been written. max is the true size of the cached object; offsets beyond max will not be passed to writeAt, even if they are marked dirty.
Types ¶
type CachedFileObject ¶
type CachedFileObject interface { // ReadToBlocksAt reads up to dsts.NumBytes() bytes from the file to dsts, // starting at offset, and returns the number of bytes read. ReadToBlocksAt // may return a partial read without an error. ReadToBlocksAt(ctx context.Context, dsts safemem.BlockSeq, offset uint64) (uint64, error) // WriteFromBlocksAt writes up to srcs.NumBytes() bytes from srcs to the // file, starting at offset, and returns the number of bytes written. // WriteFromBlocksAt may return a partial write without an error. WriteFromBlocksAt(ctx context.Context, srcs safemem.BlockSeq, offset uint64) (uint64, error) // SetMaskedAttributes sets the attributes in attr that are true in mask // on the backing file. // // SetMaskedAttributes may be called at any point, regardless of whether // the file was opened. SetMaskedAttributes(ctx context.Context, mask fs.AttrMask, attr fs.UnstableAttr) error // Sync instructs the remote filesystem to sync the file to stable storage. Sync(ctx context.Context) error // FD returns a host file descriptor. Return value must be -1 or not -1 // for the lifetime of the CachedFileObject. // // FD is called iff the file has been memory mapped. This implies that // the file was opened (see fs.InodeOperations.GetFile). // // FIXME: This interface seems to be // fundamentally broken. We should clarify CachingInodeOperation's // behavior with metadata. FD() int }
CachedFileObject is a file that may require caching.
type CachingInodeOperations ¶
type CachingInodeOperations struct {
// contains filtered or unexported fields
}
CachingInodeOperations caches the metadata and content of a CachedFileObject. It implements a subset of InodeOperations. As a utility it can be used to implement the full set of InodeOperations. Generally it should not be embedded to avoid unexpected inherited behavior.
CachingInodeOperations implements Mappable for the CachedFileObject:
- If CachedFileObject.FD returns a value >= 0 and the current platform shares a host fd table with the sentry, then the value of CachedFileObject.FD will be memory mapped on the host.
- Otherwise, the contents of CachedFileObject are buffered into memory managed by the CachingInodeOperations.
Implementations of FileOperations for a CachedFileObject must read and write through CachingInodeOperations using Read and Write respectively.
Implementations of InodeOperations.WriteOut must call Sync to write out in-memory modifications of data and metadata to the CachedFileObject.
func NewCachingInodeOperations ¶
func NewCachingInodeOperations(ctx context.Context, backingFile CachedFileObject, uattr fs.UnstableAttr, forcePageCache bool) *CachingInodeOperations
NewCachingInodeOperations returns a new CachingInodeOperations backed by a CachedFileObject and its initial unstable attributes.
func (*CachingInodeOperations) AddMapping ¶
func (c *CachingInodeOperations) AddMapping(ctx context.Context, ms memmap.MappingSpace, ar usermem.AddrRange, offset uint64) error
AddMapping implements memmap.Mappable.AddMapping.
func (*CachingInodeOperations) CopyMapping ¶
func (c *CachingInodeOperations) CopyMapping(ctx context.Context, ms memmap.MappingSpace, srcAR, dstAR usermem.AddrRange, offset uint64) error
CopyMapping implements memmap.Mappable.CopyMapping.
func (*CachingInodeOperations) DecLinks ¶
func (c *CachingInodeOperations) DecLinks(ctx context.Context)
DecLinks decreases the link count and updates cached access time.
func (*CachingInodeOperations) DecRef ¶
func (c *CachingInodeOperations) DecRef(fr platform.FileRange)
DecRef implements platform.File.DecRef. This is used when we directly map an underlying host fd and CachingInodeOperations is used as the platform.File during translation.
func (*CachingInodeOperations) IncLinks ¶
func (c *CachingInodeOperations) IncLinks(ctx context.Context)
IncLinks increases the link count and updates cached access time.
func (*CachingInodeOperations) IncRef ¶
func (c *CachingInodeOperations) IncRef(fr platform.FileRange)
IncRef implements platform.File.IncRef. This is used when we directly map an underlying host fd and CachingInodeOperations is used as the platform.File during translation.
func (*CachingInodeOperations) InvalidateUnsavable ¶
func (c *CachingInodeOperations) InvalidateUnsavable(ctx context.Context) error
InvalidateUnsavable implements memmap.Mappable.InvalidateUnsavable.
func (*CachingInodeOperations) MapInternal ¶
func (c *CachingInodeOperations) MapInternal(fr platform.FileRange, at usermem.AccessType) (safemem.BlockSeq, error)
MapInternal implements platform.File.MapInternal. This is used when we directly map an underlying host fd and CachingInodeOperations is used as the platform.File during translation.
func (*CachingInodeOperations) MapInto ¶
func (c *CachingInodeOperations) MapInto(as platform.AddressSpace, addr usermem.Addr, fr platform.FileRange, at usermem.AccessType, precommit bool) error
MapInto implements platform.File.MapInto. This is used when we directly map an underlying host fd and CachingInodeOperations is used as the platform.File during translation.
func (*CachingInodeOperations) Read ¶
func (c *CachingInodeOperations) Read(ctx context.Context, file *fs.File, dst usermem.IOSequence, offset int64) (int64, error)
Read reads from frames and otherwise directly from the backing file into dst starting at offset until dst is full, EOF is reached, or an error is encountered.
Read may partially fill dst and return a nil error.
func (*CachingInodeOperations) Release ¶
func (c *CachingInodeOperations) Release()
Release implements fs.InodeOperations.Release.
func (*CachingInodeOperations) RemoveMapping ¶
func (c *CachingInodeOperations) RemoveMapping(ctx context.Context, ms memmap.MappingSpace, ar usermem.AddrRange, offset uint64)
RemoveMapping implements memmap.Mappable.RemoveMapping.
func (*CachingInodeOperations) SetOwner ¶
func (c *CachingInodeOperations) SetOwner(ctx context.Context, inode *fs.Inode, owner fs.FileOwner) error
SetOwner implements fs.InodeOperations.SetOwner.
func (*CachingInodeOperations) SetPermissions ¶
func (c *CachingInodeOperations) SetPermissions(ctx context.Context, inode *fs.Inode, perms fs.FilePermissions) bool
SetPermissions implements fs.InodeOperations.SetPermissions.
func (*CachingInodeOperations) SetTimestamps ¶
func (c *CachingInodeOperations) SetTimestamps(ctx context.Context, inode *fs.Inode, ts fs.TimeSpec) error
SetTimestamps implements fs.InodeOperations.SetTimestamps.
func (*CachingInodeOperations) TouchAccessTime ¶
func (c *CachingInodeOperations) TouchAccessTime(ctx context.Context, inode *fs.Inode)
TouchAccessTime updates the cached access time in-place to the current time. It does not update status change time in-place. See mm/filemap.c:do_generic_file_read -> include/linux/h:file_accessed.
func (*CachingInodeOperations) TouchModificationTime ¶
func (c *CachingInodeOperations) TouchModificationTime(ctx context.Context)
TouchModificationTime updates the cached modification and status change time in-place to the current time.
func (*CachingInodeOperations) Translate ¶
func (c *CachingInodeOperations) Translate(ctx context.Context, required, optional memmap.MappableRange, at usermem.AccessType) ([]memmap.Translation, error)
Translate implements memmap.Mappable.Translate.
func (*CachingInodeOperations) UnstableAttr ¶
func (c *CachingInodeOperations) UnstableAttr(ctx context.Context, inode *fs.Inode) (fs.UnstableAttr, error)
UnstableAttr implements fs.InodeOperations.UnstableAttr.
func (*CachingInodeOperations) Write ¶
func (c *CachingInodeOperations) Write(ctx context.Context, src usermem.IOSequence, offset int64) (int64, error)
Write writes to frames and otherwise directly to the backing file from src starting at offset and until src is empty or an error is encountered.
If Write partially fills src, a non-nil error is returned.
type DeprecatedFileOperations ¶
type DeprecatedFileOperations struct{}
DeprecatedFileOperations panics if any deprecated Inode method is called.
func (DeprecatedFileOperations) DeprecatedFlush ¶
func (DeprecatedFileOperations) DeprecatedFlush() error
DeprecatedFlush implements fs.InodeOperations.DeprecatedFlush.
func (DeprecatedFileOperations) DeprecatedFsync ¶
func (DeprecatedFileOperations) DeprecatedFsync() error
DeprecatedFsync implements fs.InodeOperations.DeprecatedFsync.
func (DeprecatedFileOperations) DeprecatedMappable ¶
func (DeprecatedFileOperations) DeprecatedMappable(context.Context, *fs.Inode) (memmap.Mappable, bool)
DeprecatedMappable implements fs.InodeOperations.DeprecatedMappable.
func (DeprecatedFileOperations) DeprecatedPreadv ¶
func (DeprecatedFileOperations) DeprecatedPreadv(context.Context, usermem.IOSequence, int64) (int64, error)
DeprecatedPreadv implements fs.InodeOperations.DeprecatedPreadv.
func (DeprecatedFileOperations) DeprecatedPwritev ¶
func (DeprecatedFileOperations) DeprecatedPwritev(context.Context, usermem.IOSequence, int64) (int64, error)
DeprecatedPwritev implements fs.InodeOperations.DeprecatedPwritev.
func (DeprecatedFileOperations) DeprecatedReaddir ¶
DeprecatedReaddir implements fs.InodeOperations.DeprecatedReaddir.
func (DeprecatedFileOperations) EventRegister ¶
func (DeprecatedFileOperations) EventRegister(*waiter.Entry, waiter.EventMask)
EventRegister implements fs.InodeOperations.Waitable.EventRegister.
func (DeprecatedFileOperations) EventUnregister ¶
func (DeprecatedFileOperations) EventUnregister(*waiter.Entry)
EventUnregister implements fs.InodeOperations.Waitable.EventUnregister.
type DirFileOperations ¶
type DirFileOperations struct { waiter.AlwaysReady `state:"nosave"` NoopRelease `state:"nosave"` GenericSeek `state:"nosave"` NoFsync `state:"nosave"` NoopFlush `state:"nosave"` NoMMap `state:"nosave"` NoIoctl `state:"nosave"` // contains filtered or unexported fields }
DirFileOperations implements FileOperations for directories.
func NewDirFileOperations ¶
func NewDirFileOperations(dentries *fs.SortedDentryMap) *DirFileOperations
NewDirFileOperations returns a new DirFileOperations that will iterate the given denty map.
func (*DirFileOperations) IterateDir ¶
func (dfo *DirFileOperations) IterateDir(ctx context.Context, dirCtx *fs.DirCtx, offset int) (int, error)
IterateDir implements DirIterator.IterateDir.
func (*DirFileOperations) Read ¶
func (*DirFileOperations) Read(context.Context, *fs.File, usermem.IOSequence, int64) (int64, error)
Read implements FileOperations.Read
type DirtyInfo ¶
type DirtyInfo struct { // Keep is true if the represented offset is concurrently writable, such // that writing the data for that offset back to the source does not // guarantee that the offset is clean (since it may be concurrently // rewritten after the writeback). Keep bool }
DirtyInfo is the value type of DirtySet, and represents information about a Mappable offset that is dirty (the cached data for that offset is newer than its source).
type GenericSeek ¶
type GenericSeek struct{}
GenericSeek implements FileOperations.Seek for files that use a generic seek implementation.
type Handle ¶
type Handle struct { NoopRelease `state:"nosave"` NoIoctl `state:"nosave"` HandleOperations fs.HandleOperations // contains filtered or unexported fields }
Handle implements FileOperations.
FIXME: Remove Handle entirely in favor of individual fs.File implementations using simple generic utilities.
func (*Handle) ConfigureMMap ¶
ConfigureMMap implements FileOperations.ConfigureMMap.
func (*Handle) EventRegister ¶
EventRegister implements waiter.Waitable.EventRegister.
func (*Handle) EventUnregister ¶
EventUnregister implements waiter.Waitable.EventUnregister.
func (*Handle) Fsync ¶
func (h *Handle) Fsync(ctx context.Context, file *fs.File, start int64, end int64, syncType fs.SyncType) error
Fsync implements FileOperations.Fsync.
func (*Handle) IterateDir ¶
IterateDir implements DirIterator.IterateDir.
func (*Handle) Read ¶
func (h *Handle) Read(ctx context.Context, file *fs.File, dst usermem.IOSequence, offset int64) (int64, error)
Read implements FileOperations.Read.
func (*Handle) Readdir ¶
func (h *Handle) Readdir(ctx context.Context, file *fs.File, serializer fs.DentrySerializer) (int64, error)
Readdir implements FileOperations.Readdir.
type HostFileMapper ¶
type HostFileMapper struct {
// contains filtered or unexported fields
}
HostFileMapper caches mappings of an arbitrary host file descriptor. It is used by implementations of memmap.Mappable that represent a host file descriptor.
func NewHostFileMapper ¶
func NewHostFileMapper() *HostFileMapper
NewHostFileMapper returns a HostFileMapper with no references or cached mappings.
func (*HostFileMapper) DecRefOn ¶
func (f *HostFileMapper) DecRefOn(mr memmap.MappableRange)
DecRefOn decrements the reference count on all offsets in mr.
Preconditions: mr.Length() != 0. mr.Start and mr.End must be page-aligned.
func (*HostFileMapper) IncRefOn ¶
func (f *HostFileMapper) IncRefOn(mr memmap.MappableRange)
IncRefOn increments the reference count on all offsets in mr.
Preconditions: mr.Length() != 0. mr.Start and mr.End must be page-aligned.
func (*HostFileMapper) MapInternal ¶
func (f *HostFileMapper) MapInternal(fr platform.FileRange, fd int, write bool) (safemem.BlockSeq, error)
MapInternal returns a mapping of offsets in fr from fd. The returned safemem.BlockSeq is valid as long as at least one reference is held on all offsets in fr or until the next call to UnmapAll.
Preconditions: The caller must hold a reference on all offsets in fr.
func (*HostFileMapper) UnmapAll ¶
func (f *HostFileMapper) UnmapAll()
UnmapAll unmaps all cached mappings. Callers are responsible for synchronization with mappings returned by previous calls to MapInternal.
type InMemoryAttributes ¶
type InMemoryAttributes struct { Unstable fs.UnstableAttr Xattrs map[string][]byte }
InMemoryAttributes implements utilities for updating in-memory unstable attributes and extended attributes. It is not thread-safe.
Users need not initialize Xattrs to non-nil (it will be initialized when the first extended attribute is set.
func (*InMemoryAttributes) Getxattr ¶
func (i *InMemoryAttributes) Getxattr(name string) ([]byte, error)
Getxattr returns the extended attribute at name or ENOATTR if it isn't set.
func (*InMemoryAttributes) Listxattr ¶
func (i *InMemoryAttributes) Listxattr() (map[string]struct{}, error)
Listxattr returns the set of all currently set extended attributes.
func (*InMemoryAttributes) SetPermissions ¶
func (i *InMemoryAttributes) SetPermissions(ctx context.Context, p fs.FilePermissions) bool
SetPermissions updates the permissions to p.
func (*InMemoryAttributes) SetTimestamps ¶
SetTimestamps sets the timestamps to ts.
func (*InMemoryAttributes) Setxattr ¶
func (i *InMemoryAttributes) Setxattr(name string, value []byte) error
Setxattr sets the extended attribute at name to value.
func (*InMemoryAttributes) TouchAccessTime ¶
func (i *InMemoryAttributes) TouchAccessTime(ctx context.Context)
TouchAccessTime updates access time to the current time.
func (*InMemoryAttributes) TouchModificationTime ¶
func (i *InMemoryAttributes) TouchModificationTime(ctx context.Context)
TouchModificationTime updates modification and status change time to the current time.
func (*InMemoryAttributes) TouchStatusChangeTime ¶
func (i *InMemoryAttributes) TouchStatusChangeTime(ctx context.Context)
TouchStatusChangeTime updates status change time to the current time.
type InodeNoExtendedAttributes ¶
type InodeNoExtendedAttributes struct{}
InodeNoExtendedAttributes can be used by Inodes that do not support extended attributes.
type InodeNotDirectory ¶
type InodeNotDirectory struct{}
InodeNotDirectory can be used by Inodes that are not directories.
func (InodeNotDirectory) Bind ¶
func (InodeNotDirectory) Bind(context.Context, *fs.Inode, string, unix.BoundEndpoint, fs.FilePermissions) error
Bind implements fs.InodeOperations.Bind.
func (InodeNotDirectory) Create ¶
func (InodeNotDirectory) Create(context.Context, *fs.Inode, string, fs.FileFlags, fs.FilePermissions) (*fs.File, error)
Create implements fs.InodeOperations.Create.
func (InodeNotDirectory) CreateDirectory ¶
func (InodeNotDirectory) CreateDirectory(context.Context, *fs.Inode, string, fs.FilePermissions) error
CreateDirectory implements fs.InodeOperations.CreateDirectory.
func (InodeNotDirectory) CreateFifo ¶
func (InodeNotDirectory) CreateFifo(context.Context, *fs.Inode, string, fs.FilePermissions) error
CreateFifo implements fs.InodeOperations.CreateFifo.
func (InodeNotDirectory) CreateHardLink ¶
CreateHardLink implements fs.InodeOperations.CreateHardLink.
func (InodeNotDirectory) CreateLink ¶
CreateLink implements fs.InodeOperations.CreateLink.
func (InodeNotDirectory) RemoveDirectory ¶
RemoveDirectory implements fs.InodeOperations.RemoveDirectory.
type InodeNotOpenable ¶
type InodeNotOpenable struct{}
InodeNotOpenable can be used by Inodes that cannot be opened.
type InodeNotRenameable ¶
type InodeNotRenameable struct{}
InodeNotRenameable can be used by Inodes that cannot be renamed.
type InodeNotSocket ¶
type InodeNotSocket struct{}
InodeNotSocket can be used by Inodes that are not sockets.
func (InodeNotSocket) BoundEndpoint ¶
func (InodeNotSocket) BoundEndpoint(*fs.Inode, string) unix.BoundEndpoint
BoundEndpoint implements fs.InodeOperations.BoundEndpoint.
type InodeNotSymlink ¶
type InodeNotSymlink struct{}
InodeNotSymlink can be used by Inodes that are not symlinks.
type InodeNotVirtual ¶
type InodeNotVirtual struct{}
InodeNotVirtual can be used by Inodes that are not virtual.
func (InodeNotVirtual) IsVirtual ¶
func (InodeNotVirtual) IsVirtual() bool
IsVirtual implements fs.InodeOperations.IsVirtual.
type InodeSimpleAttributes ¶
type InodeSimpleAttributes struct { // FSType is the filesystem type reported by StatFS. FSType uint64 // UAttr are the unstable attributes of the Inode. UAttr fs.UnstableAttr }
InodeSimpleAttributes implements a subset of the Inode interface. It provides read-only access to attributes.
func (*InodeSimpleAttributes) AddLink ¶
func (*InodeSimpleAttributes) AddLink()
AddLink implements fs.InodeOperations.AddLink.
func (*InodeSimpleAttributes) DropLink ¶
func (*InodeSimpleAttributes) DropLink()
DropLink implements fs.InodeOperations.DropLink.
func (*InodeSimpleAttributes) NotifyStatusChange ¶
func (i *InodeSimpleAttributes) NotifyStatusChange(ctx context.Context)
NotifyStatusChange implements fs.fs.InodeOperations.
func (*InodeSimpleAttributes) Release ¶
func (i *InodeSimpleAttributes) Release(context.Context)
Release implements fs.InodeOperations.Release.
func (*InodeSimpleAttributes) SetPermissions ¶
func (*InodeSimpleAttributes) SetPermissions(context.Context, *fs.Inode, fs.FilePermissions) bool
SetPermissions implements fs.InodeOperations.SetPermissions.
func (*InodeSimpleAttributes) SetTimestamps ¶
SetTimestamps implements fs.InodeOperations.SetTimestamps.
func (*InodeSimpleAttributes) UnstableAttr ¶
func (i *InodeSimpleAttributes) UnstableAttr(context.Context, *fs.Inode) (fs.UnstableAttr, error)
UnstableAttr implements fs.InodeOperations.UnstableAttr.
type NoFsync ¶
type NoFsync struct{}
NoFsync implements FileOperations.Fsync for files that don't support syncing.
type NoIoctl ¶
type NoIoctl struct{}
NoIoctl implements fs.FileOperations.Ioctl for files that don't implement the ioctl syscall.
type NoMMap ¶
type NoMMap struct{}
NoMMap implements fs.FileOperations.Mappable for files that cannot be memory mapped.
type NoopFsync ¶
type NoopFsync struct{}
NoopFsync implements FileOperations.Fsync for files that don't need to synced.
type NoopRelease ¶
type NoopRelease struct{}
NoopRelease implements FileOperations.Release for files that have no resources to release.
type NoopWriteOut ¶
type NoopWriteOut struct{}
NoopWriteOut is a no-op implementation of Inode.WriteOut.
type NotDirReaddir ¶
type NotDirReaddir struct{}
NotDirReaddir implements FileOperations.Readdir for non-directories.
type PipeSeek ¶
type PipeSeek struct{}
PipeSeek implements FileOperations.Seek and can be used for files that behave like pipes (seeking is not supported).